25 May, 2011

1 commit


04 May, 2010

1 commit

  • 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
    Signed-off-by: Jean Delvare

    Wolfram Sang
     

02 Mar, 2010

1 commit


15 Dec, 2009

1 commit


19 Jun, 2009

1 commit


29 Mar, 2009

1 commit

  • 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
    Acked-by: Michael Lawnick
    Acked-by: Hans Verkuil

    Jean Delvare
     

23 Oct, 2008

3 commits


14 Oct, 2008

1 commit


15 Jul, 2008

3 commits

  • 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
    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

    Jean Delvare
     
  • 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

    Jean Delvare
     
  • 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
    Signed-off-by: Jean Delvare

    David Brownell
     

02 Jul, 2008

1 commit


30 Apr, 2008

1 commit

  • Based on earlier work by Jon Smirl and Jochen Friedrich.

    This patch allows new-style i2c chip drivers to have alias names using
    the official kernel aliasing system and MODULE_DEVICE_TABLE(). At this
    point, the old i2c driver binding scheme (driver_name/type) is still
    supported.

    Signed-off-by: Jean Delvare
    Cc: Jochen Friedrich
    Cc: Jon Smirl
    Cc: Kay Sievers

    Jean Delvare
     

28 Jan, 2008

1 commit


12 Jul, 2007

1 commit

  • 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

    Jean Delvare
     

02 May, 2007

4 commits

  • Make the documentation on how to write and port i2c drivers more in
    line with the current state of things:
    * i2c-isa is deprecated and soon gone, so stop advertising it.
    * Drop many sensors-specific references. Most of them were outdated
    anyway.
    * Update the example code to reflect the recent and not-so-recent
    API and coding style preference changes.
    * Simplify the example init and cleanup functions.

    This should make things less complex to understand for newcomers.

    Signed-off-by: Jean Delvare

    Jean 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

    Jean Delvare
     
  • Document the new i2c_new_device(), i2c_new_probed_device() and
    i2c_unregister_device() functions.

    Signed-off-by: Jean Delvare

    Jean Delvare
     
  • Update Documentation/i2c to match previous patches updating probe()
    and remove() logic.

    Signed-off-by: David Brownell
    Signed-off-by: Jean Delvare

    David Brownell
     

14 Feb, 2007

1 commit

  • Driver model updates for the I2C core:

    - Add new suspend(), resume(), and shutdown() methods. Use them in the
    standard driver model style; document them.

    - Minor doc updates to highlight zero-initialized fields in drivers, and
    the driver model accessors for "clientdata".

    If any i2c drivers were previously using the old suspend/resume calls
    in "struct driver", they were getting warning messages ... and will
    now no longer work. Other than that, this patch changes no behaviors;
    and it lets I2C drivers use conventional PM and shutdown support.

    Signed-off-by: David Brownell
    Signed-off-by: Jean Delvare

    David Brownell
     

06 Jan, 2006

4 commits


08 Nov, 2005

1 commit

  • My latest update to the writing-clients i2c documentation file was
    incomplete, here's the complement.

    Large parts of this file are still way out-of-date, but at least now
    the memory allocation and freeing instructions are consistent.

    Signed-off-by: Jean Delvare
    Signed-off-by: Greg Kroah-Hartman

    Jean Delvare
     

31 Oct, 2005

1 commit

  • Removed some more references to check_region().

    I checked these changes into the 'checkreg' branch of
    rsync://rsync.kernel.org/pub/scm/linux/kernel/git/jgarzik/misc-2.6.git

    The only valid references remaining are in:
    drivers/scsi/advansys.c
    drivers/scsi/BusLogic.c
    drivers/cdrom/sbpcd.c
    sound/oss/pss.c

    Remove last vestiges of ide_check_region()
    drivers/char/specialix: trim trailing whitespace
    drivers/char/specialix: eliminate use of check_region()
    Remove outdated and unused references to check_region()
    [sound oss] remove check_region() usage from cs4232, wavfront
    [netdrvr eepro] trim trailing whitespace
    [netdrvr eepro] remove check_region() usage

    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Garzik
     

29 Oct, 2005

2 commits

  • Update the i2c documentation: kzalloc should be used instead of
    kmalloc.

    I also fixed a couple other things nearby in writing-clients, as several
    past changes had never been reported there.

    Signed-off-by: Jean Delvare
    Signed-off-by: Greg Kroah-Hartman

    Jean Delvare
     
  • i2c documentation fixes.

    >From Hideki Iwamoto:
    * i2c_smbus_read_i2c_block_data is not deleted in 2.6.10. It still
    exists.
    * The name which can be set to i2c_driver is up to 31 characters.

    >From Jean Delvare:
    * Reword the paragraph about i2c_driver.name, to reflect the "new"
    naming policy.
    * Delete the out-of-date note about now gone inc_use and dec_use
    fields.

    Signed-off-by: Jean Delvare
    Signed-off-by: Greg Kroah-Hartman

    Jean Delvare
     

06 Sep, 2005

6 commits

  • i2c_probe was quite complex and slow, so I rewrote it in a more
    efficient and hopefully clearer way.

    Note that this slightly changes the way the module parameters are
    handled. This shouldn't change anything for the most common cases
    though.

    For one thing, the function now respects the order of the parameters
    for address probing. It used to always do lower addresses first. The
    new approach gives the user more control.

    For another, ignore addresses don't overrule probe addresses anymore.
    This could have been restored the way it was at the cost of a few more
    lines of code, but I don't think it's worth it. Both lists are given
    as module parameters, so a user would be quite silly to specify the
    same addresses in both lists. The normal addresses list is the only
    one that isn't controlled by a module parameter, thus is the only one
    the user may reasonably want to remove an address from.

    Another significant change is the fact that i2c_probe() will no more
    stop when a detection function returns -ENODEV. Just because a driver
    found a chip it doesn't support isn't a valid reason to stop all
    probings for this one driver. This closes the long standing lm_sensors
    ticket #1807.

    http://www2.lm-sensors.nu/~lm78/readticket.cgi?ticket=1807

    I updated the documentation accordingly.

    In terms of algorithmic complexity, the new code is way better. If
    I is the ignore address count, P the probe address count, N the
    normal address count and F the force address count, the old code
    was doing 128 * (F + I + P + N) iterations max, while the new code
    does F + P + ((I+1) * N) iterations max. For the most common case
    where F, I and P are empty, this is down from 128 * N to N.

    Signed-off-by: Jean Delvare
    Signed-off-by: Greg Kroah-Hartman

    Jean Delvare
     
  • The only thing left in i2c-sensor.h are module parameter definition
    macros. It's only an extension of what i2c.h offers, and this extension
    is not sensors-specific. As a matter of fact, a few non-sensors drivers
    use them. So we better merge them in i2c.h, and get rid of i2c-sensor.h
    altogether.

    Signed-off-by: Jean Delvare
    Signed-off-by: Greg Kroah-Hartman

    Jean Delvare
     
  • i2c_probe and i2c_detect now do the exact same thing and operate on
    the same data structure, so we can have everyone call i2c_probe.

    Signed-off-by: Jean Delvare
    Signed-off-by: Greg Kroah-Hartman

    Jean Delvare
     
  • We could refactor the error message 34 different i2c drivers print if
    i2c_detach_client() fails in this function itself. Saves quite a few
    lines of code. Documentation is updated to reflect that change.

    Note that this patch should be applied after Rudolf Marek's w83792d
    patches.

    Signed-off-by: Jean Delvare
    Signed-off-by: Greg Kroah-Hartman

    Jean Delvare
     
  • Kill all uses of i2c_is_isa_adapter except for the hybrid drivers (it87,
    lm78, w83781d). The i2c-isa adapter not being registered with the i2c
    core anymore, drivers don't have to fear being erroneously attached to
    it.

    Signed-off-by: Greg Kroah-Hartman

    Jean Delvare
     
  • Kill normal_isa in header files, documentation and all chip drivers, as
    it is no more used.

    normal_i2c could be renamed to normal, but I decided not to do so at the
    moment, so as to limit the number of changes. This might be done later
    as part of the i2c_probe/i2c_detect merge.

    Signed-off-by: Greg Kroah-Hartman

    Jean Delvare
     

12 Jul, 2005

1 commit

  • The I2C stack has long had "id" fields, of rather dubious utility, in
    many data structures. This removes mention of one of them from the
    documentation about how to write an I2C driver, so that only drivers
    that really need to use them (probably old/legacy code) will have any
    reason to use this field.

    Signed-off-by: David Brownell
    Signed-off-by: Greg Kroah-Hartman

    david-b@pacbell.net
     

22 Jun, 2005

1 commit

  • Some months ago, you killed the address ranges mechanism from all
    sensors i2c chip drivers (both the module parameters and the in-code
    address lists). I think it was a very good move, as the ranges can
    easily be replaced by individual addresses, and this allowed for
    significant cleanups in the i2c core (let alone the impressive size
    shrink for all these drivers).

    Unfortunately you did not do the same for non-sensors i2c chip drivers.
    These need the address ranges even less, so we could get rid of the
    ranges here as well for another significant i2c core cleanup. Here comes
    a patch which does just that. Since the process is exactly the same as
    what you did for the other drivers set already, I did not split this one
    in parts.

    A documentation update is included.

    The change saves 308 bytes in the i2c core, and an average 1382 bytes
    for chip drivers which use I2C_CLIENT_INSMOD, 126 bytes for those which
    do not.

    This change is required if we want to merge the sensors and non-sensors
    i2c code (and we want to do this).

    Signed-off-by: Jean Delvare
    Signed-off-by: Greg Kroah-Hartman

    Index: gregkh-2.6/Documentation/i2c/writing-clients
    ===================================================================

    Jean Delvare
     

17 Apr, 2005

1 commit

  • 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!

    Linus Torvalds