28 Aug, 2008

2 commits

  • Some DVB adapters do not support the special I2C transaction that we
    use for probing purposes. There's no point in logging this event, as
    there's nothing the user can do and in general there is no actual
    problem. So, degrade one of these messages to a debug message, and
    move the other one around so that it is only printed on bogus drivers.

    Signed-off-by: Jean Delvare
    Acked-by: Uwe Bugla

    Jean Delvare
     
  • device_init_wakeup must be called after device_register.

    Signed-off-by: Marc Pignat
    Acked-by: David Brownell
    Signed-off-by: Jean Delvare

    Marc Pignat
     

11 Aug, 2008

2 commits


22 Jul, 2008

1 commit


17 Jul, 2008

1 commit

  • Clear i2c_adapter.dev on adapter removal. This makes it possible to
    re-add the adapter at a later point, which some drivers
    (i2c-amd756-s4882, i2c-nforce2-s4985) actually do.

    This fixes a bug reported by John Stultz here:
    http://lkml.org/lkml/2008/7/15/720
    and by Ingo Molar there:
    http://lkml.org/lkml/2008/7/16/78

    Signed-off-by: Jean Delvare
    Cc: John Stultz
    Cc: Ingo Molnar

    Jean Delvare
     

15 Jul, 2008

12 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
     
  • We call adapter->client_register for both legacy and new-style i2c
    devices, however we only call adapter->client_unregister for legacy
    drivers. This doesn't make much sense. Usually, drivers will undo
    in client_unregister what they did in client_register, so we should
    call neither or both for every given i2c device.

    In order to ease the transition from legacy to new-style devices, it
    seems preferable to actually call both.

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

    Jean Delvare
     
  • Export the root of the i2c bus so that PowerPC device tree code can
    iterate over devices on the i2c bus.

    Signed-off-by: Jon Smirl
    Signed-off-by: Jean Delvare

    Jon Smirl
     
  • i2c_driver.id_table is mandatory now, so we can simplify
    i2c_device_probe() a bit.

    Signed-off-by: Jean Delvare

    Jean Delvare
     
  • i2c_del_driver() can be simplified a bit.

    Signed-off-by: Jean Delvare

    Jean Delvare
     
  • Use list_for_each_entry_safe() in i2c_del_adapter() and i2c_del_driver().

    Signed-off-by: Matthias Kaehlcke
    Signed-off-by: Jean Delvare

    Matthias Kaehlcke
     
  • Defend the i2c refcount calls against NULL pointers, as is important
    (and conventional) for such calls. Note that none of the current
    callers of i2c_use_client() use its return value.

    [JD: I hate this but apparently all the other subsystems do it so...]

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

    David Brownell
     
  • Provide kerneldoc for most of the I2C and SMBus I/O calls. Add a
    comment summarizing some fault reporting issues which affect the
    ability to provide clean fault reports through I2C master transfer
    calls. (Making it hard to precisely specify their return values...)

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

    David Brownell
     
  • 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
     
  • i2c-core doesn't use seq files, so doesn't need to include
    .

    Signed-off-by: Jean Delvare

    Jean Delvare
     
  • Use class_for_each_device for iteration.

    Signed-off-by: Dave Young
    Signed-off-by: Jean Delvare

    Dave Young
     

19 May, 2008

1 commit


12 May, 2008

1 commit

  • As the old driver_name/type matching scheme is going away soon, change
    the dummy device mechanism to use the new matching scheme.

    This has the downside that dummy i2c clients can no longer choose
    their name, they'll all appear as "dummy" in sysfs and in log
    messages. I don't think it is a problem in practice though, as there
    is little reason to use these i2c clients to log messages.

    Signed-off-by: Jean Delvare

    Jean Delvare
     

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
     

23 Apr, 2008

1 commit


19 Apr, 2008

1 commit


24 Mar, 2008

1 commit

  • Sometimes kernel-doc and xmlto conspire to create output that is invalid
    and causes problems. Until I know a real/better solution, change the
    source code that causes this.

    If anyone has better fixes or can just explain what is happening here,
    that would be great.

    xmlto: input does not validate (status 1)
    mmotm-2008-0314-1449/Documentation/DocBook/kernel-api.xml:71468: parser error : Opening and ending tag mismatch: programlisting line 71464 and para

    ^
    mmotm-2008-0314-1449/Documentation/DocBook/kernel-api.xml:71480: parser error : Opening and ending tag mismatch: para line 71473 and programlisting

    ^
    make[1]: *** [Documentation/DocBook/kernel-api.html] Error 1

    Signed-off-by: Randy Dunlap
    Signed-off-by: Jean Delvare

    Randy Dunlap
     

12 Mar, 2008

1 commit


28 Jan, 2008

12 commits

  • This adds a i2c_new_dummy() primitive to help work with devices
    that consume multiple addresses, which include many I2C eeproms
    and at least one RTC.

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

    David Brownell
     
  • It is no longer required to hold adapter->clist_lock to call
    i2c_check_addr.

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

    Jean Delvare
     
  • We only need to hold adapter->clist_lock when we touch the client list.

    Signed-off-by: Jean Delvare

    Jean Delvare
     
  • This goes on top of the patch removing most i2c_adapter.clients usage,
    updating i2c_attach_client:

    - Don't call device_register() while holding clist_lock. This
    removes a self-deadlock when on the i2c_driver.probe() path,
    for drivers that need to attach new devices (e.g. dummies).

    - Remove a redundant address check. The driver model core does
    this as a consequence of guaranteeing unique names.

    - Move the "device registered" diagnostic so that it never lies;
    previously, on error paths it would falsely report success.

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

    David Brownell
     
  • The i2c_adapter.clients list of i2c_client nodes duplicates driver
    model state. This patch starts removing that list, letting us remove
    most existing users of those i2c-core lists.

    * The core I2C code now iterates over the driver model's list instead
    of the i2c-internal one in some places where it's safe:
    - Passing a command/ioctl to each client, a mechanims
    used almost exclusively by DVB adapters;
    - Device address checking, in both i2c-core and i2c-dev.

    * Provide i2c_verify_client() to use with driver model iterators.

    * Flag the relevant i2c_adapter and i2c_client fields as deprecated,
    to help prevent new users from appearing.

    For the moment the list needs to stick around, since some issues show
    up when deleting devices created by legacy I2C drivers. (They don't
    follow standard driver model rules. Removing those devices can cause
    self-deadlocks.)

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

    David Brownell
     
  • Allow i2c_transfer to be called in contexts where sleeping is not allowed.
    It is the reponsability of the caller to ensure that the underlying i2c bus
    driver will not sleep either.

    Signed-off-by: Mike Rapoport
    Signed-off-by: Jean Delvare

    Mike Rapoport
     
  • Rename the main mutex in i2c-core from core_lists to core_lock. This
    makes more sense now that the redundant lists are gone.

    Signed-off-by: Jean Delvare

    Jean Delvare
     
  • i2c_driver.list is superfluous, this list duplicates the one
    maintained by the driver core. Drop it.

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

    Jean Delvare
     
  • i2c_adapter.list is superfluous, this list duplicates the one
    maintained by the driver core. Drop it.

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

    Jean Delvare
     
  • Use more standard prototypes for i2c_use_client() and
    i2c_release_client(). The former now returns a pointer to the client,
    and the latter no longer returns anything. This matches what all other
    subsystems do.

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

    Jean Delvare
     
  • Don't implement our own reference counting mechanism for i2c clients
    when the driver model already has one.

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

    Jean Delvare
     
  • This patch allows much of the I2C client address data to move from initdata
    into text.

    Signed-off-by: Mark M. Hoffman
    Signed-off-by: Jean Delvare

    Mark M. Hoffman
     

16 Nov, 2007

1 commit


20 Oct, 2007

1 commit

  • * Convert files to UTF-8.

    * Also correct some people's names
    (one example is Eißfeldt, which was found in a source file.
    Given that the author used an ß at all in a source file
    indicates that the real name has in fact a 'ß' and not an 'ss',
    which is commonly used as a substitute for 'ß' when limited to
    7bit.)

    * Correct town names (Goettingen -> Göttingen)

    * Update Eberhard Mönkeberg's address (http://lkml.org/lkml/2007/1/8/313)

    Signed-off-by: Jan Engelhardt
    Signed-off-by: Adrian Bunk

    Jan Engelhardt
     

14 Oct, 2007

1 commit

  • This removes:

    - An effectively unused hook: i2c_algorithm.algo_control.

    - The i2c_control() call, used only by i2c-dev to call that
    unused hook or set two barely supported adapter params.

    (That param setting moves into i2c-dev.c ... still iffy
    due to lack of locking, but no other changes.)

    As shown by diffstat, this is a net code shrink. It also reduces the
    complexity of the I2C adapter and /dev interfaces.

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

    David Brownell