aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/scx200_acb.c
Commit message (Collapse)AuthorAgeFilesLines
* i2c: Convert SCx200 driver from using raw PCI to platform deviceAndres Salomon2011-01-141-120/+80
| | | | | | | | | | | | | | | | | | The SCx200 ACB driver supports ISA hardware as well as PCI. The PCI hardware is CS5535/CS5536 based, and the device that it grabs is handled by the cs5535-mfd driver. This converts the SCx200 driver to use a platform_driver rather than the previous PCI hackery. The driver used to manually track the iface list (via linked list); now it only does this for ISA devices. PCI ifaces are handled through standard driver model lists. It's unclear what happens in case of errors in the old ISA code; rather than pretending the code actually cares, I've dropped the (implicit) ignorance of return values and marked it with a comment. Signed-off-by: Andres Salomon <dilinger@queued.net> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NULL-terminate all pci_device_id tablesDzianis Kahanovich2010-10-271-1/+2
| | | | | | | | NULL-terminating pci_device_id in pch_dma.c and scx200_acb.c for appying MODULE_DEVICE_TABLE (to publish modalias-es). Signed-off-by: Dzianis Kahanovich <mahatma@eu.by> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* i2c: Use <linux/io.h> instead of <asm/io.h>H Hartley Sweeten2010-05-211-1/+1
| | | | | | | | As warned by checkpatch.pl, <linux/io.h> should be used instead of <asm/io.h>. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c/scx200_acb: Make PCI device ids constantJean Delvare2010-05-211-1/+1
| | | | | | | | Make PCI device ids constant as we just did for many other i2c bus drivers already. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Márton Németh <nm127@freemail.hu>
* include cleanup: Update gfp.h and slab.h includes to prepare for breaking ↵Tejun Heo2010-03-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | implicit slab.h inclusion from percpu.h percpu.h is included by sched.h and module.h and thus ends up being included when building most .c files. percpu.h includes slab.h which in turn includes gfp.h making everything defined by the two files universally available and complicating inclusion dependencies. percpu.h -> slab.h dependency is about to be removed. Prepare for this change by updating users of gfp and slab facilities include those headers directly instead of assuming availability. As this conversion needs to touch large number of source files, the following script is used as the basis of conversion. http://userweb.kernel.org/~tj/misc/slabh-sweep.py The script does the followings. * Scan files for gfp and slab usages and update includes such that only the necessary includes are there. ie. if only gfp is used, gfp.h, if slab is used, slab.h. * When the script inserts a new include, it looks at the include blocks and try to put the new include such that its order conforms to its surrounding. It's put in the include block which contains core kernel includes, in the same order that the rest are ordered - alphabetical, Christmas tree, rev-Xmas-tree or at the end if there doesn't seem to be any matching order. * If the script can't find a place to put a new include (mostly because the file doesn't have fitting include block), it prints out an error message indicating which .h file needs to be added to the file. The conversion was done in the following steps. 1. The initial automatic conversion of all .c files updated slightly over 4000 files, deleting around 700 includes and adding ~480 gfp.h and ~3000 slab.h inclusions. The script emitted errors for ~400 files. 2. Each error was manually checked. Some didn't need the inclusion, some needed manual addition while adding it to implementation .h or embedding .c file was more appropriate for others. This step added inclusions to around 150 files. 3. The script was run again and the output was compared to the edits from #2 to make sure no file was left behind. 4. Several build tests were done and a couple of problems were fixed. e.g. lib/decompress_*.c used malloc/free() wrappers around slab APIs requiring slab.h to be added manually. 5. The script was run on all .h files but without automatically editing them as sprinkling gfp.h and slab.h inclusions around .h files could easily lead to inclusion dependency hell. Most gfp.h inclusion directives were ignored as stuff from gfp.h was usually wildly available and often used in preprocessor macros. Each slab.h inclusion directive was examined and added manually as necessary. 6. percpu.h was updated not to include slab.h. 7. Build test were done on the following configurations and failures were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my distributed build env didn't work with gcov compiles) and a few more options had to be turned off depending on archs to make things build (like ipr on powerpc/64 which failed due to missing writeq). * x86 and x86_64 UP and SMP allmodconfig and a custom test config. * powerpc and powerpc64 SMP allmodconfig * sparc and sparc64 SMP allmodconfig * ia64 SMP allmodconfig * s390 SMP allmodconfig * alpha SMP allmodconfig * um on x86_64 SMP allmodconfig 8. percpu.h modifications were reverted so that it could be applied as a separate patch and serve as bisection point. Given the fact that I had only a couple of failures from tests on step 6, I'm fairly confident about the coverage of this conversion patch. If there is a breakage, it's likely to be something in one of the arch headers which should be easily discoverable easily on most builds of the specific arch. Signed-off-by: Tejun Heo <tj@kernel.org> Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
* i2c/scx200_acb: Provide more information on bus errorsWilly Tarreau2009-09-181-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>
* i2c: Delete many unused adapter IDsJean Delvare2009-01-261-1/+0
| | | | Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c: Let bus drivers add SPD to their classJean Delvare2008-07-141-1/+1
| | | | | | | | | | | | | | | | | | Let general purpose I2C/SMBus bus drivers add SPD to their class. Once this is done, we will be able to tell the eeprom driver to only probe for SPD EEPROMs and similar on these buses. Note that I took a conservative approach here, adding I2C_CLASS_SPD to many drivers that have no idea whether they can host SPD EEPROMs or not. This is to make sure that the eeprom driver doesn't stop probing buses where SPD EEPROMs or equivalent live. So, bus driver maintainers and users should feel free to remove the SPD class from drivers those buses never have SPD EEPROMs or they don't want the eeprom driver to bind to them. Likewise, feel free to add the SPD class to any bus driver I might have missed. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c/scx200_acb: Don't use 0 as NULL pointerAdrian Bunk2008-04-221-1/+1
| | | | | | | | | Don't use 0 as NULL pointer. Spotted by sparse. Signed-off-by: Adrian Bunk <bunk@kernel.org> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* PCI: Remove users of pci_enable_device_bars()Benjamin Herrenschmidt2008-02-011-1/+1
| | | | | | | | | | | | | | | This patch converts users of pci_enable_device_bars() to the new pci_enable_device_{io,mem} interface. The new API fits nicely, except maybe for the QLA case where a bit of code re-organization might be a good idea but I prefer sticking to the simple patch as I don't have hardware to test on. I'll also need some feedback on the cs5520 change. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* i2c: Fix the i2c_smbus_read_i2c_block_data() prototypeJean Delvare2007-07-121-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Let the drivers specify how many bytes they want to read with i2c_smbus_read_i2c_block_data(). So far, the block count was hard-coded to I2C_SMBUS_BLOCK_MAX (32), which did not make much sense. Many driver authors complained about this before, and I believe it's about time to fix it. Right now, authors have to do technically stupid things, such as individual byte reads or full-fledged I2C messaging, to work around the problem. We do not want to encourage that. I even found that some bus drivers (e.g. i2c-amd8111) already implemented I2C block read the "right" way, that is, they didn't follow the old, broken standard. The fact that it was never noticed before just shows how little i2c_smbus_read_i2c_block_data() was used, which isn't that surprising given how broken its prototype was so far. There are some obvious compatiblity considerations: * This changes the i2c_smbus_read_i2c_block_data() prototype. Users outside the kernel tree will notice at compilation time, and will have to update their code. * User-space has access to i2c_smbus_xfer() directly using i2c-dev, so the changed expectations would affect tools such as i2cdump. In order to preserve binary compatibility, we give I2C_SMBUS_I2C_BLOCK_DATA a new numeric value, and define I2C_SMBUS_I2C_BLOCK_BROKEN with the old numeric value. When i2c-dev receives a transaction with the old value, it can convert it to the new format on the fly. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* scx200_acb: Use mutex instead of semaphoreMatthias Kaehlcke2007-07-121-7/+7
| | | | | | | | | | The scx200_acb driver use a semaphore as mutex. Use the mutex API instead of the (binary) semaphore. Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Cc: Jordan Crouse <jordan.crouse@amd.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* header cleaning: don't include smp_lock.h when not usedRandy Dunlap2007-05-081-1/+0
| | | | | | | | | | | | 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>
* scx200_acb: Fix PCI device reference countJean Delvare2007-05-011-0/+1
| | | | | | | | | 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>
* i2c: Shrink struct i2c_clientDavid Brownell2007-05-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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>
* i2c: Declare more i2c_adapter parent devicesJean Delvare2007-02-131-3/+4
| | | | | | | | | | | | | | | 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>
* [PATCH] scx200_acb: handle PCI errorsJeff Garzik2006-11-201-3/+4
| | | | | | | Signed-off-by: Jeff Garzik <jeff@garzik.org> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* i2c: Constify i2c_algorithm declarations, part 2Jean Delvare2006-09-261-1/+1
| | | | | | | | | | | | i2c: Constify i2c_algorithm declarations, part 2 Make struct i2c_algorithm declarations const in all i2c bus drivers where it is possible. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: David Brownell <david-b@pacbell.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] SCX200_ACB: eliminate spurious timeout errorsDavid Woodhouse2006-08-061-2/+5
| | | | | | | | | | | | | | | | | | | | | While busy-waiting for completion, check the hardware after scheduling; don't schedule and then immediately check the _timeout_. If the yield() took a long time (as it does on my OLPC prototype board when it's busy), we'd report a timeout even though the hardware was now ready. This fixes it, and also switches the yield() for a cond_resched() because we don't actually want to be _that_ nice about it. I see nice tightly-packed SMBus transactions now, rather than waiting for milliseconds between successive phases. Actually, we shouldn't be busy-waiting here at all. We should be using interrupts. That's an exercise for another day though. Signed-off-by: David Woodhouse <dwmw2@infradead.org> Cc: Christer Weinigel <wingel@nano-system.com> Cc: <Jordan.Crouse@amd.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* [PATCH] scx200_acb: Fix the block transactionsJean Delvare2006-07-121-2/+6
| | | | | | | | | | | | | | | The scx200_acb i2c bus driver pretends to support SMBus block transactions, but in fact it implements the more simple I2C block transactions. Additionally, it lacks sanity checks on the length of the block transactions, which could lead to a buffer overrun. This fixes an oops reported by Alexander Atanasov: http://marc.theaimsgroup.com/?l=linux-kernel&m=114970382125094 Thanks to Ben Gardner for fixing my bugs :) Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] scx200_acb: Fix the state machineThomas Andrews2006-07-121-6/+6
| | | | | | | | | | Fix the scx200_acb state machine: * Nack was sent one byte too late on reads >= 2 bytes. * Stop bit was set one byte too late on reads. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] scx200_acb: Mark scx200_acb_probe __initJean Delvare2006-06-221-1/+1
| | | | | | | | In i2c bus driver scx200_acb, function scx200_acb_probe can be tagged __init. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] scx200_acb: Use PCI I/O resource when appropriateJordan Crouse2006-06-221-53/+147
| | | | | | | | | On the CS5535 and CS5536, the I/O resource is allocated through PCI, so use that instead of using the MSR backdoor. Signed-off-by: Jordan Crouse <jordan.crouse@amd.com> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] scx200_acb: fix section mismatch warningRandy Dunlap2006-05-261-1/+1
| | | | | | | | | | WARNING: drivers/i2c/busses/scx200_acb.o - Section mismatch: reference to .init.text: from .text after 'scx200_add_cs553x' (at offset 0x528) Signed-off-by: Randy Dunlap <rdunlap@xenotime.net> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* [PATCH] scx200_acb: Fix for the CS5535 errataJordan Crouse2006-05-091-0/+7
| | | | | | | | | | | | | | | | | | | | | | | This is a fix for the CS5535 errata 111: When the SMBus controller tries to access a non-existing device, it sets the NEGACK bit, SMBus I/O offset 01h[4], to 1 after it detects no acknowledge at the ninth clock. The specification states that the bit can be cleared by writing a 1 to it, but under certain circumstances it is possible for this bit to not clear. Writing a 0 to the bit resets the internal state machine and clears the issue. Since all writable bits in ACBST are W1C bits (write-one-to-clear) the second write doesn't affect any other logic except the buggy NEGACK state machine. The second write clears an internal register which is responsible for "overwriting" the NEGACK bit in ACBST. Signed-off-by: Jordan Crouse <jordan.crouse@amd.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] scx200_acb: Fix resource name use after freeJean Delvare2006-05-091-5/+1
| | | | | | | | | | | | We can't pass a string on the stack to request_region. As soon as we leave the function that stack is gone and the string is lost. Let's use the same string we identify the i2c_adapter with instead, it's more simple, more consistent, and just works. This is the second half of fix to bug #6445. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] scx200_acb: Fix return on init errorJean Delvare2006-05-091-0/+3
| | | | | | | | | | | | | The scx200_acb driver shouldn't return failure after initialization if it successfully registered at least one i2c_adapter, else we are leaking resources. The driver was OK in that respect up to 2.6.16, a recent change broke it. This is part of the fix to bug #6445. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Ben Gardner <bgardner@wabtec.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] i2c: Semaphore to mutex conversions, part 3Jean Delvare2006-03-231-4/+5
| | | | | | | | Cleanup after the semaphores to mutexes conversions in the i2c subsystem. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] i2c: scx200_acb fix and speed up the poll loopBen Gardner2006-03-231-11/+2
| | | | | | | | scx200_acb: Fix and speed up the poll loop Signed-off-by: Ben Gardner <bgardner@wabtec.com> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] i2c: scx200_acb add support for the CS5535/CS5536Ben Gardner2006-03-231-14/+43
| | | | | | | scx200_acb: Add support for the CS5535/CS5536 Signed-off-by: Ben Gardner <bgardner@wabtec.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* [PATCH] i2c: scx200_acb remove use of lock_kernelBen Gardner2006-03-231-6/+7
| | | | | | | | scx200_acb: remove use of lock_kernel() Signed-off-by: Ben Gardner <bgardner@wabtec.com> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] i2c: scx200_acb refactor/simplify codeBen Gardner2006-03-231-44/+29
| | | | | | | | scx200_acb: refactor/simplify code (no functional changes) Signed-off-by: Ben Gardner <bgardner@wabtec.com> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] i2c: scx200_acb debug log cleanupBen Gardner2006-03-231-25/+17
| | | | | | | | scx200_acb: debug log cleanup Signed-off-by: Ben Gardner <bgardner@wabtec.com> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] i2c: scx200_acb whitespace and comment cleanupBen Gardner2006-03-231-47/+43
| | | | | | | | scx200_acb: Whitespace and comment cleanup Signed-off-by: Ben Gardner <bgardner@wabtec.com> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] i2c: kzalloc conversion, other driversDeepak Saxena2005-10-281-2/+1
| | | | | | | | | Use kzalloc instead of kmalloc+memset in all remaining i2c bus and chip drivers. Signed-off-by: Deepak Saxena <dsaxena@plexity.net> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] I2C: Kill i2c_algorithm.id (6/7)Jean Delvare2005-09-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | In theory, there should be no more users of I2C_ALGO_* at this point. However, it happens that several drivers were using I2C_ALGO_* for adapter ids, so we need to correct these before we can get rid of all the I2C_ALGO_* definitions. Note that this also fixes a bug in media/video/tvaudio.c: /* don't attach on saa7146 based cards, because dedicated drivers are used */ if ((adap->id & I2C_ALGO_SAA7146)) return 0; This test was plain broken, as it would succeed for many more adapters than just the saa7146: any those id would share at least one bit with the saa7146 id. We are really lucky that the few other adapters we want this driver to work with did not fulfill that condition. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] I2C: Kill i2c_algorithm.id (4/7)Jean Delvare2005-09-051-1/+0
| | | | | | | | There are no more users of i2c_algorithm.id, so we can finally drop this structure member. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] I2C: Kill i2c_algorithm.name (1/7)Jean Delvare2005-09-051-1/+0
| | | | | | | | | The name member of the i2c_algorithm is never used, although all drivers conscientiously fill it. We can drop it completely, this structure doesn't need to have a name. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* [PATCH] I2C: drivers/i2c/*: #include <linux/config.h> cleanupAlexey Dobriyan2005-06-211-1/+0
| | | | | | | | | | Files that don't use CONFIG_* stuff shouldn't include config.h Files that use CONFIG_* stuff should include config.h It's that simple. ;-) Signed-off-by: Alexey Dobriyan <adobriyan@mail.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Linux-2.6.12-rc2Linus Torvalds2005-04-161-0/+557
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!