Commit Graph

152 Commits

Author SHA1 Message Date
Jean Delvare 9a94241afc i2c: Add support for custom probe function
The probe method used by i2c_new_probed_device() may not be suitable
for all cases. Let the caller provide its own, optional probe
function.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-11 18:20:56 +02:00
Justin P. Mattock 0ea6e61122 Documentation: update broken web addresses.
Below you will find an updated version from the original series bunching all patches into one big patch
updating broken web addresses that are located in Documentation/*
Some of the addresses date as far far back as 1995 etc... so searching became a bit difficult,
the best way to deal with these is to use web.archive.org to locate these addresses that are outdated.
Now there are also some addresses pointing to .spec files some are located, but some(after searching
on the companies site)where still no where to be found. In this case I just changed the address
to the company site this way the users can contact the company and they can locate them for the users.

Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>
Signed-off-by: Thomas Weber <weber@corscience.de>
Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Cc: Paulo Marques <pmarques@grupopie.com>
Cc: Randy Dunlap <rdunlap@xenotime.net>
Cc: Michael Neuling <mikey@neuling.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-08-04 15:21:40 +02:00
Andrea Gelmini 89140f4157 Documentation/i2c: Checkpatch cleanup
Remove all trailing whitespace in Documentation/i2c.

Signed-off-by: Andrea Gelmini <andrea.gelmini@gelma.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-06-03 11:33:50 +02:00
Jean Delvare adff687d8c i2c-i801: Let the user disable selected driver features
Let the user disable selected features normally supported by the
device. This makes it possible to work around possible driver or
hardware bugs if the feature in question doesn't work as intended
for whatever reason.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Felix Rubinstein <felixru@gmail.com>
2010-05-21 18:40:54 +02:00
Wolfram Sang e4a7b9b04d i2c-core: Erase pointer to clientdata on removal
After discovering that a lot of i2c-drivers leave the pointer to their
clientdata dangling, it was decided to let the core handle this issue.
It is assumed that the core may access the private data after remove()
as there are no guarantees for the lifetime of such pointers anyhow (see
thread starting at http://lkml.org/lkml/2010/3/21/68)

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-05-04 11:09:27 +02:00
Zhangfei Gao 0c43ea544c i2c: Document the message size limit
i2c_master_send & i2c_master_recv do not support more than 64 kb
transfer, since msg.len is u16.

Signed-off-by: Zhangfei Gao <zgao6@marvell.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-03-02 12:23:49 +01:00
Jean Delvare 927ab2f807 i2c-parport-light: Add SMBus alert support
Add support for the SMBus alert mechanism to the i2c-parport-light
driver. The ADM1032 evaluation board at least is properly wired for
this.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Trent Piepho <tpiepho@freescale.com>
2010-03-02 12:23:45 +01:00
Jean Delvare 3585925448 i2c-parport: Add SMBus alert support
Add support for the SMBus alert mechanism to the i2c-parport driver.
The ADM1032 evaluation board at least is properly wired for this.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Trent Piepho <tpiepho@freescale.com>
2010-03-02 12:23:44 +01:00
Jean Delvare b5527a7766 i2c: Add SMBus alert support
SMBus alert support. The SMBus alert protocol allows several SMBus
slave devices to share a single interrupt pin on the SMBus master,
while still allowing the master to know which slave triggered the
interrupt.

This is based on preliminary work by David Brownell. The key
difference between David's implementation and mine is that his was
part of i2c-core, while mine is split into a separate, standalone
module named i2c-smbus. The i2c-smbus module is meant to include
support for all SMBus extensions to the I2C protocol in the future.

The benefit of this approach is a zero cost for I2C bus segments which
do not need SMBus alert support. Where David's implementation
increased the size of struct i2c_adapter by 7% (40 bytes on i386),
mine doesn't touch it. Where David's implementation added over 150
lines of code to i2c-core (+10%), mine doesn't touch it. The only
change that touches all the users of the i2c subsystem is a new
callback in struct i2c_driver (common to both implementations.) I seem
to remember Trent was worried about the footprint of David'd
implementation, hopefully mine addresses the issue.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Trent Piepho <tpiepho@freescale.com>
2010-03-02 12:23:42 +01:00
Seth Heasley 393764340b i2c-i801: Add Intel Cougar Point device IDs
Add the Intel Cougar Point (PCH) SMBus controller device IDs.

Signed-off-by: Seth Heasley <seth.heasley@intel.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-03-02 12:23:39 +01:00
Jean Delvare c3813d6af1 i2c: Get rid of struct i2c_client_address_data
Struct i2c_client_address_data only contains one field at this point,
which makes its usefulness questionable. Get rid of it and pass simple
address lists around instead.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
2009-12-14 21:17:25 +01:00
Jean Delvare 6471b68982 i2c-stub: Documentation update
There is nothing sensors-specific to i2c-stub.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-12-06 17:06:30 +01:00
Jean Delvare 38f41f282f i2c-stub: Allow user to disable some commands
Add a module parameter to override the functionality bitfield. This
lets the user disable some commands. This can be used to force a chip
driver to take different code paths.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-12-06 17:06:29 +01:00
Jean Delvare 4710317891 i2c-stub: Implement I2C block support
This is required to test some drivers, for example at24.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-12-06 17:06:28 +01:00
Jean Delvare c7b25a9e96 i2c: Drop probe, ignore and force module parameters
The legacy probe and force module parameters are obsolete now, the
same can be achieved using the new_device sysfs interface, which is
both more flexible and cheaper (it is implemented by i2c-core rather
than replicated in every driver module.)

The legacy ignore module parameters can be dropped as well. Ignoring
can be done by instantiating a "dummy" device at the problematic
address.

This is the first step of a huge cleanup to i2c-core's i2c_detect
function, i2c.h's I2C_CLIENT_INSMOD* macros, and all drivers that made
use of them.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-12-06 17:06:24 +01:00
Jean Delvare a0c11cdd6a i2c-voodoo3: Delete
Superseded by tdfxfb. I2C/DDC support used to live in a separate
driver but this caused driver conflicts.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Krzysztof Helt <krzysztof.h1@wp.pl>
2009-12-06 17:06:21 +01:00
Crane Cai 3806e94b01 i2c-piix4: Modify code name SB900 to Hudson-2
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-07 13:10:46 +01:00
Jean Delvare 03f1805ad0 i2c: Minor documentation update
The sysfs path to i2c adapters has changed recently, update the
documentation to reflect that change.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-10-04 22:53:45 +02:00
Jean Delvare f546c65cd5 i2c: Move misc devices documentation
Some times ago the eeprom and max6875 drivers moved to
drivers/misc/eeprom, but their documentation did not follow. It's
finally time to get rid of Documentation/i2c/chips.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Ben Gardner <gardner.ben@gmail.com>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
2009-10-04 22:53:40 +02:00
Crane Cai 76b3e28fa7 i2c-piix4: Add AMD SB900 SMBus device ID
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-18 22:45:50 +02:00
Wolfram Sang e7c5c49ecd i2c/chips: Remove deprecated pcf8574 driver
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-18 22:45:49 +02:00
Wolfram Sang 732d481127 i2c/chips: Remove deprecated pca9539 driver
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-18 22:45:48 +02:00
Wolfram Sang 8f67eeb0b4 i2c/chips: Remove deprecated pcf8575 driver
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-18 22:45:48 +02:00
Jean Delvare 99cd8e2587 i2c: Add a sysfs interface to instantiate devices
Add a sysfs interface to instantiate and delete I2C devices. This is
primarily a replacement of the force_* module parameters implemented
by some i2c drivers. These module parameters were implemented
internally by the I2C_CLIENT_INSMOD* macros, which don't scale well.

This can also be used when developing a driver on a self-soldered
board which doesn't yet have proper I2C device declaration at the
platform level, and presumably for various debugging situations.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: David Brownell <dbrownell@users.sourceforge.net>
2009-06-19 16:58:20 +02:00
Jean Delvare 729d6dd571 i2c: Get rid of the legacy binding model
We converted all the legacy i2c drivers so we can finally get rid of
the legacy binding model. Hooray!

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: David Brownell <dbrownell@users.sourceforge.net>
2009-06-19 16:58:18 +02:00
Harald Welte a231591f04 i2c-viapro: Add new PCI device ID for VX855
The south bridge of the VIA VX855 chipset has a different PCI Device ID
so i2c-viapro.c needs to be updated with this.

Signed-off-by: Harald Welte <HaraldWelte@viatech.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-06-15 18:01:49 +02:00
Richard Röjfors dd14be4c27 i2c-ocores: Can add I2C devices to the bus
There is sometimes a need for the ocores driver to add devices to the
bus when installed.

i2c_register_board_info can not always be used, because the I2C devices
 are not known at an early state, they could for instance be connected
 on a I2C bus on a PCI device which has the Open Cores IP.

i2c_new_device can not be used in all cases either since the resulting
bus nummer might be unknown.

The solution is the pass a list of I2C devices in the platform data to
the Open Cores driver. This is useful for MFD drivers.

Signed-off-by: Richard Röjfors <richard.rojfors.ext@mocean-labs.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2009-06-13 10:39:28 +01:00
Jean Delvare fb4504fe84 Move the pcf8591 driver to hwmon
Directory drivers/i2c/chips is going away, so drivers there must find
new homes. For the pcf8591 driver, the best choice seems to be the
hwmon subsystem. While the Philips PCF8591 device isn't a typical
hardware monitoring chip, its DAC interface is compatible with the
hwmon one, so it fits somewhat.

If a better subsystem is ever created for ADC/DAC chips, the driver
could be moved there.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Aurelien Jarno <aurelien@aurel32.net>
2009-03-30 21:46:43 +02:00
Flavio Leitner 506a8b6c27 i2c-piix4: Add support for the Broadcom HT1100 chipset
Add support for the Broadcom HT1100 LD chipset (SMBus function.)

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-03-28 21:34:46 +01:00
Jean Delvare d2dd14ac18 i2c-nforce2: Add support for MCP67, MCP73, MCP78S and MCP79
The MCP78S and MCP79 appear to be compatible with the previous nForce
chips as far as the SMBus controller is concerned. The MCP67 and MCP73
were not tested yet but I'd be very surprised if they weren't
compatible too.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Oleg Ryjkov <olegr@olegr.ca>
Cc: Malcolm Lalkaka <mlalkaka@gmail.com>
Cc: Zbigniew Luszpinski <zbiggy@o2.pl>
2009-03-28 21:34:41 +01:00
Jean Delvare 764c16918f i2c: Document the different ways to instantiate i2c devices
On popular demand, here comes some documentation about how to
instantiate i2c devices in the new (standard) i2c device driver
binding model.

I have also clarified how the class bitfield lets driver authors
control which buses are probed in the auto-detect case, and warned
more loudly against the abuse of this method.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Michael Lawnick <nospam_lawnick@gmx.de>
Acked-by: Hans Verkuil <hverkuil@xs4all.nl>
2009-03-28 21:34:40 +01:00
Jean Delvare 846557d3ce i2c: The i2c mailing list is moving
Replace all references to the old i2c mailing list.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-10-30 15:55:47 +01:00
Jean Delvare 0e47858da4 i2c: Update and clean up writing-clients document
* Strip trailing white space.
* Remove out-of-date or irrelevant parts.
* Insist on the fact that command is deprecated.
* Fix spelling mistakes and typos.
* Reformat code examples and function prototypes to comply with the
  kernel coding style.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-10-22 20:21:32 +02:00
Jean Delvare e313353dd4 i2c: Delete legacy model documentation
The legacy i2c binding model is deprecated and will be removed soon,
so we no longer need to document it.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-10-22 20:21:31 +02:00
Jean Delvare 7d1d8999b4 i2c: Constify i2c_get_clientdata's parameter
i2c_get_clientdata doesn't change the i2c_client it is passed as a
parameter, so it can be constified. Same for i2c_get_adapdata.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-10-22 20:21:31 +02:00
Jean Delvare d955cafb5c i2c: Delete outdated client porting guide
The document describing how to port i2c chip drivers from Linux 2.4 to
Linux 2.6 is outdated. As I suspect that most drivers that had to be
ported have already been by now, I do not want to spend time updating
it. Let's just delete it instead.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-10-22 20:21:30 +02:00
Seth Heasley c429a247f5 i2c-i801: Add support for Intel Ibex Peak
Adds the Intel Ibex Peak (PCH) SMBus Controller Device IDs.

Signed-off-by: Seth Heasley <seth.heasley@intel.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-10-22 20:21:29 +02:00
Prakash Mortha 596c88f460 i2c: Restore i2c_smbus_process_call function
Restore the i2c_smbus_process_call() as one driver (for the
Micronas MAP5401) will need it soon.

[JD: Update documentation accordingly.]

Signed-off-by: Prakash Mortha <pmortha@escient.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-10-14 17:30:06 +02:00
Jean Delvare 7c15fd1249 i2c: Document the implementation details of the /dev interface
I wrote this explanation to answer a question on the i2c mailing list,
and thought it would be good to have in the kernel documentation.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-10-14 17:30:05 +02:00
Jean Delvare fceb2d0680 i2c: Improve dev-interface documentation
* Clarify some points.
* Point developers to i2c-tools instead of lm_sensors.
* Fix coding style in code examples.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-10-14 17:30:05 +02:00
Rudolf Marek b806a71a0e i2c-viapro: Add VX800/VX820 support
Thanks to new datasheets published on http://linux.via.com.tw we can now add 
support for VX800/VX820 chipsets.

Signed-off-by: Rudolf Marek <r.marek@assembler.cz>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-10-14 17:30:03 +02:00
Ben Dooks 31321b76e1 i2c: Documentation: upgrading clients HOWTO
Add a document describing how i2c clients on Linux 2.6 can be
moved from the old to the new driver model.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
2008-07-28 12:41:02 +01:00
Jean Delvare bd8d421f7c i2c: Convert the max6875 driver to a new-style i2c driver
The new-style max6875 driver implements the optional detect() callback
to cover the use cases of the legacy driver. I'm curious if anyone
really needs this though, so it might be removed in the feature.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-07-16 19:30:07 +02:00
Jean Delvare 3d63430a26 i2c: Convert the pca9539 driver to a new-style i2c driver
The new-style pca9539 driver implements the optional detect() callback
to cover the use cases of the legacy driver.

Warning: users will now have to use the force module parameter to get
the driver to attach to their device. That's not a bad thing as these
devices can't be detected anyway.

Note that this doesn't change the fact that this driver is deprecated
in favor of gpio/pca953x.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-07-16 19:30:07 +02:00
Jean Delvare 97addff6de i2c: Convert the pcf8575 driver to a new-style i2c driver
The new-style pcf8575 driver implements the optional detect() callback
to cover the use cases of the legacy driver.

Warning: users will now have to use the force module parameter to get
the driver to attach to their device. That's not a bad thing as these
devices can't be detected anyway.

Note that this doesn't change the fact that this driver is deprecated
in favor of gpio/pcf857x.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-07-16 19:30:06 +02:00
Jean Delvare 833bedb813 i2c: Convert the pcf8574 driver to a new-style i2c driver
The new-style pcf8574 driver implements the optional detect() callback
to cover the use cases of the legacy driver.

Warning: users will now have to use the force module parameter to get
the driver to attach to their device. That's not a bad thing as these
devices can't be detected anyway.

Note that this doesn't change the fact that this driver is deprecated
in favor of gpio/pcf857x.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-07-16 19:30:06 +02:00
Jean Delvare 4735c98f84 i2c: Add detection capability to new-style drivers
Add a mechanism to let new-style i2c drivers optionally autodetect
devices they would support on selected buses and ask i2c-core to
instantiate them. This is a replacement for legacy i2c drivers, much
cleaner.

Where drivers had to implement both a legacy i2c_driver and a
new-style i2c_driver so far, this mechanism makes it possible to get
rid of the legacy i2c_driver and implement both enumerated and
detected device support with just one (new-style) i2c_driver.

Here is a quick conversion guide for these drivers, step by step:

* Delete the legacy driver definition, registration and removal.
  Delete the attach_adapter and detach_client methods of the legacy
  driver.

* Change the prototype of the legacy detect function from
    static int foo_detect(struct i2c_adapter *adapter, int address, int kind);
  to
    static int foo_detect(struct i2c_client *client, int kind,
    			  struct i2c_board_info *info);

* Set the new-style driver detect callback to this new function, and
  set its address_data to &addr_data (addr_data is generally provided
  by I2C_CLIENT_INSMOD.)

* Add the appropriate class to the new-style driver. This is
  typically the class the legacy attach_adapter method was checking
  for. Class checking is now mandatory (done by i2c-core.) See
  <linux/i2c.h> for the list of available classes.

* Remove the i2c_client allocation and freeing from the detect
  function. A pre-allocated client is now handed to you by i2c-core,
  and is freed automatically.

* Make the detect function fill the type field of the i2c_board_info
  structure it was passed as a parameter, and return 0, on success. If
  the detection fails, return -ENODEV.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-07-14 22:38:36 +02:00
Jean Delvare 67c2e66571 i2c: Delete unused function i2c_smbus_write_quick
Function i2c_smbus_write_quick has no users left, so we can delete it.

Also update the list of these helper functions which are gone but
could be added back if needed.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-07-14 22:38:23 +02:00
David Brownell 24a5bb7b18 i2c-core: Return -Errno, not -1
More updates to the I2C stack's fault reporting:  make the core stop
returning "-1" (usually "-EPERM") for all faults.  Instead, pass lower
level fault code up the stack, or return some appropriate errno.

This patch happens to touch almost exclusively SMBus calls.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-07-14 22:38:23 +02:00
David Brownell 81fded1f79 i2c: Document standard fault codes
Create Documentation/i2c/fault-codes to help standardize
fault/error code usage in the I2C stack.  It turns out that
returning -1 (-EPERM) for everything was not at all helpful.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-07-14 22:38:22 +02:00