Archived
14
0
Fork 0
Commit graph

501 commits

Author SHA1 Message Date
Linus Torvalds
fc0b60f1dc Merge branch 'for-linus' of git://git390.osdl.marist.edu/pub/scm/linux-2.6
* 'for-linus' of git://git390.osdl.marist.edu/pub/scm/linux-2.6:
  [S390] update default configuration.
  [S390] Kconfig: no wireless on s390.
  [S390] Kconfig: use common Kconfig files for s390.
  [S390] Kconfig: common config options for s390.
  [S390] Kconfig: unwanted menus for s390.
  [S390] Kconfig: menus with depends on HAS_IOMEM.
  [S390] Kconfig: refine depends statements.
  [S390] Avoid compile warning.
  [S390] qdio: re-add lost perf_stats.tl_runs change in qdio_handle_pci
  [S390] Avoid sparse warnings.
  [S390] dasd: Fix modular build.
  [S390] monreader inlining cleanup.
  [S390] cio: Make some structures and a function static.
  [S390] cio: Get rid of _ccw_device_get_device_number().
  [S390] fix subsystem removal fallout
2007-05-10 11:50:51 -07:00
Alexey Dobriyan
c91e23c63f i2c-at91: compile fix (IS_ERR)
CC      drivers/i2c/busses/i2c-at91.o
drivers/i2c/busses/i2c-at91.c: In function 'at91_i2c_probe':
drivers/i2c/busses/i2c-at91.c:213: warning: implicit declaration of function 'IS_ERR'

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Cc: David Brownell <david-b@pacbell.net>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-05-10 09:26:53 -07:00
David Brownell
6e99806ebb i2c-at91 supports new-style i2c drivers
Make i2c-at91 register as i2c adapter zero (none of these chips seem to
have more than one TWI controllers) to let it kick in any board-specific
device declarations; also make it hotplug/coldplug.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Acked-by: Jean Delvare <khali@linux-fr.org>
Cc: Andrew Victor <andrew@sanpeople.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-05-10 09:26:53 -07:00
Russell King
0cfe61e1a7 arm: fix i2c-pxa build
From commit 7d054817b7:
> According to the PXA27x developer's manual, we shall do so.

We shall also at least compile test our changes.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-05-10 09:26:52 -07:00
Martin Schwidefsky
e25df1205f [S390] Kconfig: menus with depends on HAS_IOMEM.
Add "depends on HAS_IOMEM" to a number of menus to make them
disappear for s390 which does not have I/O memory.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2007-05-10 15:46:07 +02:00
Rafael J. Wysocki
a3d25c275d PM: Separate hibernation code from suspend code
[ With Johannes Berg <johannes@sipsolutions.net> ]

Separate the hibernation (aka suspend to disk code) from the other suspend
code.  In particular:

 * Remove the definitions related to hibernation from include/linux/pm.h
 * Introduce struct hibernation_ops and a new hibernate() function to hibernate
   the system, defined in include/linux/suspend.h
 * Separate suspend code in kernel/power/main.c from hibernation-related code
   in kernel/power/disk.c and kernel/power/user.c (with the help of
   hibernation_ops)
 * Switch ACPI (the only user of pm_ops.pm_disk_mode) to hibernation_ops

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Greg KH <greg@kroah.com>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Nigel Cunningham <nigel@nigel.suspend2.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-05-09 12:30:48 -07:00
Randy Dunlap
e63340ae6b header cleaning: don't include smp_lock.h when not used
Remove includes of <linux/smp_lock.h> where it is not used/needed.
Suggested by Al Viro.

Builds cleanly on x86_64, i386, alpha, ia64, powerpc, sparc,
sparc64, and arm (all 59 defconfigs).

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-05-08 11:15:07 -07:00
David Brownell
da67529642 layered parport code uses parport->dev
Update some of the layered parport_driver code to use parport->dev:

	- i2c-parport (parent of i2c_adapter)
	- spi_butterfly (parent of spi_master, allowing cruft removal)
	- lp (creating class_device)
	- ppdev (parent of parportN device)
	- tipar (creating class_device)

There are still drivers that should be updated, like some of the input
drivers; but they won't be any worse off than they are today.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Greg KH <greg@kroah.com>
Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-05-08 11:15:05 -07:00
Johannes Berg
ab3bfca7ab remove software_suspend()
Remove software_suspend() and all its users since
pm_suspend(PM_SUSPEND_DISK) should be equivalent and there's no point in
having two interfaces for the same thing.

The patch also changes the valid_state function to return 0 (false) for
PM_SUSPEND_DISK when SOFTWARE_SUSPEND is not configured instead of
accepting it and having the whole thing fail later.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-05-07 12:12:59 -07:00
Linus Torvalds
c6799ade4a Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm: (82 commits)
  [ARM] Add comments marking in-use ptrace numbers
  [ARM] Move syscall saving out of the way of utrace
  [ARM] 4360/1: S3C24XX: regs-udc.h remove unused macro
  [ARM] 4358/1: S3C24XX: mach-qt2410.c: remove linux/mmc/protocol.h header
  [ARM] mm 10: allow memory type to be specified with ioremap
  [ARM] mm 9: add additional device memory types
  [ARM] mm 8: define mem_types table L1 bit 4 to be for ARMv6
  [ARM] iop: add missing parens in macro
  [ARM] mm 7: remove duplicated __ioremap() prototypes
  ARM: OMAP: fix OMAP1 mpuio suspend/resume oops
  ARM: OMAP: MPUIO wake updates
  ARM: OMAP: speed up gpio irq handling
  ARM: OMAP: plat-omap changes for 2430 SDP
  ARM: OMAP: gpio object shrinkage, cleanup
  ARM: OMAP: /sys/kernel/debug/omap_gpio
  ARM: OMAP: Implement workaround for GPIO wakeup bug in OMAP2420 silicon
  ARM: OMAP: Enable 24xx GPIO autoidling
  [ARM] 4318/2: DSM-G600 Board Support
  [ARM] 4227/1: minor head.S fixups
  [ARM] 4328/1: Move i.MX UART regs to driver
  ...
2007-05-06 13:20:10 -07:00
Linus Torvalds
89661adaae Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6: (59 commits)
  PCI: Free resource files in error path of pci_create_sysfs_dev_files()
  pci-quirks: disable MSI on RS400-200 and RS480
  PCI hotplug: Use menuconfig objects
  PCI: ZT5550 CPCI Hotplug driver fix
  PCI: rpaphp: Remove semaphores
  PCI: rpaphp: Ensure more pcibios_add/pcibios_remove symmetry
  PCI: rpaphp: Use pcibios_remove_pci_devices() symmetrically
  PCI: rpaphp: Document is_php_dn()
  PCI: rpaphp: Document find_php_slot()
  PCI: rpaphp: Rename rpaphp_register_pci_slot() to rpaphp_enable_slot()
  PCI: rpaphp: refactor tail call to rpaphp_register_slot()
  PCI: rpaphp: remove rpaphp_set_attention_status()
  PCI: rpaphp: remove print_slot_pci_funcs()
  PCI: rpaphp: Remove setup_pci_slot()
  PCI: rpaphp: remove a call that does nothing but a pointer lookup
  PCI: rpaphp: Remove another wrappered function
  PCI: rpaphp: Remve another call that is a wrapper
  PCI: rpaphp: remove a function that does nothing but wrap debug printks
  PCI: rpaphp: Remove un-needed goto
  PCI: rpaphp: Fix a memleak; slot->location string was never freed
  ...
2007-05-04 18:04:29 -07:00
Jean Delvare
6473d160b4 PCI: Cleanup the includes of <linux/pci.h>
I noticed that many source files include <linux/pci.h> while they do
not appear to need it. Here is an attempt to clean it all up.

In order to find all possibly affected files, I searched for all
files including <linux/pci.h> but without any other occurence of "pci"
or "PCI". I removed the include statement from all of these, then I
compiled an allmodconfig kernel on both i386 and x86_64 and fixed the
false positives manually.

My tests covered 66% of the affected files, so there could be false
positives remaining. Untested files are:

arch/alpha/kernel/err_common.c
arch/alpha/kernel/err_ev6.c
arch/alpha/kernel/err_ev7.c
arch/ia64/sn/kernel/huberror.c
arch/ia64/sn/kernel/xpnet.c
arch/m68knommu/kernel/dma.c
arch/mips/lib/iomap.c
arch/powerpc/platforms/pseries/ras.c
arch/ppc/8260_io/enet.c
arch/ppc/8260_io/fcc_enet.c
arch/ppc/8xx_io/enet.c
arch/ppc/syslib/ppc4xx_sgdma.c
arch/sh64/mach-cayman/iomap.c
arch/xtensa/kernel/xtensa_ksyms.c
arch/xtensa/platform-iss/setup.c
drivers/i2c/busses/i2c-at91.c
drivers/i2c/busses/i2c-mpc.c
drivers/media/video/saa711x.c
drivers/misc/hdpuftrs/hdpu_cpustate.c
drivers/misc/hdpuftrs/hdpu_nexus.c
drivers/net/au1000_eth.c
drivers/net/fec_8xx/fec_main.c
drivers/net/fec_8xx/fec_mii.c
drivers/net/fs_enet/fs_enet-main.c
drivers/net/fs_enet/mac-fcc.c
drivers/net/fs_enet/mac-fec.c
drivers/net/fs_enet/mac-scc.c
drivers/net/fs_enet/mii-bitbang.c
drivers/net/fs_enet/mii-fec.c
drivers/net/ibm_emac/ibm_emac_core.c
drivers/net/lasi_82596.c
drivers/parisc/hppb.c
drivers/sbus/sbus.c
drivers/video/g364fb.c
drivers/video/platinumfb.c
drivers/video/stifb.c
drivers/video/valkyriefb.c
include/asm-arm/arch-ixp4xx/dma.h
sound/oss/au1550_ac97.c

I would welcome test reports for these files. I am fine with removing
the untested files from the patch if the general opinion is that these
changes aren't safe. The tested part would still be nice to have.

Note that this patch depends on another header fixup patch I submitted
to LKML yesterday:
  [PATCH] scatterlist.h needs types.h
  http://lkml.org/lkml/2007/3/01/141

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Badari Pulavarty <pbadari@us.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-05-02 19:02:35 -07:00
Ben Dooks
5b68790cd5 i2c-s3c2410: Fix bug in releasing driver
When compiled as a module, the i2c-s3c2410 driver does not
free either the IRQ or the i2c adapter it attached to the system.

As part of this fix, move to the usual kernel style
of freeing items as part of the probe error path
making the remove process easier.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:35 +02:00
Ben Dooks
e00a8cdf32 i2c-s3c2410: Fix I2C SDA to SCL setup time
Fix the setup time for SDA to SCL due to the way
the S3C24XX I2C controller works.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:35 +02:00
Till Harbaum
e8c76eed2e i2c: New i2c-tiny-usb bus driver
Add a driver for the i2c-tiny-usb interface. This is a simple
do-it-yourself USB to I2C interface targeted at experimental and
home use. See the i2c-tiny-usb homepage for hardware details:
http://www.harbaum.org/till/i2c_tiny_usb

Signed-off-by: Till Harbaum <till@harbaum.org>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:35 +02:00
Milind Arun Choudhary
35532d2003 i2c: SPIN_LOCK_UNLOCKED cleanup
SPIN_LOCK_UNLOCKED cleanup, use __SPIN_LOCK_UNLOCKED instead.

Signed-off-by: Milind Arun Choudhary <milindchoudhary@gmail.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:34 +02:00
Jean Delvare
11de70bd4d i2c: Obsolete i2c-ixp2000, i2c-ixp4xx and scx200_i2c
The new generic i2c-gpio driver should be used instead.
The obsolete drivers will be removed in September 2007.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Deepak Saxena <dsaxena@plexity.net>
Cc: Jordan Crouse <jordan.crouse@amd.com>
2007-05-01 23:26:34 +02:00
Ben Dooks
bcda9f1eb0 i2c: New Simtec I2C bus driver
Platform driver for the Simtec CPLD based simple I2C logic.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:34 +02:00
Haavard Skinnemoen
1c23af90dc i2c: Bitbanging I2C bus driver using the GPIO API
This is a very simple bitbanging I2C bus driver utilizing the new
arch-neutral GPIO API. Useful for chips that don't have a built-in
I2C controller, additional I2C busses, or testing purposes.

To use, include something similar to the following in the
board-specific setup code:

  #include <linux/i2c-gpio.h>

  static struct i2c_gpio_platform_data i2c_gpio_data = {
	.sda_pin	= GPIO_PIN_FOO,
	.scl_pin	= GPIO_PIN_BAR,
  };
  static struct platform_device i2c_gpio_device = {
	.name		= "i2c-gpio",
	.id		= 0,
	.dev		= {
		.platform_data	= &i2c_gpio_data,
	},
  };

Register this platform_device, set up the I2C pins as GPIO if
required and you're ready to go. This will use default values for
udelay and timeout, and will work with GPIO hardware that does not
support open drain mode, but allows sensing of the SDA and SCL lines
even when they are being driven.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:34 +02:00
Jan Engelhardt
16538e6b32 Use menuconfig objects - I2C
Allow the whole I2C menu to be disabled at once without diving into
the submenus for deselecting all options (should the user desire so).

Signed-off-by: Jan Engelhardt <jengelh@gmx.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:34 +02:00
Jean Delvare
b86a1bc8e3 i2c: Restore i2c_smbus_read_block_data
Add back the i2c_smbus_read_block_data helper function, it is needed
by the upcoming lm93 hardware monitoring driver and possibly others.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:34 +02:00
Jean Delvare
7d054817b7 i2c-pxa: Clean transaction stop
It was reported to me that the i2c-pxa driver was not able to process
more that 50 transactions per second. Investigation revealed that the
I2C unit was busy for 20 ms after every transaction. The reason seems
to be that we forget to clear the STOP and ACKNACK bits at the end of
the transaction. According to the PXA27x developer's manual, we shall
do so.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Lennert Buytenhek <kernel@wantstofly.org>
Cc: Nicolas Pitre <nico@cam.org>
2007-05-01 23:26:33 +02:00
Jean Delvare
494dbb64dc i2c-algo-bit: Improve debugging
Improve the debugging features of the i2c-algo-bit driver:
* Make it possible to compile the driver without debugging support
  at all, making it much smaller.
* Use dev_dbg() for debugging messages where possible, and dev_err()
  for error messages.
* Remove redundant debugging messages.

These changes allowed for minor code cleanups, which are included
as well.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:33 +02:00
Jean Delvare
424ed67c7d i2c-algo-bit: Implement a 50/50 SCL duty cycle
The original i2c-algo-bit implementation uses a 33/66 SCL duty cycle
when bits are being written on the bus. While the I2C specification
doesn't forbid it, this prevents us from driving the I2C bus to its
max speed, limiting us to 66 kbps max on standard I2C busses.

Implementing a 50/50 duty cycle instead lets us max out the bandwidth
up to the theoretical max of 100 kbps on standard I2C busses. This is
particularly important when large amounts of data need to be transfered
over the bus, as is the case with some TV adapters when the firmware is
being uploaded.

In fact this change even allows, at least in theory, fast-mode I2C
support at 125, 166 and 250 kbps. There's no way to reach the
theoretical max of 400 kbps with this implementation. But I don't
think we want to put efforts in that direction anyway: software-driven
I2C is very CPU-intensive and bad for latency.

Other timing changes:
* Don't set SDA high explicitly on error, we're going to issue a stop
  condition before we leave anyway.
* If an error occurs when sending the slave address, yield the CPU
  before retrying, and remove the additional delay after the new start
  condition.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:33 +02:00
David Brownell
7c17549982 i2c-omap: Switch to static adapter numbering
Update the OMAP I2C driver to use i2c_add_numbered_adapter(), so that
later patches can convert boards to using new-style drivers.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:32 +02:00
Bryan Wu
d24ecfcc39 i2c: Blackfin Two Wire Interface driver
The i2c linux driver for blackfin architecture which supports blackfin
on-chip TWI controller i2c operation.

Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Reviewed-by: Alexey Dobriyan <adobriyan@gmail.com>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:32 +02:00
Ladislav Michl
6edac5803f i2c-algo-sgi: Comment and whitespace cleanups
Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:32 +02:00
Jean Delvare
b3e820968a i2c: Make i2c_del_driver a void function
Make i2c_del_driver a void function, like all other driver removal
functions. It always returned 0 even when errors occured, and nobody
ever actually checked the return value anyway. And we cannot fail
a module removal anyway.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:32 +02:00
Jean Delvare
a97f1ed090 i2c: Move i2c-isa-only exported symbol declarations
Move the declaration of i2c-isa-only exported symbols to i2c-isa
itself, that's the best way to ensure nobody will attempt to use them.
Hopefully we'll get rid of the exports themselves soon anyway.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:32 +02:00
Jean Delvare
12b5053ac5 i2c: Add i2c_new_probed_device()
Add a new helper function to instantiate an i2c device. It is meant as a
replacement for i2c_new_device() when you don't know for sure at which
address your I2C/SMBus device lives. This happens frequently on TV
adapters for example, you know there is a tuner chip on the bus, but
depending on the exact board model and revision, it can live at different
addresses. So, the new i2c_new_probed_device() function will probe the bus
according to a list of addresses, and as soon as one of these addresses
responds, it will call i2c_new_device() on that one address.

This function will make it possible to port the old i2c drivers to the
new model quickly.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:31 +02:00
Jean Delvare
0f3b483852 i2c-algo-bit: Add i2c_bit_add_numbered_bus
Add i2c_bit_add_numbered_bus(), which is equivalent to i2c_bit_add_bus
except that it calls i2c_add_numbered_adapter() at the end instead of
i2c_add_adapter().

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:31 +02:00
David Brownell
c05646069c i2c: i2c EXPORT_SYMBOL cleanup
Make i2c-core.c obey Documentation/CodingStyle better by snugging
the EXPORT_SYMBOL declarations next to the relevant definitions.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:31 +02:00
David Brownell
6e13e64184 i2c: Add i2c_add_numbered_adapter()
This adds a call, i2c_add_numbered_adapter(), registering an I2C adapter
with a specific bus number and then creating I2C device nodes for any
pre-declared devices on that bus.  It builds on previous patches adding
I2C probe() and remove() support, and that pre-declaration of devices.

This completes the core support for "new style" I2C device drivers.
Those follow the standard driver model for binding devices to drivers
(using probe and remove methods) rather than a legacy model (where the
driver tries to autoconfigure each bus, and registers devices itself).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:31 +02:00
David Brownell
9c1600eda4 i2c: Add i2c_board_info and i2c_new_device()
This provides partial support for new-style I2C driver binding.  It builds
on "struct i2c_board_info" declarations that identify I2C devices on a given
board.  This is needed on systems with I2C devices that can't be fully probed
and/or autoconfigured, such as many embedded Linux configurations where the
way a given I2C device is wired may affect how it must be used.

There are two models for declaring such devices:

 * LATE -- using a public function i2c_new_device().  This lets modules
   declare I2C devices found *AFTER* a given I2C adapter becomes available.
   
   For example, a PCI card could create adapters giving access to utility
   chips on that card, and this would be used to associate those chips with
   those adapters.

 * EARLY -- from arch_initcall() level code, using a non-exported function
   i2c_register_board_info().  This copies the declarations *BEFORE* such
   an i2c_adapter becomes available, arranging that i2c_new_device() will
   be called later when i2c-core registers the relevant i2c_adapter.

   For example, arch/.../.../board-*.c files would declare the I2C devices
   along with their platform data, and I2C devices would behave much like
   PNPACPI devices.  (That is, both enumerate from board-specific tables.)

To match the exported i2c_new_device(), the previously-private function
i2c_unregister_device() is now exported.

Pending later patches using these new APIs, this is effectively a NOP.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:31 +02:00
David Brownell
a1d9e6e49f i2c: i2c stack can remove()
More update for new style driver support:  add a remove() method, and
use it in the relevant code paths.

Again, nothing will use this yet since there's nothing to create devices
feeding this infrastructure.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:30 +02:00
David Brownell
7b4fbc50fa i2c: i2c stack can probe()
One of a series of I2C infrastructure updates to support enumeration using
the standard Linux driver model.

This patch updates probe() and associated hotplug/coldplug support, but
not remove().  Nothing yet _uses_ it to create I2C devices, so those
hotplug/coldplug mechanisms will be the only externally visible change.
This patch will be an overall NOP since the I2C stack doesn't yet create
clients/devices except as part of binding them to legacy drivers.

Some code is moved earlier in the source code, helping group more of the
per-device infrastructure in one place and simplifying handling per-device
attributes.

Terminology being adopted:  "legacy drivers" create devices (i2c_client)
themselves, while "new style" ones follow the driver model (the i2c_client
is handed to the probe routine).  It's an either/or thing; the two models
don't mix, and drivers that try mixing them won't even be registered.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:30 +02:00
Jean Delvare
5cedb05db3 i2c-pca-isa: Port to the new device driver model
Port the i2c-pca-isa driver to the new device driver model. I'm
using Rene Herman's new isa bus type, as it fits the needs nicely. One
benefit is that we can now give a proper parent to our i2c adapter.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:30 +02:00
Jean Delvare
4a5d30302e i2c-elektor: Port to the new device driver model
Port the i2c-elektor driver to the new device driver model. I'm
using Rene Herman's new isa bus type, as it fits the needs nicely. One
benefit is that we can now give a proper parent to our i2c adapter.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:30 +02:00
Jean Delvare
c6e8bb2ca5 i2c-parport-light: Port to the new device driver model
Also fix a small race on driver unload: we need to unregister the
i2c adapter before we power it off.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:30 +02:00
Jean Delvare
3af07bd297 i2c-parport: Fix a minor race on driver unload
When unloading the driver, we really want to unregister the i2c adapter
before we power it off, rather than the other way around.

Also speed up the bus a bit when we can sense SCL. The slaves will
stretch the line as needed.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:30 +02:00
Jean Delvare
4b4686e7a6 scx200_acb: Fix PCI device reference count
The scx200_acb driver supports two kind of devices, PCI ones and ISA
ones. Even ISA ones are detected using the presence of a given PCI
device, and we get a reference to it, but never put it back, so we
have a leak. Fix it.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:30 +02:00
Jean Delvare
f75803de6a i2c-nforce2: Add support for the MCP61 and MCP65
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Hans-Frieder Vogt <hfvogt@gmx.net>
2007-05-01 23:26:29 +02:00
Jean Delvare
cacf2269b6 i2c-parport: Optimize binary size
Initialize the fields of the i2c_adapter structure individually,
rather than copying a whole static template structure. This shaves
off 474 bytes or 14% (on i386) from the binary size.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:29 +02:00
Jean Delvare
3c4bb241d3 i2c-algo-bit: Emulate SMBus block read
Now that i2c-core lets the i2c bus drivers emulate the SMBus block read
and SMBus block process call transaction types, let's implement that in
the popular i2c bit-banging driver. This will also act as a reference
implementation for other bus drivers which want to do the same.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:29 +02:00
Jean Delvare
209d27c3b1 i2c: Emulate SMBus block read over I2C
Let the I2C bus drivers emulate the SMBus Block Read and Block Process
Call transactions if they wish. This requires to define a new message
flag, which i2c-core will use to let the underlying I2C bus driver
know that the first received byte will specify the length of the read
message.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:29 +02:00
Jean Delvare
1ecac07aba i2c-algo-bit: Always send a stop condition before leaving
The i2c-algo-bit driver doesn't behave well on read errors: it'll
bail out without even sending a stop condition on the bus, so the bus
will be stuck. So make sure that we always send a stop condition on
the bus before we leave. The best way to make sure is to always send
it at the end of function bit_xfer.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:28 +02:00
David Brownell
ef2c8321f5 i2c: Rename dev_to_i2c_adapter()
Rename dev_to_i2c_adapter() as to_i2c_adapter(), since the previous
syntax was a surprising and needless difference from normal naming
conventions in Linux.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:28 +02:00
David Brownell
16ffadfc68 i2c: Class attribute cleanup
This patch is a minor cleanup/code shrink, using class infrastructure
in i2c-core to manage the i2c_adapter attribute.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:28 +02:00
David Brownell
2096b956d2 i2c: Shrink struct i2c_client
This shrinks the size of "struct i2c_client" by 40 bytes:

 - Substantially shrinks the string used to identify the chip type
 - The "flags" don't need to be so big
 - Removes some internal padding

It also adds kerneldoc for that struct, explaining how "name" is really a
chip type identifier; it's otherwise potentially confusing.

Because the I2C_NAME_SIZE symbol was abused for both i2c_client.name
and for i2c_adapter.name, this needed to affect i2c_adapter too.  The
adapters which used that symbol now use the more-obviously-correct
idiom of taking the size of that field.

JD: Shorten i2c_adapter.name from 50 to 48 bytes while we're here, to
avoid wasting space in padding.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:28 +02:00
David Brownell
4ad4eac606 i2c: i2c_register_driver() cleanup
Minor cleanup in i2c_register_driver():  use list_for_each_entry().

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:28 +02:00
Jean Delvare
b31366f439 i2c: i2c_adapter devices need no driver
Kill i2c_adapter_driver as it doesn't make sense and it prevents
further i2c-core cleanups. i2c_adapter devices are virtual devices
(ex-class devices) and as such they don't need a driver.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:28 +02:00
Jean Delvare
fccb56e4d8 i2c: Kill i2c_adapter.class_dev
Kill i2c_adapter.class_dev. Instead, set the class of i2c_adapter.dev
to i2c_adapter_class, so that a symlink will be created for every
i2c_adapter in /sys/class/i2c-adapter.

The same change must be mirrored to i2c-isa as it duplicates some
of the i2c-core functionalities.

User-space tools and libraries might need some adjustments. In
particular, libsensors from lm_sensors 2.10.3 or later is required for
proper discovery of i2c adapter names after this change.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:27 +02:00
Eric Miao
7053acbd78 [ARM] 4304/1: removes the unnecessary bit number from CKENnn_XXXX
This patch removes the unnecessary bit number from CKENnn_XXXX
definitions for PXA, so that

	CKEN0_PWM0 --> CKEN_PWM0
	CKEN1_PWM1 --> CKEN_PWM1
	...
	CKEN24_CAMERA --> CKEN_CAMERA

The reasons for the change of these defitions are:

1. they do not scale - they are currently valid for pxa2xx, but
definitely not valid for pxa3xx, e.g., pxa3xx has bit 3 for camera
instead of bit 24

2. they are unnecessary - the peripheral name within the definition
has already announced its usage, we don't need those bit numbers
to know which peripheral we are going to enable/disable clock for

3. they are inconvenient - think about this: a driver programmer
for pxa has to remember which bit in the CKEN register to turn
on/off

Another change in the patch is to make the definitions equal to its
clock bit index, so that

   #define CKEN_CAMERA  (24)

instead of

   #define CKEN_CAMERA  (1 << 24)

this change, however, will add a run-time bit shift operation in
pxa_set_cken(), but the benefit of this change is that it scales
when bit index exceeds 32, e.g., pxa3xx has two registers CKENA
and CKENB, totally 64 bit for this, suppose CAMERA clock enabling
bit is CKENB:10, one can simply define CKEN_CAMERA to be (32 + 10)
and so that pxa_set_cken() need minimum change to adapt to that.

Signed-off-by: eric miao <eric.y.miao@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2007-04-21 23:14:01 +01:00
Matej Kenda
a79220b763 [ARM] 4246/1: i2c-pxa: add adapter class to platform specific data
Reposted patch for kernel 2.6.21-rc2.

The driver i2c-pxa doesn't set the class member in i2c_adapter, which
is used to register the I2C adapter. The hwmon (sensors) drivers (e.g.
adm1021) that are connected to a i2c-pxa adapter don't attach because
they expect that the adapter supports class I2C_CLASS_HWMON.

This patch adds functionality to allow platforms to set the class and
pass it as platform_data to the i2c-pxa driver. Sample usage in
platform code:

static struct i2c_pxa_platform_data my_i2c_platform_data = {
	.class = I2C_CLASS_HWMON
};

static void __init my_platform_init(void)
{
	(void) platform_add_devices(devices, ARRAY_SIZE(devices));

	pxa_set_i2c_info(&my_i2c_platform_data);
}

Signed-off-by: Matej Kenda <matej.kenda@hermes-softlab.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2007-04-21 20:36:55 +01:00
Olof Johansson
080dfbe176 Minor bug fixes to i2c-pasemi
* Last write during i2c_xfer is of the wrong byte (off-by-1).
* Read length is wrong for some of the reads (mistakenly used the PEC
  version)

Signed-off-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-04-17 16:36:28 -07:00
Jean Delvare
56a3b5ebee i2c-pasemi: Depend on PPC_PASEMI again
Looks like a local change I made to be able to test-compile the i2c-pasemi
driver leaked upstream.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-04-17 16:36:28 -07:00
Cyrill V. Gorcunov
0ca9493b4c i2c/ds1374: Check workqueue creation status
Check if workqueue creation failed.  Further usage of NULL pointed
workqueue is not good I guess ;)

Signed-off-by: Cyrill V. Gorcunov <gorcunov@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-03-22 19:49:01 +01:00
Jean Delvare
a5aaea3785 i2c-i801: Restore the device state before leaving
Restore the original host configuration on driver unload and on
suspend. In particular this returns the SMBus master in I2C mode if it
was originally in I2C mode, which should help with suspend/resume if
the BIOS expects to find the SMBus master in I2C mode.

This fixes bug #6449 (for real this time.)
http://bugzilla.kernel.org/show_bug.cgi?id=6449

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Tested-by: Tommi Kyntola <tommi.kyntola@ray.fi>
2007-03-22 19:49:01 +01:00
Jean Delvare
58791fd81d i2c-amd8111: Missed cleanup
I missed one cleanup in my previous patch.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-03-22 19:49:00 +01:00
Russell King
8d91cbad8e [ARM] Acorn: move the i2c bus driver into drivers/i2c
Move the Acorn IOC/IOMD I2C bus driver from drivers/i2c, strip
out the reminants of the platform specific parts of the old
PCF8583 RTC code, and remove the old obsolete PCF8583 driver.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2007-03-04 20:40:50 +00:00
Linus Torvalds
874ff01bd9 Merge git://git.kernel.org/pub/scm/linux/kernel/git/bunk/trivial
* git://git.kernel.org/pub/scm/linux/kernel/git/bunk/trivial: (25 commits)
  Documentation/kernel-docs.txt update.
  arch/cris: typo in KERN_INFO
  Storage class should be before const qualifier
  kernel/printk.c: comment fix
  update I/O sched Kconfig help texts - CFQ is now default, not AS.
  Remove duplicate listing of Cris arch from README
  kbuild: more doc. cleanups
  doc: make doc. for maxcpus= more visible
  drivers/net/eexpress.c: remove duplicate comment
  add a help text for BLK_DEV_GENERIC
  correct a dead URL in the IP_MULTICAST help text
  fix the BAYCOM_SER_HDX help text
  fix SCSI_SCAN_ASYNC help text
  trivial documentation patch for platform.txt
  Fix typos concerning hierarchy
  Fix comment typo "spin_lock_irqrestore".
  Fix misspellings of "agressive".
  drivers/scsi/a100u2w.c: trivial typo patch
  Correct trivial typo in log2.h.
  Remove useless FIND_FIRST_BIT() macro from cardbus.c.
  ...
2007-02-19 13:29:02 -08:00
Linus Torvalds
59b8175c77 Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm: (117 commits)
  [ARM] 4058/2: iop32x: set ->broken_parity_status on n2100 onboard r8169 ports
  [ARM] 4140/1: AACI stability add ac97 timeout and retries
  [ARM] 4139/1: AACI record support
  [ARM] 4138/1: AACI: multiple channel support for IRQ handling
  [ARM] 4211/1: Provide a defconfig for ns9xxx
  [ARM] 4210/1: base for new machine type "NetSilicon NS9360"
  [ARM] 4222/1: S3C2443: Remove reference to missing S3C2443_PM
  [ARM] 4221/1: S3C2443: DMA support
  [ARM] 4220/1: S3C24XX: DMA system initialised from sysdev
  [ARM] 4219/1: S3C2443: DMA source definitions
  [ARM] 4218/1: S3C2412: fix CONFIG_CPU_S3C2412_ONLY wrt to S3C2443
  [ARM] 4217/1: S3C24XX: remove the dma channel show at startup
  [ARM] 4090/2: avoid clash between PXA and SA1111 defines
  [ARM] 4216/1: add .gitignore entries for ARM specific files
  [ARM] 4214/2: S3C2410: Add Armzone QT2410
  [ARM] 4215/1: s3c2410 usb device:  per-platform vbus_draw
  [ARM] 4213/1: S3C2410 - Update definition of ADCTSC_XY_PST
  [ARM] 4098/1: ARM: rtc_lock only used with rtc_cmos
  [ARM] 4137/1: Add kexec support
  [ARM] 4201/1: SMP barriers pair needed for the secondary boot process
  ...

Fix up conflict due to typedef removal in sound/arm/aaci.h
2007-02-19 13:18:39 -08:00
Russell King
3b0eb4a195 Merge the easy part of the IOP branch 2007-02-18 11:31:14 +00:00
Robert P. J. Day
405ae7d381 Replace remaining references to "driverfs" with "sysfs".
Globally, s/driverfs/sysfs/g.

Signed-off-by: Robert P. J. Day <rpjday@mindspring.com>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
2007-02-17 19:13:42 +01:00
Tim Schmielau
cd354f1ae7 [PATCH] remove many unneeded #includes of sched.h
After Al Viro (finally) succeeded in removing the sched.h #include in module.h
recently, it makes sense again to remove other superfluous sched.h includes.
There are quite a lot of files which include it but don't actually need
anything defined in there.  Presumably these includes were once needed for
macros that used to live in sched.h, but moved to other header files in the
course of cleaning it up.

To ease the pain, this time I did not fiddle with any header files and only
removed #includes from .c-files, which tend to cause less trouble.

Compile tested against 2.6.20-rc2 and 2.6.20-rc2-mm2 (with offsets) on alpha,
arm, i386, ia64, mips, powerpc, and x86_64 with allnoconfig, defconfig,
allmodconfig, and allyesconfig as well as a few randconfigs on x86_64 and all
configs in arch/arm/configs on arm.  I also checked that no new warnings were
introduced by the patch (actually, some warnings are removed that were emitted
by unnecessarily included header files).

Signed-off-by: Tim Schmielau <tim@physik3.uni-rostock.de>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-02-14 08:09:54 -08:00
Dan Williams
588ef76935 [ARM] 4184/1: iop: cp6 access handler (undef_hook)
Enable svc access to cp6 via an undefined instruction hook.  Do not enable
access for usr code.

This patch also makes iop13xx select PLAT_IOP, this requires a small change
to drivers/i2c/busses/i2c-iop3xx.c.

Per Lennert Buytenhek's note, the cp6 trap routine is moved to arch/arm/plat-iop
Per Nicolas Pitre's note, the cp_wait is skipped since the latency to
return to the faulting function is longer than cp_wait.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2007-02-14 15:21:24 +00:00
Jean Delvare
fe2c8d51af i2c: Remove the warning on missing adapter device
Now that the i2c_adapter migration plan changed and we are going to
keep i2c_adapter.dev, it's no longer that urgent to add a proper device
to all i2c_adapter drivers. Thus is seems resonable to degrade the
warning asking authors to migrate their driver to a debug message.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-02-13 22:09:04 +01:00
Jean Delvare
12a917f69d i2c: Declare more i2c_adapter parent devices
Declare the parent device of i2c_adapter devices each time we can
easily do so. It makes the i2c_adapter appear at the right place in
the device tree, rather than as a platform device.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Len Brown <len.brown@intel.com>
Cc: Jordan Crouse <jordan.crouse@amd.com>
Cc: Jody McIntyre <scjody@modernduck.com>
Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: v4l-dvb-maintainer@linuxtv.org
Cc: Petr Vandrovec <vandrove@vc.cvut.cz>
2007-02-13 22:09:03 +01:00
Olof Johansson
beb58aa39e i2c: PA Semi SMBus driver
New driver for the PA Semi SMBus interfaces.

Signed-off-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-02-13 22:09:03 +01:00
Jean Delvare
88b9e750e9 i2c-amd8111: Proposed cleanups
Proposed cleanups to the i2c-amd8111 SMBus driver:
* Fold long lines.
* Add an explicit mask when writing the low byte of a word.
* Use I2C_SMBUS_BLOCK_MAX instead of hardcoding 32.
* Discard extra blank lines.
* Use boolean not instead of bitwise not for bit tests, it's clearer.
* Return -EBUSY rather than -1 on I/O resource conflict.
* Fix a race on device registration, initialization should be done
  before the bus is registered.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-02-13 22:09:02 +01:00
Jonathan McDowell
55249cf750 i2c-parport: Add support for One For All remote JP1 interface
This simple patch adds support to i2c-parport for the One For All remote
JP1 parallel port interfaces which can be found detailed at:

http://www.hifi-remote.com/jp1/hardware.shtml

These allow access to the internal configuration EEPROM on various
remote controls and there are a variety of Windows tools that make use
of this hardware. I have tested this patch with the "simple" parallel
port device and a One For All URC-7562 and confirmed that the data read
using the eeprom i2c driver matches that returned by the Windows "IR"
JP1 tool.

Signed-off-by: Jonathan McDowell <noodles@earth.li>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-02-13 22:09:02 +01:00
Jean Delvare
ab6a6ed271 i2c-viapro: Add support for the VIA CX700 south bridge
We do not have any documentation for the CX700, but it was reported
to work fine. Thanks to Claas Langbehn for testing.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-02-13 22:09:02 +01:00
Stephen Hemminger
9ace555d7d i2c: Add IDs to adapters
IDs have been defined but not used by most of the I2C adapters.
By having a unique ID, clients can check for correct connection
during probe.

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-02-13 22:09:01 +01:00
David Brownell
f37dd80ac2 i2c: Add driver suspend/resume/shutdown support
Driver model updates for the I2C core:

 - Add new suspend(), resume(), and shutdown() methods.  Use them in the
   standard driver model style; document them.

 - Minor doc updates to highlight zero-initialized fields in drivers, and
   the driver model accessors for "clientdata".

If any i2c drivers were previously using the old suspend/resume calls
in "struct driver", they were getting warning messages ... and will
now no longer work.  Other than that, this patch changes no behaviors;
and it lets I2C drivers use conventional PM and shutdown support.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-02-13 22:09:00 +01:00
Jean Delvare
b8d6f45b32 i2c: completion header cleanups
i2c-core and i2c-isa use completions without including
<linux/completion.h>. Fix it.

i2c-powermac includes <linux/completion.h> but doesn't use any
completion. Fix it.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: David Brownell <david-b@pacbell.net>
2007-02-13 22:09:00 +01:00
Jean Delvare
fcdd96ecaf i2c-i801: Spelling fix
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-02-13 22:08:59 +01:00
Jean Delvare
4e6697fcc1 i2c-piix4: Add support for the ATI SB600
Add support for the ATI SB600 SMBus controller.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-02-13 22:08:59 +01:00
Jean Delvare
4ef0ce90df i2c-nforce2: Drop unused reference to pci_dev
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Hans-Frieder Vogt <hfvogt@gmx.net>
2007-02-13 22:08:58 +01:00
Jean Delvare
849be516c5 i2c-ali1563: Fix device initialization
The i2c-ali1563 initialization looks quite broken to me:
* If the I/O space isn't enabled, we forcibly set 3 bits in
  the PCI configuration space instead of just the one enabling
  the I/O space.
* After that we pretend to check if the write worked, but we
  don't actually read the new value from the register.
* It's probably not a good idea to enable the I/O space if no
  base address has been set.

So I propose the following changes to that part of the driver:
* Merge ali1563_enable() into ali1563_setup().
* Check the base address before the I/O space enabled bit.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Rudolf Marek <r.marek@assembler.cz>
2007-02-13 22:08:57 +01:00
Jean Delvare
6973569831 i2c-ali1563: Improve the status messages
Improve the status messages printed by the i2c-ali1563 driver.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Rudolf Marek <r.marek@assembler.cz>
2007-02-13 22:08:57 +01:00
Arjan van de Ven
2b8693c061 [PATCH] mark struct file_operations const 3
Many struct file_operations in the kernel can be "const".  Marking them const
moves these to the .rodata section, which avoids false sharing with potential
dirty data.  In addition it'll catch accidental writes at compile time to
these shared resources.

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-02-12 09:48:45 -08:00
Guennadi Liakhovetski
a7b4e5506d [ARM] 4144/1: Fix for patch #4099/1 with CONFIG_I2C_PXA_SLAVE set
Switch the i2c-pxa driver to actually using the platform device information and let it handle the power i2c bus on pxa27x too. Original version of this patch didn't compile with CONFIG_I2C_PXA_SLAVE set.

Signed-off-by: G. Liakhovetski <gl@dsa-ac.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2007-02-08 14:46:36 +00:00
David Brownell
5f84813774 USB: <linux/usb_ch9.h> becomes <linux/usb/ch9.h>
This moves <linux/usb_ch9.h> to <linux/usb/ch9.h> to reduce some of the
clutter of usb header files.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-02-07 15:44:32 -08:00
Philippe De Muyter
81ffbc04a8 i2c/m41t00: Do not forget to write year
m41t00.c forgets to set the year field in set_rtc_time; fix that.

Signed-off-by: Philippe De Muyter <phdm@macqel.be>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Acked-by: Mark A. Greer <mgreer@mvista.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-01-05 17:54:05 +01:00
Maxime Bizon
3269bb63eb i2c-mv64xxx: Fix random oops at boot
I have a Marvell board which has the same i2c hw block than mv64xxx, so
I'm trying to use i2c-mv64xxx driver.

But I get the following random oops at boot:

Unable to handle kernel NULL pointer dereference at virtual address 00000002
Backtrace: 
[<c0397e4c>] (mv64xxx_i2c_intr+0x0/0x2b8) from [<c02879c4>] (__do_irq+0x4c/0x8c)
[<c0287978>] (__do_irq+0x0/0x8c) from [<c0287c0c>] (do_level_IRQ+0x68/0xc0)
 r8 = C0501E08  r7 = 00000005  r6 = C0501E08  r5 = 00000005
 r4 = C048BB78 
[<c0287ba4>] (do_level_IRQ+0x0/0xc0) from [<c02885f8>] (asm_do_IRQ+0x50/0x134)
 r6 = C0449C78  r5 = F1020000  r4 = FFFFFFFF 
[<c02885a8>] (asm_do_IRQ+0x0/0x134) from [<c02869c4>] (__irq_svc+0x24/0x100)
 r8 = C1CAC400  r7 = 00000005  r6 = 00000002  r5 = F1020000
 r4 = FFFFFFFF 
[<c0287efc>] (setup_irq+0x0/0x124) from [<c02880d0>] (request_irq+0xb0/0xd0)
 r7 = C041B2AC  r6 = C0397E4C  r5 = 00000000  r4 = 00000005
[<c0288020>] (request_irq+0x0/0xd0) from [<c03985f4>] (mv64xxx_i2c_probe+0x148/0x244)
[<c03984ac>] (mv64xxx_i2c_probe+0x0/0x244) from [<c038bedc>] (platform_drv_probe+0x20/0x24)


The oops is caused by a spurious interrupt that occurs when request_irq
is called. mv64xxx_i2c_fsm() tries to read drv_data->msg, which is NULL.

I noticed that hardware init is done after requesting irq. Thus any
pending irq from previous hardware usage may cause this.

The following patch fixes it:


Signed-off-by: Maxime Bizon <mbizon@freebox.fr>
Acked-by: Mark A. Greer <mgreer@mvista.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-01-05 17:54:05 +01:00
David Brownell
b119dc3f99 i2c: Migration aids for i2c_adapter.dev removal
Flag i2c_adapter.dev for removal after userspace tools get upgraded, and
include a near-term code migration aid to facilitate this:

 - The class device gets the name attribute it should have had.  This
   was previously (wrongly) associated with the i2c_adapter.dev node.
   Sysfs based tools and libraries can start converting right away.

 - Issue a warning for legacy adapter drivers that don't provide any
   physical device node; so systems with those drivers will know to
   fix this problem earlier.

This is one of a series of patches to help the I2C stack become a better
citizen of the Linux Driver Model world.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-01-04 13:07:04 +01:00
Vitaly Wool
6c566fb7b3 i2c-pnx: Fix interrupt handler, get rid of EARLY config option
This fixes two issues raised by David Brownell on the i2c list:

<< Someone needs to update i2c-pnx.c to handle the IRQ handler doesn't
expect pt_regs (gone now for a while), and so it doesn't try to
reference "mudule_init()" if I2C isn't initialized "early".  For
that matter, to get rid of that _option_ to initialize then, and
always init that driver with subsystem_init() ... it's common with
embedded systems to need I2C access to tweak a GPIO expander or
do some other work when bringing up drivers, that's not specific
to USB stacks. >>

Signed-off-by: Vitaly Wool <vitalywool@gmail.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-01-04 13:07:03 +01:00
Linus Torvalds
bbc7610c06 Merge branch 'hwmon-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6
* 'hwmon-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6:
  hwmon: Add MAINTAINERS entry for new ams driver
  hwmon: New AMS hardware monitoring driver
  hwmon/w83793: Add documentation and maintainer
  hwmon: New Winbond W83793 hardware monitoring driver
  hwmon: Update Rudolf Marek's e-mail address
  hwmon/f71805f: Fix the device address decoding
  hwmon/f71805f: Always create all fan inputs
  hwmon/f71805f: Add support for the Fintek F71872F/FG chip
  hwmon: New PC87427 hardware monitoring driver
  hwmon/it87: Remove the SMBus interface support
  hwmon/hdaps: Update the list of supported devices
  hwmon/hdaps: Move the DMI detection data to .data
  hwmon/pc87360: Autodetect the VRM version
  hwmon/f71805f: Document the fan control features
  hwmon/f71805f: Add support for "speed mode" fan speed control
  hwmon/f71805f: Support DC fan speed control mode
  hwmon/f71805f: Let the user adjust the PWM base frequency
  hwmon/f71805f: Add manual fan speed control
  hwmon/f71805f: Store the fan control registers
2006-12-13 09:13:19 -08:00
David Brownell
8c1bc04e79 [PATCH] fix more workqueue build breakage (tps65010)
More fixes to build breakage from the work_struct changes ...  this updates
the tps65010 driver.  Plus, fix some dependencies related to the way it's
used on the OMAP OSK: force static linking there, since the resulting
kernel can't link.

NOTE that until the i2c core gets fixed to work without SMBUS_QUICK,
kernels needing this driver must still use "tps65010.force=0,0x48" on the
command line.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Jean Delvare <khali@linux-fr.org>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-12-13 09:05:46 -08:00
Jean Delvare
7188cc66b4 hwmon: Update Rudolf Marek's e-mail address
The Silicon Hill club is not what it used to be.

Signed-off-by: Rudolf Marek <r.marek@assembler.cz>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2006-12-12 18:18:30 +01:00
Jean Delvare
d7aef138f3 i2c: Fix OMAP clock prescaler to match the comment
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
2006-12-10 21:21:34 +01:00
Jean Delvare
07125ab2c2 i2c: Refactor a kfree in i2c-dev
Refactor kfree(i2c_dev) into return_i2c_dev(). This saves some
code and makes more sense, as the memory is allocated in
get_free_i2c_dev().

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
2006-12-10 21:21:33 +01:00
Akinobu Mita
3bacb36db0 i2c: Fix return value check in i2c-dev
device_create() returns error code as pointer on failures.
This patch checks the return value of device_create() by using IS_ERR().

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2006-12-10 21:21:33 +01:00
Jean Delvare
250d1bd3f4 i2c: Enable PEC on more i2c-i801 devices
Enable PEC on recent Intel SMBus controllers (ICH6, ICH7, ICH8, ICH9
and ESB2.)

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Jason Gaston <jason.d.gaston@intel.com>
2006-12-10 21:21:33 +01:00
Jean Delvare
3269711b76 i2c: Discard the i2c algo del_bus wrappers
They are all only calling i2c_del_adapter, so we may as well do
it directly.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2006-12-10 21:21:33 +01:00
Russell King
6b65cd7428 i2c: New ARM Versatile/Realview bus driver
Add support for the I2C bus found on the ARM Versatile and Realview
platforms.  The I2C bus has a RTC and optionally some EEPROMs attached.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2006-12-10 21:21:32 +01:00
Dirk Eibach
763d9c046a i2c: fix broken ds1337 initialization
On a custom board with ds1337 RTC I found that upgrade from 2.6.15 to
2.6.18 broke RTC support.

The main problem are changes to ds1337_init_client().
When a ds1337 recognizes a problem (e.g. power or clock failure) bit 7
in status register is set. This has to be reset by writing 0 to status
register. But since there are only 16 byte written to the chip and the
first byte is interpreted as an address, the status register (which is
the 16th) is never written.
The other problem is, that initializing all registers to zero is not
valid for day, date and month register. Funny enough this is checked by
ds1337_detect(), which depends on this values not being zero. So then
treated by ds1337_init_client() the ds1337 is not detected anymore,
whereas the failure bit in the status register is still set.

Signed-off-by: Dirk Stieler <stieler@gdsys.de>
Signed-off-by: Dirk Eibach <eibach@gdsys.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2006-12-10 21:21:31 +01:00
Jean Delvare
7b77d065d1 i2c: Use the __ATTR macro where possible
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2006-12-10 21:21:31 +01:00
David Brownell
438d6c2c01 i2c: Whitespace cleanups
Remove extraneous whitespace from various i2c headers and core files,
like space-before-tab and whitespace at end of line.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2006-12-10 21:21:31 +01:00
Jean Delvare
2c003e8e1c i2c: Use put_user instead of copy_to_user where possible
This speeds up the I2C_FUNCS ioctl by 5 to 8% in my tests.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Laughed-at-by: Mark M. Hoffman <mhoffman@lightlink.com>
2006-12-10 21:21:30 +01:00