1. 24 8月, 2015 2 次提交
  2. 10 8月, 2015 1 次提交
    • V
      i2c: core: add and export of_get_i2c_adapter_by_node() interface · 48e9743d
      Vladimir Zapolskiy 提交于
      of_find_i2c_adapter_by_node() call requires quite often missing
      put_device(), and i2c_put_adapter() releases a device locked by
      i2c_get_adapter() only. In general module_put(adapter->owner) and
      put_device(dev) are not interchangeable.
      
      This is a common error reproduction scenario as a result of the
      misusage described above (for clearness this is run on iMX6 platform
      with HDMI and I2C bus drivers compiled as kernel modules):
      
          root@mx6q:~# lsmod | grep i2c
          i2c_imx                10213  0
          root@mx6q:~# lsmod | grep dw_hdmi_imx
          dw_hdmi_imx             3631  0
          dw_hdmi                11846  1 dw_hdmi_imx
          imxdrm                  8674  3 dw_hdmi_imx,imx_ipuv3_crtc,imx_ldb
          drm_kms_helper        113765  5 dw_hdmi,imxdrm,imx_ipuv3_crtc,imx_ldb
          root@mx6q:~# rmmod dw_hdmi_imx
          root@mx6q:~# lsmod | grep i2c
          i2c_imx                10213  -1
      
                                       ^^^^^
      
          root@mx6q:~# rmmod i2c_imx
          rmmod: ERROR: Module i2c_imx is in use
      
      To fix existing users of these interfaces and to avoid any further
      confusion and misusage in future, add one more interface
      of_get_i2c_adapter_by_node(), it is similar to i2c_get_adapter() in
      sense that an I2C bus device driver found and locked by user can be
      correctly unlocked by i2c_put_adapter().
      Signed-off-by: NVladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      48e9743d
  3. 10 4月, 2015 1 次提交
  4. 27 3月, 2015 1 次提交
  5. 17 3月, 2015 1 次提交
  6. 13 3月, 2015 1 次提交
  7. 27 1月, 2015 1 次提交
  8. 23 12月, 2014 1 次提交
    • L
      i2c: Remove support for legacy PM · 523c5b89
      Lars-Peter Clausen 提交于
      There haven't been any I2C driver that use the legacy suspend/resume
      callbacks for a while now and new drivers are supposed to use PM ops. So
      remove support for legacy suspend/resume for I2C drivers.
      
      Since there aren't any special bus specific things to do during
      suspend/resume and since the PM core will automatically fallback directly to
      using the device's PM ops if no bus PM ops are specified there is no need to
      have any I2C bus PM ops.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      523c5b89
  9. 12 12月, 2014 1 次提交
  10. 04 11月, 2014 1 次提交
  11. 25 9月, 2014 1 次提交
  12. 19 8月, 2014 1 次提交
  13. 27 6月, 2014 2 次提交
    • L
      I2C/ACPI: Clean up I2C ACPI code and Add CONFIG_I2C_ACPI config · da3c6647
      Lan Tianyu 提交于
      Clean up ACPI related code in the i2c core and add CONFIG_I2C_ACPI
      to enable I2C ACPI code.
      
      Current there is a race between removing I2C ACPI operation region
      and ACPI AML code accessing. So make i2c core built-in if CONFIG_I2C_ACPI
      is set.
      Reviewed-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NLan Tianyu <tianyu.lan@intel.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      da3c6647
    • L
      I2C/ACPI: Add i2c ACPI operation region support · 5d98e61d
      Lan Tianyu 提交于
      ACPI 5.0 spec(5.5.2.4.5) defines GenericSerialBus(i2c, spi, uart) operation region.
      It allows ACPI aml code able to access such kind of devices to implement
      some ACPI standard method.
      
      ACPI Spec defines some access attribute to associate with i2c protocol.
      AttribQuick 	       	       		Read/Write Quick Protocol
      AttribSendReceive			Send/Receive Byte Protocol
      AttribByte 			 	Read/Write Byte Protocol
      AttribWord				Read/Write Word Protocol
      AttribBlock				Read/Write Block Protocol
      AttribBytes				Read/Write N-Bytes Protocol
      AttribProcessCall			Process Call Protocol
      AttribBlockProcessCall			Write Block-Read Block Process Call Protocol
      AttribRawBytes 				Raw Read/Write N-BytesProtocol
      AttribRawProcessBytes			Raw Process Call Protocol
      
      On the Asus T100TA, Bios use GenericSerialBus operation region to access
      i2c device to get battery info.
      
      Sample code From Asus T100TA
      
          Scope (_SB.I2C1)
          {
              Name (UMPC, ResourceTemplate ()
              {
                  I2cSerialBus (0x0066, ControllerInitiated, 0x00061A80,
                      AddressingMode7Bit, "\\_SB.I2C1",
                      0x00, ResourceConsumer, ,
                      )
              })
      
      	...
      
              OperationRegion (DVUM, GenericSerialBus, Zero, 0x0100)
              Field (DVUM, BufferAcc, NoLock, Preserve)
              {
                  Connection (UMPC),
                  Offset (0x81),
                  AccessAs (BufferAcc, AttribBytes (0x3E)),
                  FGC0,   8
              }
      	...
           }
      
           Device (BATC)
           {
               Name (_HID, EisaId ("PNP0C0A"))  // _HID: Hardware ID
               Name (_UID, One)  // _UID: Unique ID
      	 ...
      
                  Method (_BST, 0, NotSerialized)  // _BST: Battery Status
                  {
                      If (LEqual (AVBL, One))
                      {
                          Store (FGC0, BFFG)
                          If (LNotEqual (STAT, One))
                          {
                              ShiftRight (CHST, 0x04, Local0)
                              And (Local0, 0x03, Local0)
                              If (LOr (LEqual (Local0, One), LEqual (Local0, 0x02)))
                              {
                                  Store (0x02, Local1)
                              }
      	...
      
          }
      
      The i2c operation region is defined under I2C1 scope. _BST method under
      battery device BATC read battery status from the field "FCG0". The request
      would be sent to i2c operation region handler.
      
      This patch is to add i2c ACPI operation region support. Due to there are
      only "Byte" and "Bytes" protocol access on the Asus T100TA, other protocols
      have not been tested.
      
      About RawBytes and RawProcessBytes protocol, they needs specific drivers to interpret
      reference data from AML code according ACPI 5.0 SPEC(5.5.2.4.5.3.9 and 5.5.2.4.5.3.10).
      So far, not found such case and will add when find real case.
      Signed-off-by: NLan Tianyu <tianyu.lan@intel.com>
      Reviewed-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      5d98e61d
  14. 06 3月, 2014 1 次提交
    • W
      i2c: add deprecation warning for class based instantiation · 0c176170
      Wolfram Sang 提交于
      Class based instantiation can cause noticeable delays when booting. This
      mechanism is used when it is not possible to describe slaves on I2C
      busses. As we do have other mechanisms, most embedded I2C will not need
      classes and for embedded it is explicitly not recommended to use them. Add
      a deprecation warning for drivers which want to disable class based
      instantiation in the near future to gain boot-up time, so users relying
      on this technique can switch to something better. They really should.
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      0c176170
  15. 27 1月, 2014 1 次提交
  16. 15 1月, 2014 1 次提交
    • S
      i2c: Re-instate body of i2c_parent_is_i2c_adapter() · 2fac2b89
      Stephen Warren 提交于
      The body of i2c_parent_is_i2c_adapter() is currently guarded by
      I2C_MUX. It should be CONFIG_I2C_MUX instead.
      
      Among potentially other problems, this resulted in i2c_lock_adapter()
      only locking I2C mux child adapters, and not the parent adapter. In
      turn, this could allow inter-mingling of mux child selection and I2C
      transactions, which could result in I2C transactions being directed to
      the wrong I2C bus, and possibly even switching between busses in the
      middle of a transaction.
      
      One concrete issue caused by this bug was corrupted HDMI EDID reads
      during boot on the NVIDIA Tegra Seaboard system, although this only
      became apparent in recent linux-next, when the boot timing was changed
      just enough to trigger the race condition.
      
      Fixes: 3923172b ("i2c: reduce parent checking to a NOOP in non-I2C_MUX case")
      Cc: Phil Carmody <phil.carmody@partner.samsung.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NStephen Warren <swarren@nvidia.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      2fac2b89
  17. 04 10月, 2013 1 次提交
    • L
      i2c: Remove redundant 'driver' field from the i2c_client struct · 0acc2b32
      Lars-Peter Clausen 提交于
      The 'driver' field of the i2c_client struct is redundant. The same data can be
      accessed through to_i2c_driver(client->dev.driver). The generated code for both
      approaches in more or less the same.
      
      E.g. on ARM the expression client->driver->command(...) generates
      
      		...
      		ldr     r3, [r0, #28]
      		ldr     r3, [r3, #32]
      		blx     r3
      		...
      
      and the expression to_i2c_driver(client->dev.driver)->command(...) generates
      
      		...
      		ldr     r3, [r0, #160]
          	ldr     r3, [r3, #-4]
          	blx     r3
      		...
      
      Other architectures will generate similar code.
      
      All users of the 'driver' field outside of the I2C core have already been
      converted. So this only leaves the core itself. This patch converts the
      remaining few users in the I2C core and then removes the 'driver' field from the
      i2c_client struct.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      0acc2b32
  18. 23 8月, 2013 2 次提交
  19. 07 8月, 2013 1 次提交
  20. 02 4月, 2013 2 次提交
    • L
      i2c: Make return type of i2c_del_adapter() void · 71546300
      Lars-Peter Clausen 提交于
      i2c_del_adapter() is usually called from a drivers remove callback. The Linux
      device driver model does not allow the remove callback to fail and all resources
      allocated in the probe callback need to be freed, as well as all resources which
      have been provided to the rest of the kernel(for example a I2C adapter) need to
      be revoked. So any function revoking such resources isn't allowed to fail
      either. i2c_del_adapter() adheres to this requirement and will never fail. But
      i2c_del_adapter()'s return type is int, which may cause driver authors to think
      that it can fail. This led to code constructs like:
      
      	ret = i2c_del_adapter(...);
      	BUG_ON(ret);
      
      Since i2c_del_adapter() always returns 0 the BUG_ON is never hit and essentially
      becomes dead code, which means it can be removed. Making the return type of
      i2c_del_adapter() void makes it explicit that the function will never fail and
      should prevent constructs like the above from re-appearing in the kernel code.
      
      All callers of i2c_del_adapter() have already been updated in a previous patch
      to ignore the return value, so the conversion of the return type from int to
      void can be done without causing any build failures.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Reviewed-by: NJean Delvare <khali@linux-fr.org>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      71546300
    • L
      i2c: Remove detach_adapter · 19baba4c
      Lars-Peter Clausen 提交于
      The detach_adapter callback has been deprecated for quite some time and has no
      user left. Keeping it alive blocks other cleanups, so remove it.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Reviewed-by: NJean Delvare <khali@linux-fr.org>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      19baba4c
  21. 24 3月, 2013 1 次提交
    • V
      i2c: Add bus recovery infrastructure · 5f9296ba
      Viresh Kumar 提交于
      Add i2c bus recovery infrastructure to i2c adapters as specified in the i2c
      protocol Rev. 03 section 3.1.16 titled "Bus clear".
      
      http://www.nxp.com/documents/user_manual/UM10204.pdf
      
      Sometimes during operation i2c bus hangs and we need to give dummy clocks to
      slave device to start the transfer again. Now we may have capability in the bus
      controller to generate these clocks or platform may have gpio pins which can be
      toggled to generate dummy clocks. This patch supports both.
      
      This patch also adds in generic bus recovery routines gpio or scl line based
      which can be used by bus controller. In addition controller driver may provide
      its own version of the bus recovery routine.
      
      This doesn't support multi-master recovery for now.
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      [wsa: changed gpio type to int and minor reformatting]
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      5f9296ba
  22. 23 11月, 2012 1 次提交
  23. 13 10月, 2012 1 次提交
  24. 06 10月, 2012 1 次提交
  25. 24 7月, 2012 1 次提交
  26. 30 6月, 2012 1 次提交
    • J
      [media] i2c: Export an unlocked flavor of i2c_transfer · b37d2a3a
      Jean Delvare 提交于
      Some drivers (in particular for TV cards) need exclusive access to
      their I2C buses for specific operations. Export an unlocked flavor
      of i2c_transfer to give them full control.
      
      The unlocked flavor has the following limitations:
      * Obviously, caller must hold the i2c adapter lock.
      * No debug messages are logged. We don't want to log messages while
        holding a rt_mutex.
      * No check is done on the existence of adap->algo->master_xfer. It
        is thus the caller's responsibility to ensure that the function is
        OK to call.
      Signed-off-by: NJean Delvare <khali@linux-fr.org>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
      b37d2a3a
  27. 30 5月, 2012 1 次提交
  28. 12 5月, 2012 1 次提交
  29. 27 3月, 2012 1 次提交
  30. 23 11月, 2011 1 次提交
  31. 18 11月, 2011 1 次提交
  32. 01 11月, 2011 2 次提交
    • P
      include: replace linux/module.h with "struct module" wherever possible · de477254
      Paul Gortmaker 提交于
      The <linux/module.h> pretty much brings in the kitchen sink along
      with it, so it should be avoided wherever reasonably possible in
      terms of being included from other commonly used <linux/something.h>
      files, as it results in a measureable increase on compile times.
      
      The worst culprit was probably device.h since it is used everywhere.
      This file also had an implicit dependency/usage of mutex.h which was
      masked by module.h, and is also fixed here at the same time.
      
      There are over a dozen other headers that simply declare the
      struct instead of pulling in the whole file, so follow their lead
      and simply make it a few more.
      
      Most of the implicit dependencies on module.h being present by
      these headers pulling it in have been now weeded out, so we can
      finally make this change with hopefully minimal breakage.
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      de477254
    • P
      include: convert various register fcns to macros to avoid include chaining · eb5589a8
      Paul Gortmaker 提交于
      The original implementations reference THIS_MODULE in an inline.
      We could include <linux/export.h>, but it is better to avoid chaining.
      
      Fortunately someone else already thought of this, and made a similar
      inline into a #define in <linux/device.h> for device_schedule_callback(),
      [see commit 523ded71] so follow that precedent here.
      
      Also bubble up any __must_check that were used on the prev. wrapper inline
      functions up one to the real __register functions, to preserve any prev.
      sanity checks that were used in those instances.
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      eb5589a8
  33. 30 10月, 2011 1 次提交
  34. 26 5月, 2011 1 次提交
  35. 20 3月, 2011 1 次提交