aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-powermac.c
Commit message (Collapse)AuthorAgeFilesLines
* i2c-powermac: Be less verbose in the absence of real errors.Jean Delvare2010-03-131-7/+18
| | | | | | | | | | Be less verbose in the absence of real errors. We don't have to report failed probes to the users, it's only confusing them. Signed-off-by: Jean Delvare <khali@linux-fr.org> Tested-by: Andrey Gusev <ronne@list.ru> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: stable@kernel.org
* i2c: Bus drivers don't have to support I2C_M_REV_DIR_ADDRJean Delvare2009-12-061-2/+0
| | | | | | | | | I2C bus drivers don't have to support I2C_M_REV_DIR_ADDR. It is a deviation from the I2C specification, which only makes sense to implement when really needed. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Ben Dooks <ben-linux@fluff.org>
* i2c-powermac: Drop temporary name bufferJean Delvare2009-12-061-6/+5
| | | | | | | | | | We no longer need to write the adapter name to a temporary buffer. We can write it directly to the i2c_adapter's name field. This is more efficient. Signed-off-by: Jean Delvare <khali@linux-fr.org> Tested-by: Michel Daenzer <michel@daenzer.net> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* i2c-powermac: Include the i2c_adapter in struct pmac_i2c_busJean Delvare2009-12-061-12/+3
| | | | | | | | | Include the i2c_adapter in struct pmac_i2c_bus. This avoids memory fragmentation and allows for several code cleanups. Signed-off-by: Jean Delvare <khali@linux-fr.org> Tested-by: Michel Daenzer <michel@daenzer.net> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* i2c-powermac: Log errorsJean Delvare2009-12-061-5/+23
| | | | | | | | | | Log errors when they happen, otherwise we have no idea what went wrong. Signed-off-by: Jean Delvare <khali@linux-fr.org> Tested-by: Michel Daenzer <michel@daenzer.net> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org>
* i2c-powermac: Refactor i2c_powermac_smbus_xferJean Delvare2009-12-061-44/+41
| | | | | | | | | | | | I wanted to add some error logging to the i2c-powermac driver, but found that it was very difficult due to the way the i2c_powermac_smbus_xfer function is organized. Refactor the code in this function so that each low-level function is only called once. Signed-off-by: Jean Delvare <khali@linux-fr.org> Tested-by: Michel Daenzer <michel@daenzer.net> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org>
* i2c-powermac: Reject unsupported I2C transactionsJean Delvare2009-12-061-0/+6
| | | | | | | | | | | | | | The i2c-powermac driver doesn't support arbitrary multi-message I2C transactions, only SMBus ones. Make it clear by returning an error if a multi-message I2C transaction is attempted. This is better than only processing the first message, because most callers won't recover from the short transaction. Anyone wishing to issue multi-message transactions should use the SMBus API instead of the raw I2C API. Signed-off-by: Jean Delvare <khali@linux-fr.org> Tested-by: Michel Daenzer <michel@daenzer.net> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org>
* i2c: Add missing KERN_* constants to printksFrank Seidel2009-03-281-1/+2
| | | | | | | | | According to kerneljanitors todo list all printk calls (beginning a new line) should have an according KERN_* constant. Those are the missing pieces here for the i2c subsystem. Signed-off-by: Frank Seidel <frank@f-seidel.de> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* hwmon: (ams) Convert to a new-style i2c driverJean Delvare2008-10-171-0/+29
| | | | | | | | | | | | | | | | | | | | | | The legacy i2c binding model is phasing out, so the ams driver needs to be converted to a new-style i2c driver. Here is a naive approach of this conversion. Basically it is moving the i2c device creation from the ams driver to the i2c-powermac driver. This should work, but I suspect we could come up with something cleaner by declaring the i2c device as part of the platform setup. This could be done later by someone more familiar with openfirmware-based platforms than I am myself. One nice thing brought by this conversion is that the ams driver should be loaded automatically on systems where is is needed (at least when the I2C interface to the chip is used) providing coldplug-aware user-space environment. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Johannes Berg <johannes@sipsolutions.net> Cc: Stelian Pop <stelian@popies.net> Cc: Michael Hanselmann <linux-kernel@hansmi.ch> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* i2c-powermac: Fix section for probe and remove functionsUwe Kleine-Koenig2008-09-241-2/+2
| | | | | | | | | | | | __devexit for i2c_powermac_probe is obviously wrong. In the definition of struct platform_driver i2c_powermac_driver the remove function i2c_powermac_remove is wrapped in __devexit_p, so it should be defined using __devexit. Signed-off-by: Uwe Kleine-Koenig <ukleinek@informatik.uni-freiburg.de> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c: Fix platform driver hotplug/coldplugKay Sievers2008-04-221-0/+3
| | | | | | | | | | | | Since 43cc71eed1250755986da4c0f9898f9a635cb3bf, the platform modalias is prefixed with "platform:". Add MODULE_ALIAS() to the hotpluggable I2C platform drivers, to allow module auto loading. [ db: add some more drivers ] Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c: Spelling fixesJoe Perches2008-01-141-1/+1
| | | | | | | [JD: One more fix in i2c-dev.] Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c: Fix the i2c_smbus_read_i2c_block_data() prototypeJean Delvare2007-07-121-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* i2c: completion header cleanupsJean Delvare2007-02-131-1/+0
| | | | | | | | | | | | 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>
* [POWERPC] Fix i2c-powermac platform device usageBenjamin Herrenschmidt2006-10-101-13/+15
| | | | | | | | | | | | i2c-powermac was written & merged right after Russell King's changes adding platform_driver... which I missed. Thus it still used struct device, causing crashes when hitting sleep/wakeup callbacks (it happened to work by luck so far, until early/late callbacks got added). This causes crashes on sleep/wakeup on PowerBooks with 2.6.19. The patch fixes it by using a proper platform_driver. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.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>
* Merge branch 'merge'Paul Mackerras2006-08-011-3/+1
|\
| * [PATCH] i2c-powermac: Fix master_xfer return valueJean Delvare2006-07-121-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix the value returned by the i2c-powermac's master_xfer method. It should return the number of messages processed successfully, but instead returns the number of data bytes in the first (and only) processed message. Also explicitly mention the master_xfer convention so that future implementations get it right directly. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* | [POWERPC] powermac: Constify & voidify get_property()Jeremy Kerr2006-07-311-1/+2
|/ | | | | | | | | | | | | Now that get_property() returns a void *, there's no need to cast its return value. Also, treat the return value as const, so we can constify get_property later. powermac platform & macintosh driver changes. Built for pmac32_defconfig, g5_defconfig Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
* Remove obsolete #include <linux/config.h>Jörn Engel2006-06-301-1/+0
| | | | | Signed-off-by: Jörn Engel <joern@wohnheim.fh-wedel.de> Signed-off-by: Adrian Bunk <bunk@stusta.de>
* [PATCH] 2/5 powerpc: Rework PowerMac i2c part 2Benjamin Herrenschmidt2006-01-091-0/+290
This is the continuation of the previous patch. This one removes the old PowerMac i2c drivers (i2c-keywest and i2c-pmac-smu) and replaces them both with a single stub driver that uses the new PowerMac low i2c layer. Now that i2c-keywest is gone, the low-i2c code is extended to support interrupt driver transfers. All i2c busses now appear as platform devices. Compatibility with existing drivers should be maintained as the i2c bus names have been kept identical, except for the SMU bus but in that later case, all users has been fixed. With that patch added, matching a device node to an i2c_adapter becomes trivial. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>