aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2009-11-30Merge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/stagingLinus Torvalds2-0/+14
* 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging: at24: Use timeout also for read i2c: Fix userspace_device list corruption MAINTAINERS: Add missing i2c files i2c/tsl2550: Fix lux value in extended mode
2009-11-26i2c: Fix userspace_device list corruptionJean Delvare1-0/+11
Fix userspace_device list corruption. The corruption was caused by clients not being removed when adapters with such clients were themselves removed. Something like the following would trigger it (assuming i2c-stub gets adapter number 3): # modprobe i2c-stub chip_addr=0x50 # echo 24c08 0x50 > /sys/bus/i2c/devices/i2c-3/new_device # rmmod i2c-stub # modprobe i2c-stub chip_addr=0x50 # echo 24c08 0x50 > /sys/bus/i2c/devices/i2c-3/new_device For the records, the stack trace in the kernel logs look like this: kernel: WARNING: at lib/list_debug.c:30 __list_add+0x8b/0x90() kernel: Hardware name: (...) kernel: list_add corruption. prev->next should be next (c137fc84), but was (null). (prev=f57111b8). kernel: Modules linked in: (...) kernel: Pid: 4669, comm: bash Not tainted 2.6.32-rc8 #259 kernel: Call Trace: kernel: [<c111eb8b>] ? __list_add+0x8b/0x90 kernel: [<c111eb8b>] ? __list_add+0x8b/0x90 kernel: [<c103265c>] warn_slowpath_common+0x6c/0xc0 kernel: [<c111eb8b>] ? __list_add+0x8b/0x90 kernel: [<c10326f6>] warn_slowpath_fmt+0x26/0x30 kernel: [<c111eb8b>] __list_add+0x8b/0x90 kernel: [<c11ba165>] i2c_sysfs_new_device+0x1c5/0x250 kernel: [<c10861be>] ? might_fault+0x2e/0x80 kernel: [<c11b9fa0>] ? i2c_sysfs_new_device+0x0/0x250 kernel: [<c118c625>] dev_attr_store+0x25/0x30 kernel: [<c10e305c>] sysfs_write_file+0x9c/0xf0 kernel: [<c109d35c>] vfs_write+0x9c/0x160 kernel: [<c10e2fc0>] ? sysfs_write_file+0x0/0xf0 kernel: [<c109d4dd>] sys_write+0x3d/0x70 kernel: [<c1002ed8>] sysenter_do_call+0x12/0x36 Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-11-26i2c/tsl2550: Fix lux value in extended modeMichele Jr De Candia1-0/+3
According to the TAOS Application Note 'Controlling a Backlight with the TSL2550 Ambient Light Sensor' (page 14), the actual lux value in extended mode should be obtained multiplying the calculated lux value by 5. Signed-off-by: Michele Jr De Candia <michele.decandia@valueteam.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-11-21ARM: PNX4008: i2c-pnx: use the same dev_id for request_irq and free_irqRussell King1-2/+2
This allows i2c-pnx to free its interrupt handler when the module is removed or if an error occurs; using the same dev_id for both request_irq and free_irq is desirable. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Acked-by: Ben Dooks <ben-linux@fluff.org>
2009-11-20i2c: i2c-pnx: Added missing mach/i2c.h and linux/io.h header file includesKevin Wells1-0/+2
Added missing mach/i2c.h and linux/io.h header file includes Signed-off-by: Kevin Wells <kevin.wells@nxp.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-11-20i2c: i2c-pnx: Limit minimum jiffie timeout to 2Kevin Wells1-0/+3
Limit minimum jiffie timeout to 2 to prevent early timeout on systems with low tick rates Signed-off-by: Kevin Wells <kevin.wells@nxp.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-11-07i2c-piix4: Modify code name SB900 to Hudson-2Crane Cai2-5/+5
Change SB900 to its formal code name Hudson-2. Signed-off-by: Crane Cai <crane.cai@amd.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-11-02i2c-mpc: Do not generate STOP after read.Joakim Tjernlund1-8/+2
The driver always ends a read with a STOP condition which breaks subsequent I2C reads/writes in the same transaction as these expect to do a repeated START(ReSTART). This will also help I2C multimaster as the bus will not be released after the first read, but when the whole transaction ends. Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-11-02i2c: imx: disable clock when it's possible to save power.Richard Zhao1-6/+6
Enable clock before START, disable it after STOP. Signed-off-by: Richard Zhao <linuxzsc@gmail.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-11-02i2c: imx: only imx1 needs disable delayRichard Zhao1-5/+7
check cpu_is_mx1() when disable delay. Signed-off-by: Richard Zhao <linuxzsc@gmail.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-11-02i2c: imx: check busy bit when START/STOPRichard Zhao1-18/+44
The controller can't do anything else before it actually generates START/STOP. So we check busy bit to make sure START/STOP is successfully finished. If we don't check busy bit, START/STOP may fail on some fast CPUs. Signed-off-by: Richard Zhao <linuxzsc@gmail.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-10-04i2c: Hide probe errors caused by ACPI resource conflictsJean Delvare7-8/+12
When an ACPI resource conflict is detected, error messages are already printed by ACPI. There's no point in causing the driver core to print more error messages, so return one of the error codes for which no message is printed. This fixes bug #14293: http://bugzilla.kernel.org/show_bug.cgi?id=14293 Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-09-26ACPI: i2c-scmi: don't use acpi_device_uid()Bjorn Helgaas1-3/+2
We recently removed the acpi_device_uid() interface because nobody used it. I don't think it's essential here either. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Len Brown <len.brown@intel.com>
2009-09-24Merge branch 'origin' into for-linusRussell King18-735/+661
Conflicts: MAINTAINERS
2009-09-23Merge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/stagingLinus Torvalds15-729/+621
* 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging: i2c: Clearly mark ACPI drivers as such i2c: Add driver for SMBus Control Method Interface i2c-pnx: Correct use of request_region/request_mem_region MAINTAINERS: Add maintainer for AT24 and PCA9564/PCA9665 i2c-piix4: Add AMD SB900 SMBus device ID i2c/chips: Remove deprecated pcf8574 driver i2c/chips: Remove deprecated pca9539 driver i2c/chips: Remove deprecated pcf8575 driver gpio/pcf857x: Copy i2c_device_id from old pcf8574 driver i2c/scx200_acb: Provide more information on bus errors i2c: Provide compatibility links for i2c adapters i2c: Convert i2c adapters to bus devices i2c: Convert i2c clients to a device type i2c/tsl2550: Use combined SMBus transactions i2c-taos-evm: Switch echo off to improve performance i2c: Drop unused i2c_driver.id field
2009-09-21Merge branch 'devel' of git://git.kernel.org/pub/scm/linux/kernel/git/ycmiao/pxa-linux-2.6 into develRussell King1-2/+2
2009-09-19[PATCH] i2c-imx: make bus available earlyWolfram Sang1-2/+1
As I2C is used by PMICs also, make the busses available early via subsys_initcall(). Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-09-19i2c-mv64xxx: correct mv64xxx_i2c_intr() return typeMikael Pettersson1-2/+2
The mv64xxx_i2c_intr() irq handler in drivers/i2c/busses/i2c-mv64xxx.c is declared as returning 'int', resulting in this compile-time warning: drivers/i2c/busses/i2c-mv64xxx.c: In function 'mv64xxx_i2c_probe': drivers/i2c/busses/i2c-mv64xxx.c:540: warning: passing argument 2 of 'request_irq' from incompatible pointer type Fix: correct the return type to 'irqreturn_t'. Signed-off-by: Mikael Pettersson <mikpe@it.uu.se> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-09-18i2c: Clearly mark ACPI drivers as suchJean Delvare2-12/+17
Now that we have ACPI-based SMBus controller drivers, and we will start telling users to use them instead of native drivers when I/O resources conflict, I think it would be good to clearly mark ACPI drivers as such in Kconfig. This is exactly the same as we just did for hwmon drivers. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Crane Cai <crane.cai@amd.com>
2009-09-18i2c: Add driver for SMBus Control Method InterfaceCrane Cai3-0/+444
This driver supports the SMBus Control Method Interface. It needs BIOS declare ACPI control methods which described in SMBus Control Method Interface Spec. http://smbus.org/specs/smbus_cmi10.pdf Signed-off-by: Crane Cai <crane.cai@amd.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-09-18i2c-pnx: Correct use of request_region/request_mem_regionJulia Lawall1-3/+4
request_mem_region should be used when ioremap is used subsequently. release_region is then correspondingly replaced by release_mem_region. The semantic patch that fixes this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @r@ expression start,E; @@ - request_region + request_mem_region (start,...) ... when != request_mem_region(start,...) when != start = E ioremap(start,...) @@ expression r.start; @@ - release_region + release_mem_region (start,...) // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Cc: Vitaly Wool <vitalywool@gmail.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-09-18i2c-piix4: Add AMD SB900 SMBus device IDCrane Cai2-4/+8
Add new SMBus device ID for AMD SB900. Signed-off-by: Crane Cai <crane.cai@amd.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-09-18i2c/chips: Remove deprecated pcf8574 driverWolfram Sang3-233/+0
The pcf8574 driver in drivers/i2c/chips which just exports its register to sysfs is superseded by drivers/gpio/pcf857x.c which properly uses the gpiolib. As this driver has been deprecated for more than a year, finally remove it. Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Cc: Aurelien Jarno <aurelien@aurel32.net> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-09-18i2c/chips: Remove deprecated pca9539 driverWolfram Sang3-166/+0
The pca9539 driver in drivers/i2c/chips which just exports its registers to sysfs is superseded by drivers/gpio/pca953x.c which properly uses the gpiolib. As this driver has been deprecated for more than a year, finally remove it. Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Acked-by: Ben Gardner <gardner.ben@gmail.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-09-18i2c/chips: Remove deprecated pcf8575 driverWolfram Sang3-217/+0
The pcf8575 driver in drivers/i2c/chips which just exports its register to sysfs is superseded by drivers/gpio/pcf857x.c which properly uses the gpiolib. As this driver has been deprecated for more than a year, finally remove it. Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Cc: Bart Van Assche <bart.vanassche@gmail.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-09-18i2c/scx200_acb: Provide more information on bus errorsWilly Tarreau1-2/+4
Upon a bus error, it's rather hard to guess what happened. Dumping the address, length and status provides a lot of value for troubleshooting issues. Signed-off-by: Willy Tarreau <wtarreau@exceliance.fr> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-09-18i2c: Provide compatibility links for i2c adaptersJean Delvare2-1/+40
Some user-space applications may be relying on i2c adapters showing up as class devices in sysfs. Provide compatibility links for them for the time being. We will remove them after a long transition period. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Kay Sievers <kay.sievers@vrfy.org>
2009-09-18i2c: Convert i2c adapters to bus devicesJean Delvare1-35/+40
Kay says i2c adapters shouldn't be class devices but bus devices. Convert them that way, using a device type. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Kay Sievers <kay.sievers@vrfy.org>
2009-09-18i2c: Convert i2c clients to a device typeJean Delvare1-20/+47
This is required for upcoming changes. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Kay Sievers <kay.sievers@vrfy.org>
2009-09-18i2c/tsl2550: Use combined SMBus transactionsJean Delvare1-32/+10
Make the I/O faster, mainly by using combined SMBus transactions when possible. While the TSL2550 datasheet doesn't say the device supports them, they seem to work just fine in practice, and a combined transaction is faster than two simple transactions in many cases and always more reliable. A side effect is to suppress the delays between SMBus writes and reads. The datasheet doesn't say they are needed and things work just fine for me without them. I also couldn't see any reason for the delay between reading the two channels. Nor for the loop to get a reading in the first place. The 400 ms delay between samples only matters at chip power-up, after that the chip always hold the previously sampled value so we never get to wait. All these changes make reading the lux value much faster and cheaper. Signed-off-by: Jean Delvare <khali@linux-fr.org> Tested-by: Michele De Candia <michele.decandia@valueteam.com> Cc: Rodolfo Giometti <giometti@linux.it>
2009-09-18i2c-taos-evm: Switch echo off to improve performanceJean Delvare1-21/+24
When echo is on, we waste time reading back our orders. Switching echo off makes performance much better: SMBus byte data transactions are 47% faster and byte transactions are 24% faster. Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-09-10[ARM] pxa: update dependancy of pxa i2c moduleHaojian Zhuang1-2/+2
PXA I2C module is also used in Marvell PXA168 and PXA910 series. Update the module dependancy of PXA I2C. Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com> Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
2009-08-23i2c: Runtime PM for SuperH Mobile I2CMagnus Damm1-2/+37
This patch modifies the SuperH Mobile I2C driver to support Runtime PM. These changes is all that is needed for proper Runtime PM support in this driver. Driver callbacks for Runtime PM are empty because the device registers are always re-initialized after pm_runtime_get_sync(). Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-08-23Merge branch 'master' into for-linusRafael J. Wysocki2-67/+104
2009-08-20i2c-stu300: I2C STU300 stability updatesLinus Walleij1-65/+92
- blk clk is enabled when an irq arrives. The clk should be enabled, but just to make sure. - All error bits are handled no matter state machine state - All irq's will run complete() except for irq's that wasn't an event. - No more looking into status registers just in case an interrupt has happend and the irq handle wasn't executed. - irq_disable/enable are now separete functions. - clk settings calculation changed to round upwards instead of downwards. - Number of address send attempts before giving up is increased to 12 from 10 since it most times take 8 tries before getting through. Signed-off-by: Linus Walleij <linus.walleij@stericsson.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-08-20i2c-omap: Enable workaround for Errata 1.153 based onMoiz Sonasath1-1/+1
Silicon Errata 1.153 has been fixed on OMAP 3630|4430 with the use of a later version of I2C IP block. The errata impacts OMAP 2420|2430|3430, enable the workaround for these based on I2C IP block revision number instead of OMAP CPU type Signed-off-by: Moiz Sonasath <m-sonasath@ti.com> Signed-off-by: Vikram Pandita <vikram.pandita@ti.com Reviewed-by: Paul Walmsley <paul@pwsan.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-08-20i2c-omap: ACK pending [R/X]DR and [R/X]RDY interruptsMoiz Sonasath1-0/+3
ACK any pending read/write interrupts before exiting the ISR either after completing the operation [ARDY interrupt] or in case of an error [NACK|AL interrupt] Signed-off-by: Moiz Sonasath <m-sonasath@ti.com> Signed-off-by: Vikram Pandita <vikram.pandita@ti.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-08-20i2c-omap: Fix I2C status ACKNishanth Menon1-1/+8
I2C status ack for [RX]RDR and [RX]RDY could cause race conditions of clearing the event twice and a violation of the programing sequence as defined in TRM This patch fixes the same. Signed-off-by: Nishanth Menon <nm@ti.com> Signed-off-by: Moiz Sonasath <m-sonasath@ti.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-07-30Merge branch 'master' into for-linusRafael J. Wysocki3-14/+35
2009-07-30i2c-omap: OMAP3430 Silicon Errata 1.153Sonasath, Moiz1-1/+23
When an XRDY/XDR is hit, wait for XUDF before writing data to DATA_REG. Otherwise some data bytes can be lost while transferring them from the memory to the I2C interface. Do a Busy-wait for XUDF, before writing data to DATA_REG. While waiting if there is NACK | AL, set the appropriate error flags, ack the pending interrupts and return from the ISR. Signed-off-by: Moiz Sonasath <m-sonasath@ti.com> Signed-off-by: Vikram pandita <vikram.pandita@ti.com> [ben-linux@fluff.org: fixed mail format and added i2c-omap to subject] Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-07-30i2c-omap: In case of a NACK|ARDY|AL return from the ISRSonasath, Moiz1-1/+3
In case of a NACK or ARDY or AL interrupt, complete the request. There is no need to service the RRDY/RDR or XRDY/XDR interrupts. Refer TRM SWPU114: Figure 18-31.I2C Master Transmitter Mode, Interrupt Method, in F/S and HS Modes http://focus.ti.com/pdfs/wtbu/SWPU114T_PrelimFinalEPDF_06_25_2009.pdf Signed-off-by: Moiz Sonasath <m-sonasath@ti.com> Signed-off-by: Vikram pandita <vikram.pandita@ti.com> [ben-linux@fluff.org: fixed mail format and added i2c-omap to subject] Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-07-30i2c-omap: Bug in reading the RXSTAT/TXSTAT values from the I2C_BUFFSTAT registerSonasath, Moiz1-5/+7
Fix bug in reading the I2C_BUFFSTAT register for getting byte count on RX/TX interrupt. On Interrupt: I2C_STAT[RDR], read 'RXSTAT' from I2C_BUFFSTAT[8-13] On Interrupt: I2C_STAT[XDR] read 'TXSTAT' from I2C_BUFFSTAT[0-5] Signed-off-by: Jagadeesh Pakaravoor <j-pakaravoor@ti.com> Signed-off-by: Moiz Sonasath <m-sonasath@ti.com> Signed-off-by: Vikram pandita <vikram.pandita@ti.com> [ben-linux@fluff.org: fixed mail format and added i2c-omap to subject] Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-07-30i2c-sh_mobile: change module_init() to subsys_initcall()Magnus Damm1-1/+1
Convert the i2c-sh_mobile i2c bus driver to use subsys_initcall() instead of module_init(). This change makes the driver register a bit earlier which together with earlier platform data moves the time for probe(). The earlier probe() makes it possible to use i2c_get_adapter() and i2c_transfer() from device_initcall(). The same strategy is used by other i2c bus drivers such as i2c-pxa.c and i2c-s3c2410.c. Signed-off-by: Magnus Damm <damm@igel.co.jp> [ben-linux@fluff.org: minor subject updaye] Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-07-30i2c: strncpy does not null terminate stringRoel Kluin1-1/+1
strlcpy() will always null terminate the string. Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-07-30i2c-s3c2410: s3c24xx_i2c_init: don't clobber IICLC valuePeter Korsgaard1-5/+0
s3c24xx_i2c_init() was overwriting the IICLC value set just above in s3c24xx_i2c_clockrate() with zero, effectively disabling the platform line control setting. Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-07-29Merge branch 'master' into for-linusRafael J. Wysocki1-7/+10
2009-07-28i2c/tsl2550: Fix lux value in dark environmentMichele Jr De Candia1-7/+10
I've tested TSL2550 driver and I've found a bug: when light is off, returned value from tsl2550_calculate_lux function is -1 when it should be 0 (sensor correctly read that light was off). I think the bug is that a zero c0 value (approximated value of ch0) is misinterpreted as an error. Signed-off-by: Michele Jr De Candia <michele.decandia@valueteam.com> Acked-by: Rodolfo Giometti <giometti@linux.it> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-07-22I2C: Rework i2c-s3c2410 suspend_late()/resume() V2Magnus Damm1-9/+16
This is V2 of the i2c-s3c2410 dev_pm_ops patch. The callbacks are converted for CONFIG_SUSPEND like this: suspend_late() -> suspend_noirq() resume() -> resume() Signed-off-by: Magnus Damm <damm@igel.co.jp> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
2009-07-22I2C: Rework i2c-pxa suspend_late()/resume_early()Magnus Damm1-8/+17
This patch reworks platform driver power management code for i2c-pxa from legacy late/early callbacks to dev_pm_ops. The callbacks are converted for CONFIG_SUSPEND like this: suspend_late() -> suspend_noirq() resume_early() -> resume_noirq() Signed-off-by: Magnus Damm <damm@igel.co.jp> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
2009-07-15i2c: Use resource_sizeJulia Lawall4-8/+8
Use the function resource_size, which reduces the chance of introducing off-by-one errors in calculating the resource size. The semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // <smpl> @@ struct resource *res; @@ - (res->end - res->start) + 1 + resource_size(res) // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Ben Dooks <ben-linux@fluff.org>