aboutsummaryrefslogtreecommitdiff
path: root/drivers/i2c
AgeCommit message (Collapse)Author
2007-05-01i2c-s3c2410: Fix bug in releasing driverBen Dooks
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-01i2c-s3c2410: Fix I2C SDA to SCL setup timeBen Dooks
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-01i2c: New i2c-tiny-usb bus driverTill Harbaum
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-01i2c: SPIN_LOCK_UNLOCKED cleanupMilind Arun Choudhary
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-01i2c: Obsolete i2c-ixp2000, i2c-ixp4xx and scx200_i2cJean Delvare
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-01i2c: New Simtec I2C bus driverBen Dooks
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-01i2c: Bitbanging I2C bus driver using the GPIO APIHaavard Skinnemoen
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-01Use menuconfig objects - I2CJan Engelhardt
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-01i2c: Restore i2c_smbus_read_block_dataJean Delvare
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-01i2c-pxa: Clean transaction stopJean Delvare
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-01i2c-algo-bit: Improve debuggingJean Delvare
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-01i2c-algo-bit: Implement a 50/50 SCL duty cycleJean Delvare
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-01i2c-omap: Switch to static adapter numberingDavid Brownell
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-01i2c: Blackfin Two Wire Interface driverBryan Wu
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-01i2c-algo-sgi: Comment and whitespace cleanupsLadislav Michl
Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01i2c: Make i2c_del_driver a void functionJean Delvare
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-01i2c: Move i2c-isa-only exported symbol declarationsJean Delvare
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-01i2c: Add i2c_new_probed_device()Jean Delvare
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-01i2c-algo-bit: Add i2c_bit_add_numbered_busJean Delvare
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-01i2c: i2c EXPORT_SYMBOL cleanupDavid Brownell
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-01i2c: Add i2c_add_numbered_adapter()David Brownell
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-01i2c: Add i2c_board_info and i2c_new_device()David Brownell
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-01i2c: i2c stack can remove()David Brownell
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-01i2c: i2c stack can probe()David Brownell
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-01i2c-pca-isa: Port to the new device driver modelJean Delvare
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-01i2c-elektor: Port to the new device driver modelJean Delvare
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-01i2c-parport-light: Port to the new device driver modelJean Delvare
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-01i2c-parport: Fix a minor race on driver unloadJean Delvare
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-01scx200_acb: Fix PCI device reference countJean Delvare
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-01i2c-nforce2: Add support for the MCP61 and MCP65Jean Delvare
Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Hans-Frieder Vogt <hfvogt@gmx.net>
2007-05-01i2c-parport: Optimize binary sizeJean Delvare
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-01i2c-algo-bit: Emulate SMBus block readJean Delvare
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-01i2c: Emulate SMBus block read over I2CJean Delvare
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-01i2c-algo-bit: Always send a stop condition before leavingJean Delvare
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-01i2c: Rename dev_to_i2c_adapter()David Brownell
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-01i2c: Class attribute cleanupDavid Brownell
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-01i2c: Shrink struct i2c_clientDavid Brownell
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-01i2c: i2c_register_driver() cleanupDavid Brownell
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-01i2c: i2c_adapter devices need no driverJean Delvare
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-01i2c: Kill i2c_adapter.class_devJean Delvare
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-04-17Minor bug fixes to i2c-pasemiOlof Johansson
* 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-17i2c-pasemi: Depend on PPC_PASEMI againJean Delvare
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-03-22i2c/ds1374: Check workqueue creation statusCyrill V. Gorcunov
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-22i2c-i801: Restore the device state before leavingJean Delvare
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-22i2c-amd8111: Missed cleanupJean Delvare
I missed one cleanup in my previous patch. Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-03-04[ARM] Acorn: move the i2c bus driver into drivers/i2cRussell King
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-02-19Merge git://git.kernel.org/pub/scm/linux/kernel/git/bunk/trivialLinus Torvalds
* 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-19Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-armLinus Torvalds
* '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-18Merge the easy part of the IOP branchRussell King
2007-02-17Replace remaining references to "driverfs" with "sysfs".Robert P. J. Day
Globally, s/driverfs/sysfs/g. Signed-off-by: Robert P. J. Day <rpjday@mindspring.com> Signed-off-by: Adrian Bunk <bunk@stusta.de>