1. 20 7月, 2007 1 次提交
  2. 12 7月, 2007 3 次提交
    • J
      i2c: Fix the i2c_smbus_read_i2c_block_data() prototype · 4b2643d7
      Jean Delvare 提交于
      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: NJean Delvare <khali@linux-fr.org>
      4b2643d7
    • M
      i2c: Fix sparse warning in i2c.h · d75d53cd
      Mark M. Hoffman 提交于
      Kill a sparse warning by un-nesting two container_of() calls.
      Signed-off-by: NMark M. Hoffman <mhoffman@lightlink.com>
      Signed-off-by: NJean Delvare <khali@linux-fr.org>
      d75d53cd
    • D
      i2c: Add kernel documentation · d64f73be
      David Brownell 提交于
      Generate I2C kerneldoc; fix various glitches and add "context" sections to
      that documentation.  Most I2C and SMBus functions still have no kerneldoc.
      
      Let me suggest providing kerneldoc for all the i2c_smbus_*() functions as
      a small and mostly self-contained project for anyone so inclined.  :)
      Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: NJean Delvare <khali@linux-fr.org>
      d64f73be
  3. 02 5月, 2007 13 次提交
    • J
      i2c: Restore i2c_smbus_read_block_data · b86a1bc8
      Jean Delvare 提交于
      Add back the i2c_smbus_read_block_data helper function, it is needed
      by the upcoming lm93 hardware monitoring driver and possibly others.
      Signed-off-by: NJean Delvare <khali@linux-fr.org>
      b86a1bc8
    • J
      i2c: Make i2c_del_driver a void function · b3e82096
      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: NJean Delvare <khali@linux-fr.org>
      b3e82096
    • J
      i2c: Move i2c-isa-only exported symbol declarations · a97f1ed0
      Jean Delvare 提交于
      Move the declaration of i2c-isa-only exported symbols to i2c-isa
      itself, that's the best way to ensure nobody will attempt to use them.
      Hopefully we'll get rid of the exports themselves soon anyway.
      Signed-off-by: NJean Delvare <khali@linux-fr.org>
      a97f1ed0
    • J
      i2c: Add i2c_new_probed_device() · 12b5053a
      Jean Delvare 提交于
      Add a new helper function to instantiate an i2c device. It is meant as a
      replacement for i2c_new_device() when you don't know for sure at which
      address your I2C/SMBus device lives. This happens frequently on TV
      adapters for example, you know there is a tuner chip on the bus, but
      depending on the exact board model and revision, it can live at different
      addresses. So, the new i2c_new_probed_device() function will probe the bus
      according to a list of addresses, and as soon as one of these addresses
      responds, it will call i2c_new_device() on that one address.
      
      This function will make it possible to port the old i2c drivers to the
      new model quickly.
      Signed-off-by: NJean Delvare <khali@linux-fr.org>
      12b5053a
    • D
      i2c: Add i2c_add_numbered_adapter() · 6e13e641
      David Brownell 提交于
      This adds a call, i2c_add_numbered_adapter(), registering an I2C adapter
      with a specific bus number and then creating I2C device nodes for any
      pre-declared devices on that bus.  It builds on previous patches adding
      I2C probe() and remove() support, and that pre-declaration of devices.
      
      This completes the core support for "new style" I2C device drivers.
      Those follow the standard driver model for binding devices to drivers
      (using probe and remove methods) rather than a legacy model (where the
      driver tries to autoconfigure each bus, and registers devices itself).
      Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: NJean Delvare <khali@linux-fr.org>
      6e13e641
    • D
      i2c: Add i2c_board_info and i2c_new_device() · 9c1600ed
      David Brownell 提交于
      This provides partial support for new-style I2C driver binding.  It builds
      on "struct i2c_board_info" declarations that identify I2C devices on a given
      board.  This is needed on systems with I2C devices that can't be fully probed
      and/or autoconfigured, such as many embedded Linux configurations where the
      way a given I2C device is wired may affect how it must be used.
      
      There are two models for declaring such devices:
      
       * LATE -- using a public function i2c_new_device().  This lets modules
         declare I2C devices found *AFTER* a given I2C adapter becomes available.
         
         For example, a PCI card could create adapters giving access to utility
         chips on that card, and this would be used to associate those chips with
         those adapters.
      
       * EARLY -- from arch_initcall() level code, using a non-exported function
         i2c_register_board_info().  This copies the declarations *BEFORE* such
         an i2c_adapter becomes available, arranging that i2c_new_device() will
         be called later when i2c-core registers the relevant i2c_adapter.
      
         For example, arch/.../.../board-*.c files would declare the I2C devices
         along with their platform data, and I2C devices would behave much like
         PNPACPI devices.  (That is, both enumerate from board-specific tables.)
      
      To match the exported i2c_new_device(), the previously-private function
      i2c_unregister_device() is now exported.
      
      Pending later patches using these new APIs, this is effectively a NOP.
      Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: NJean Delvare <khali@linux-fr.org>
      9c1600ed
    • D
      i2c: i2c stack can remove() · a1d9e6e4
      David Brownell 提交于
      More update for new style driver support:  add a remove() method, and
      use it in the relevant code paths.
      
      Again, nothing will use this yet since there's nothing to create devices
      feeding this infrastructure.
      Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: NJean Delvare <khali@linux-fr.org>
      a1d9e6e4
    • D
      i2c: i2c stack can probe() · 7b4fbc50
      David Brownell 提交于
      One of a series of I2C infrastructure updates to support enumeration using
      the standard Linux driver model.
      
      This patch updates probe() and associated hotplug/coldplug support, but
      not remove().  Nothing yet _uses_ it to create I2C devices, so those
      hotplug/coldplug mechanisms will be the only externally visible change.
      This patch will be an overall NOP since the I2C stack doesn't yet create
      clients/devices except as part of binding them to legacy drivers.
      
      Some code is moved earlier in the source code, helping group more of the
      per-device infrastructure in one place and simplifying handling per-device
      attributes.
      
      Terminology being adopted:  "legacy drivers" create devices (i2c_client)
      themselves, while "new style" ones follow the driver model (the i2c_client
      is handed to the probe routine).  It's an either/or thing; the two models
      don't mix, and drivers that try mixing them won't even be registered.
      Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: NJean Delvare <khali@linux-fr.org>
      7b4fbc50
    • J
      i2c: Emulate SMBus block read over I2C · 209d27c3
      Jean Delvare 提交于
      Let the I2C bus drivers emulate the SMBus Block Read and Block Process
      Call transactions if they wish. This requires to define a new message
      flag, which i2c-core will use to let the underlying I2C bus driver
      know that the first received byte will specify the length of the read
      message.
      Signed-off-by: NJean Delvare <khali@linux-fr.org>
      209d27c3
    • D
      i2c: Rename dev_to_i2c_adapter() · ef2c8321
      David Brownell 提交于
      Rename dev_to_i2c_adapter() as to_i2c_adapter(), since the previous
      syntax was a surprising and needless difference from normal naming
      conventions in Linux.
      Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: NJean Delvare <khali@linux-fr.org>
      ef2c8321
    • D
      i2c: Shrink struct i2c_client · 2096b956
      David Brownell 提交于
      This shrinks the size of "struct i2c_client" by 40 bytes:
      
       - Substantially shrinks the string used to identify the chip type
       - The "flags" don't need to be so big
       - Removes some internal padding
      
      It also adds kerneldoc for that struct, explaining how "name" is really a
      chip type identifier; it's otherwise potentially confusing.
      
      Because the I2C_NAME_SIZE symbol was abused for both i2c_client.name
      and for i2c_adapter.name, this needed to affect i2c_adapter too.  The
      adapters which used that symbol now use the more-obviously-correct
      idiom of taking the size of that field.
      
      JD: Shorten i2c_adapter.name from 50 to 48 bytes while we're here, to
      avoid wasting space in padding.
      Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: NJean Delvare <khali@linux-fr.org>
      2096b956
    • J
      i2c: i2c_adapter devices need no driver · b31366f4
      Jean Delvare 提交于
      Kill i2c_adapter_driver as it doesn't make sense and it prevents
      further i2c-core cleanups. i2c_adapter devices are virtual devices
      (ex-class devices) and as such they don't need a driver.
      Signed-off-by: NJean Delvare <khali@linux-fr.org>
      b31366f4
    • J
      i2c: Kill i2c_adapter.class_dev · fccb56e4
      Jean Delvare 提交于
      Kill i2c_adapter.class_dev. Instead, set the class of i2c_adapter.dev
      to i2c_adapter_class, so that a symlink will be created for every
      i2c_adapter in /sys/class/i2c-adapter.
      
      The same change must be mirrored to i2c-isa as it duplicates some
      of the i2c-core functionalities.
      
      User-space tools and libraries might need some adjustments. In
      particular, libsensors from lm_sensors 2.10.3 or later is required for
      proper discovery of i2c adapter names after this change.
      Signed-off-by: NJean Delvare <khali@linux-fr.org>
      fccb56e4
  4. 14 2月, 2007 1 次提交
    • D
      i2c: Add driver suspend/resume/shutdown support · f37dd80a
      David Brownell 提交于
      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: NDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: NJean Delvare <khali@linux-fr.org>
      f37dd80a
  5. 11 12月, 2006 2 次提交
  6. 27 9月, 2006 2 次提交
  7. 13 7月, 2006 1 次提交
  8. 23 6月, 2006 1 次提交
  9. 25 4月, 2006 1 次提交
  10. 24 3月, 2006 1 次提交
  11. 07 2月, 2006 1 次提交
  12. 06 1月, 2006 9 次提交
  13. 31 10月, 2005 1 次提交
    • T
      [PATCH] fix missing includes · 4e57b681
      Tim Schmielau 提交于
      I recently picked up my older work to remove unnecessary #includes of
      sched.h, starting from a patch by Dave Jones to not include sched.h
      from module.h. This reduces the number of indirect includes of sched.h
      by ~300. Another ~400 pointless direct includes can be removed after
      this disentangling (patch to follow later).
      However, quite a few indirect includes need to be fixed up for this.
      
      In order to feed the patches through -mm with as little disturbance as
      possible, I've split out the fixes I accumulated up to now (complete for
      i386 and x86_64, more archs to follow later) and post them before the real
      patch.  This way this large part of the patch is kept simple with only
      adding #includes, and all hunks are independent of each other.  So if any
      hunk rejects or gets in the way of other patches, just drop it.  My scripts
      will pick it up again in the next round.
      Signed-off-by: NTim Schmielau <tim@physik3.uni-rostock.de>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      4e57b681
  14. 29 10月, 2005 3 次提交
    • G
      [PATCH] I2C: add i2c module alias for i2c drivers to use · a9d1b24d
      Greg Kroah-Hartman 提交于
      This is the start of adding hotplug-like support for i2c devices.
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      a9d1b24d
    • J
      [PATCH] i2c: SMBus PEC support rewrite, 3 of 3 · 585b3160
      Jean Delvare 提交于
      The new SMBus PEC implementation doesn't support PEC emulation on
      non-PEC non-I2C SMBus masters, so we can drop all related code.
      Signed-off-by: NJean Delvare <khali@linux-fr.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      585b3160
    • J
      [PATCH] i2c: SMBus PEC support rewrite, 2 of 3 · 421ef47b
      Jean Delvare 提交于
      This is my rewrite of the SMBus PEC support. The original
      implementation was known to have bugs (credits go to Hideki Iwamoto
      for reporting many of them recently), and was incomplete due to a
      conceptual limitation.
      
      The rewrite affects only software PEC. Hardware PEC needs very little
      code and is mostly untouched.
      
      Technically, both implementations differ in that the original one
      was emulating PEC in software by modifying the contents of an
      i2c_smbus_data union (changing the transaction to a different type),
      while the new one works one level lower, on i2c_msg structures (working
      on message contents). Due to the definition of the i2c_smbus_data union,
      not all SMBus transactions could be handled (at least not without
      changing the definition of this union, which would break user-space
      compatibility), and those which could had to be implemented
      individually. At the opposite, adding PEC to an i2c_msg structure
      can be done on any SMBus transaction with common code.
      
      Advantages of the new implementation:
      
      * It's about twice as small (from ~136 lines before to ~70 now, only
        counting i2c-core, including blank and comment lines). The memory
        used by i2c-core is down by ~640 bytes (~3.5%).
      
      * Easier to validate, less tricky code. The code being common to all
        transactions by design, the risk that a bug can stay uncovered is
        lower.
      
      * All SMBus transactions have PEC support in I2C emulation mode
        (providing the non-PEC transaction is also implemented). Transactions
        which have no emulation code right now will get PEC support for free
        when they finally get implemented.
      
      * Allows for code simplifications in header files and bus drivers
        (patch follows).
      
      Drawbacks (I guess there had to be at least one):
      
      * PEC emulation for non-PEC capable non-I2C SMBus masters was dropped.
        It was based on SMBus tricks and doesn't quite fit in the new design.
        I don't think it's really a problem, as the benefit was certainly
        not worth the additional complexity, but it's only fair that I at
        least mention it.
      
      Lastly, let's note that the new implementation does slightly affect
      compatibility (both in kernel and user-space), but doesn't actually
      break it. Some defines will be dropped, but the code can always be
      changed in a way that will work with both the old and the new
      implementations. It shouldn't be a problem as there doesn't seem to be
      many users of SMBus PEC to date anyway.
      Signed-off-by: NJean Delvare <khali@linux-fr.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      421ef47b