1. 20 6月, 2009 33 次提交
  2. 19 6月, 2009 7 次提交
    • H
      i2c: New macro to initialize i2c address lists on the fly · c7036673
      Hans Verkuil 提交于
      For video4linux we sometimes need to probe for a single i2c address.
      Normally you would do it like this:
      
      static const unsigned short addrs[] = {
      	addr, I2C_CLIENT_END
      };
      
      client = i2c_new_probed_device(adapter, &info, addrs);
      
      This is a bit awkward and I came up with this macro:
      
      #define V4L2_I2C_ADDRS(addr, addrs...) \
      	((const unsigned short []){ addr, ## addrs, I2C_CLIENT_END })
      
      This can construct a list of one or more i2c addresses on the fly. But
      this is something that really belongs in i2c.h, renamed to I2C_ADDRS.
      
      With this macro we can just do:
      
      client = i2c_new_probed_device(adapter, &info, I2C_ADDRS(addr));
      
      Note that this can also be used to initialize an array:
      
      static const unsigned short addrs[] = I2C_ADDRS(0x2a, 0x2c);
      
      Whether you want to is another matter, but it works. This functionality is 
      also available in the oldest supported gcc (3.2).
      Signed-off-by: NHans Verkuil <hverkuil@xs4all.nl>
      Signed-off-by: NJean Delvare <khali@linux-fr.org>
      c7036673
    • J
      i2c: Don't advertise i2c functions when not available · 23af8400
      Jean Delvare 提交于
      Surround i2c function declarations with ifdefs, so that they aren't
      advertised when i2c-core isn't actually built. That way, drivers using
      these functions unconditionally will result in an immediate build
      failure, rather than a late linking failure which is harder to figure
      out.
      Signed-off-by: NJean Delvare <khali@linux-fr.org>
      Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
      Cc: Paul Mundt <lethal@linux-sh.org>
      23af8400
    • R
      i2c: Use rwsem instead of mutex for board info · f18c41da
      Rodolfo Giometti 提交于
      By using rwsem we can easily manage recursive calls of
      i2c_scan_static_board_info() function without breaking the locking.
      Signed-off-by: NRodolfo Giometti <giometti@linux.it>
      Signed-off-by: NJean Delvare <khali@linux-fr.org>
      f18c41da
    • J
      i2c: Add a sysfs interface to instantiate devices · 99cd8e25
      Jean Delvare 提交于
      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: NJean Delvare <khali@linux-fr.org>
      Cc: David Brownell <dbrownell@users.sourceforge.net>
      99cd8e25
    • J
      i2c: Limit core locking to the necessary sections · 35fc37f8
      Jean Delvare 提交于
      The i2c-core code tends to hold the core lock for longer than it
      should. Limit locking to the necessary sections for both performance
      and clarity. This is also a requirement to support I2C multiplexers in
      the future.
      Signed-off-by: NJean Delvare <khali@linux-fr.org>
      Tested-by: NRodolfo Giometti <giometti@linux.it>
      Cc: David Brownell <dbrownell@users.sourceforge.net>
      35fc37f8
    • J
      i2c: Kill the redundant client list · e549c2b5
      Jean Delvare 提交于
      We used to maintain our own per-adapter list of i2c clients, but this
      is redundant with what the driver core does, and no longer needed.
      Just drop the redundant list.
      Signed-off-by: NJean Delvare <khali@linux-fr.org>
      Cc: David Brownell <dbrownell@users.sourceforge.net>
      e549c2b5
    • J
      i2c: Kill is_newstyle_driver · 1e40ac12
      Jean Delvare 提交于
      Legacy i2c drivers are gone, all drivers are new-style now, so there
      is no point to check.
      Signed-off-by: NJean Delvare <khali@linux-fr.org>
      Cc: David Brownell <dbrownell@users.sourceforge.net>
      1e40ac12