1. 19 6月, 2013 1 次提交
  2. 16 6月, 2013 1 次提交
    • L
      i2c: nomadik: allocate adapter number dynamically · d15b8575
      Linus Walleij 提交于
      The Nomadik I2C was using a local atomic counter to number
      the I2C adapters. This does not work on configurations where
      you also add, say a GPIO bit-banged adapter to the system.
      They will start to conflict about being adapter 0.
      
      There is no reason to use the numbered adapter function, and
      the semantic effect on systems with only Nomadik I2C blocks
      will be none - instead of increasing the number atomically
      in the driver itself, it is done in the I2C core.
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      d15b8575
  3. 15 6月, 2013 6 次提交
  4. 13 6月, 2013 7 次提交
    • S
      i2c: bfin-twi: Read and write the FIFO in loop · 8419c8de
      Sonic Zhang 提交于
      TWI transfer interrupts may be lost when system is heavily handling other
      interrupts, while current transfer handler depends on each accurate interrupt
      and misses some data in this case. Because there are 2 2-byte FIFOs in blackfin
      TWI controller, the occurrence of the data loss can be reduced by reading till
      the RX FIFO is empty and writing till the TX FIFO is full.
      Reported-by: NBob Maris <mail@maris-ee.eu>
      Signed-off-by: NSonic Zhang <sonic.zhang@analog.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      8419c8de
    • L
      i2c: core: make it possible to match a pure device tree driver · c80f5284
      Linus Walleij 提交于
      This tries to address an issue found when writing an MFD driver
      for the Nomadik STw481x PMICs: as the platform is using device
      tree exclusively I want to specify the driver matching like
      this:
      
      static const struct of_device_id stw481x_match[] = {
      	{ .compatible = "st,stw4810", },
      	{ .compatible = "st,stw4811", },
      	{},
      };
      
      static struct i2c_driver stw481x_driver = {
      	.driver = {
      		.name	= "stw481x",
      		.of_match_table = stw481x_match,
      	},
      	.probe		= stw481x_probe,
      	.remove		= stw481x_remove,
      };
      
      However that turns out not to be possible: the I2C probe code
      is written so that the probe() call is always passed a match
      from i2c_match_id() using non-devicetree matches.
      
      This is probably why most devices using device tree for I2C
      clients currently will pass no .of_match_table *at all* but
      instead just use .id_table from struct i2c_driver to match
      the device. As you realize that means that the whole idea with
      compatible strings is discarded, and that is why we find strange
      device tree I2C device compatible strings like "product" instead
      of "vendor,product" as you could expect.
      
      Let's figure out how to fix this before the mess spreads. This
      patch will allow probeing devices with only an of_match_table
      as per above, and will pass NULL as the second argument to the
      probe() function. If the driver wants to deduce secondary info
      from the struct of_device_id .data field, it has to call
      of_match_device() on its own match table in the probe function
      device tree probe path.
      
      If drivers define both an .of_match_table *AND* a i2c_driver
      .id_table, the .of_match_table will take precedence, just
      as is done in the i2c_device_match() function in i2c-core.c.
      
      I2C devices probed from device tree should subsequently be
      fixed to handle the case where of_match_table() is
      used (I think none of them do that today), and platforms should
      fix their device trees to use compatible strings for I2C devices
      instead of setting the name to Linux device driver names as is
      done in multiple cases today.
      
      Cc: Rob Herring <rob.herring@calxeda.com>
      Cc: Grant Likely <grant.likely@linaro.org>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      c80f5284
    • J
      i2c: use platform_{get,set}_drvdata() · c2c64954
      Jingoo Han 提交于
      Use the wrapper functions for getting and setting the driver data using
      platform_device instead of using dev_{get,set}_drvdata() with &pdev->dev,
      so we can directly pass a struct platform_device.
      Signed-off-by: NJingoo Han <jg1.han@samsung.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      c2c64954
    • W
      drivers/i2c/busses: don't check resource with devm_ioremap_resource · 3cc2d009
      Wolfram Sang 提交于
      devm_ioremap_resource does sanity checks on the given resource. No need to
      duplicate this in the driver.
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      3cc2d009
    • M
      i2c: designware: prevent signals from aborting I2C transfers · e42dba56
      Mika Westerberg 提交于
      If a process receives signal while it is waiting for I2C transfer to
      complete, an error is returned to the caller and the transfer is aborted.
      This can cause the driver to fail subsequent transfers. Also according to
      commit d295a86e (i2c: mv64xxx: work around signals causing I2C
      transactions to be aborted) I2C drivers aren't supposed to abort
      transactions on signals.
      
      To prevent this switch to use wait_for_completion_timeout() instead of
      wait_for_completion_interruptible_timeout() in the designware I2C driver.
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Reviewed-by: NChristian Ruppert <christian.ruppert@abilis.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      e42dba56
    • F
      i2c: mxs: Let device core handle pinctrl · dfda7d8f
      Fabio Estevam 提交于
      Since commit ab78029e (drivers/pinctrl: grab default handles from device core),
      we can rely on device core for handling pinctrl.
      
      So remove devm_pinctrl_get_select_default() from the driver.
      Signed-off-by: NFabio Estevam <fabio.estevam@freescale.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      dfda7d8f
    • F
      i2c: imx: Let device core handle pinctrl · 76b1f723
      Fabio Estevam 提交于
      Since commit ab78029e (drivers/pinctrl: grab default handles from device core),
      we can rely on device core for handling pinctrl.
      
      So remove devm_pinctrl_get_select_default() from the driver.
      Signed-off-by: NFabio Estevam <fabio.estevam@freescale.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      76b1f723
  5. 06 6月, 2013 9 次提交
  6. 18 5月, 2013 5 次提交
    • W
      drivers/i2c/busses: don't check resource with devm_ioremap_resource · 00d083f9
      Wolfram Sang 提交于
      devm_ioremap_resource does sanity checks on the given resource. No need to
      duplicate this in the driver.
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      Acked-by: NStephen Warren <swarren@nvidia.com>
      Acked-by: NBarry Song <Baohua.Song@csr.com>
      00d083f9
    • A
      i2c: suppress lockdep warning on delete_device · e9b526fe
      Alexander Sverdlin 提交于
      i2c: suppress lockdep warning on delete_device
      
      Since commit 846f9974 the following lockdep
      warning is thrown in case i2c device is removed (via delete_device sysfs
      attribute) which contains subdevices (e.g. i2c multiplexer):
      
      =============================================
      [ INFO: possible recursive locking detected ]
      3.8.7-0-sampleversion-fct #8 Tainted: G           O
      ---------------------------------------------
      bash/3743 is trying to acquire lock:
        (s_active#110){++++.+}, at: [<ffffffff802b3048>] sysfs_hash_and_remove+0x58/0xc8
      
      but task is already holding lock:
        (s_active#110){++++.+}, at: [<ffffffff802b3cb8>] sysfs_write_file+0xc8/0x208
      
      other info that might help us debug this:
        Possible unsafe locking scenario:
      
              CPU0
              ----
         lock(s_active#110);
         lock(s_active#110);
      
        *** DEADLOCK ***
      
        May be due to missing lock nesting notation
      
      4 locks held by bash/3743:
        #0:  (&buffer->mutex){+.+.+.}, at: [<ffffffff802b3c3c>] sysfs_write_file+0x4c/0x208
        #1:  (s_active#110){++++.+}, at: [<ffffffff802b3cb8>] sysfs_write_file+0xc8/0x208
        #2:  (&adap->userspace_clients_lock/1){+.+.+.}, at: [<ffffffff80454a18>] i2c_sysfs_delete_device+0x90/0x238
        #3:  (&__lockdep_no_validate__){......}, at: [<ffffffff803dcc24>] device_release_driver+0x24/0x48
      
      stack backtrace:
      Call Trace:
      [<ffffffff80575cc8>] dump_stack+0x8/0x34
      [<ffffffff801b50fc>] __lock_acquire+0x161c/0x2110
      [<ffffffff801b5c3c>] lock_acquire+0x4c/0x70
      [<ffffffff802b60cc>] sysfs_addrm_finish+0x19c/0x1e0
      [<ffffffff802b3048>] sysfs_hash_and_remove+0x58/0xc8
      [<ffffffff802b7d8c>] sysfs_remove_group+0x64/0x148
      [<ffffffff803d990c>] device_remove_attrs+0x9c/0x1a8
      [<ffffffff803d9b1c>] device_del+0x104/0x1d8
      [<ffffffff803d9c18>] device_unregister+0x28/0x70
      [<ffffffff8045505c>] i2c_del_adapter+0x1cc/0x328
      [<ffffffff8045802c>] i2c_del_mux_adapter+0x14/0x38
      [<ffffffffc025c108>] pca954x_remove+0x90/0xe0 [pca954x]
      [<ffffffff804542f8>] i2c_device_remove+0x80/0xe8
      [<ffffffff803dca9c>] __device_release_driver+0x74/0xf8
      [<ffffffff803dcc2c>] device_release_driver+0x2c/0x48
      [<ffffffff803dbc14>] bus_remove_device+0x13c/0x1d8
      [<ffffffff803d9b24>] device_del+0x10c/0x1d8
      [<ffffffff803d9c18>] device_unregister+0x28/0x70
      [<ffffffff80454b08>] i2c_sysfs_delete_device+0x180/0x238
      [<ffffffff802b3cd4>] sysfs_write_file+0xe4/0x208
      [<ffffffff8023ddc4>] vfs_write+0xbc/0x160
      [<ffffffff8023df6c>] SyS_write+0x54/0xd8
      [<ffffffff8013d424>] handle_sys64+0x44/0x64
      
      The problem is already known for USB and PCI subsystems. The reason is that
      delete_device attribute is defined statically in i2c-core.c and used for all
      devices in i2c subsystem.
      
      Discussion of original USB problem:
      http://lkml.indiana.edu/hypermail/linux/kernel/1204.3/01160.html
      
      Commit 356c05d5 introduced new macro to suppress
      lockdep warnings for this special case and included workaround for USB code.
      
      LKML discussion of the workaround:
      http://lkml.indiana.edu/hypermail/linux/kernel/1205.1/03634.html
      
      As i2c case is in principle the same, the same workaround could be used here.
      Signed-off-by: NAlexander Sverdlin <alexander.sverdlin@nsn.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      e9b526fe
    • R
      i2c: mv64xxx: work around signals causing I2C transactions to be aborted · d295a86e
      Russell King 提交于
      Do not use interruptible waits in an I2C driver; if a process uses
      signals (eg, Xorg uses SIGALRM and SIGPIPE) then these signals can
      cause the I2C driver to abort a transaction in progress by another
      driver, which can cause that driver to fail.  I2C drivers are not
      expected to abort transactions on signals.
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      d295a86e
    • J
      i2c: i801: Document feature bits in modinfo · 53229345
      Jean Delvare 提交于
      Duplicate the feature bits documentation in modinfo, as not every user
      will read the driver's source code or documentation file.
      Signed-off-by: NJean Delvare <khali@linux-fr.org>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      53229345
    • M
      i2c: designware: add Intel BayTrail ACPI ID · 5a7e6bd8
      Mika Westerberg 提交于
      This is the same controller as on Intel Lynxpoint but the ACPI ID is
      different (8086F41). Add support for this.
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      5a7e6bd8
  7. 17 5月, 2013 2 次提交
    • M
      i2c: designware: always clear interrupts before enabling them · 2a2d95e9
      Mika Westerberg 提交于
      If the I2C bus is put to a low power state by an ACPI method it might pull
      the SDA line low (as its power is removed). Once the bus is put to full
      power state again, the SDA line is pulled back to high. This transition
      looks like a STOP condition from the controller point-of-view which sets
      STOP detected bit in its status register causing the driver to fail
      subsequent transfers.
      
      Fix this by always clearing all interrupts before we start a transfer.
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      Cc: stable@kernel.org
      2a2d95e9
    • J
      i2c: designware: fix RX FIFO overrun · e6f34cea
      Josef Ahmad 提交于
      i2c_dw_xfer_msg() pushes a number of bytes to transmit/receive
      to/from the bus into the TX FIFO.
      For master-rx transactions, the maximum amount of data that can be
      received is calculated depending solely on TX and RX FIFO load.
      
      This is racy - TX FIFO may contain master-rx data yet to be
      processed, which will eventually land into the RX FIFO. This
      data is not taken into account and the function may request more
      data than the controller is actually capable of storing.
      
      This patch ensures the driver takes into account the outstanding
      master-rx data in TX FIFO to prevent RX FIFO overrun.
      Signed-off-by: NJosef Ahmad <josef.ahmad@linux.intel.com>
      Acked-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      Cc: stable@kernel.org
      e6f34cea
  8. 24 4月, 2013 2 次提交
  9. 20 4月, 2013 4 次提交
  10. 17 4月, 2013 1 次提交
  11. 16 4月, 2013 2 次提交