Skip to content
Snippets Groups Projects
  1. Jun 12, 2013
    • Sonic Zhang's avatar
      i2c: bfin-twi: Read and write the FIFO in loop · 8419c8de
      Sonic Zhang authored
      
      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: default avatarBob Maris <mail@maris-ee.eu>
      Signed-off-by: default avatarSonic Zhang <sonic.zhang@analog.com>
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      8419c8de
    • Linus Walleij's avatar
      i2c: core: make it possible to match a pure device tree driver · c80f5284
      Linus Walleij authored
      
      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: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      c80f5284
    • Jingoo Han's avatar
      i2c: use platform_{get,set}_drvdata() · c2c64954
      Jingoo Han authored
      
      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: default avatarJingoo Han <jg1.han@samsung.com>
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      c2c64954
    • Wolfram Sang's avatar
      drivers/i2c/busses: don't check resource with devm_ioremap_resource · 3cc2d009
      Wolfram Sang authored
      
      devm_ioremap_resource does sanity checks on the given resource. No need to
      duplicate this in the driver.
      
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      3cc2d009
    • Mika Westerberg's avatar
      i2c: designware: prevent signals from aborting I2C transfers · e42dba56
      Mika Westerberg authored
      
      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: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Reviewed-by: default avatarChristian Ruppert <christian.ruppert@abilis.com>
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      e42dba56
    • Fabio Estevam's avatar
      i2c: mxs: Let device core handle pinctrl · dfda7d8f
      Fabio Estevam authored
      
      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: default avatarFabio Estevam <fabio.estevam@freescale.com>
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      dfda7d8f
    • Fabio Estevam's avatar
      i2c: imx: Let device core handle pinctrl · 76b1f723
      Fabio Estevam authored
      
      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: default avatarFabio Estevam <fabio.estevam@freescale.com>
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      76b1f723
  2. Jun 05, 2013
  3. May 18, 2013
  4. May 17, 2013
    • Alexander Sverdlin's avatar
      i2c: suppress lockdep warning on delete_device · e9b526fe
      Alexander Sverdlin authored
      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: default avatarAlexander Sverdlin <alexander.sverdlin@nsn.com>
      Acked-by: default avatarAlan 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: default avatarWolfram Sang <wsa@the-dreams.de>
      e9b526fe
    • Russell King's avatar
      i2c: mv64xxx: work around signals causing I2C transactions to be aborted · d295a86e
      Russell King authored
      
      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: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      d295a86e
    • Jean Delvare's avatar
      i2c: i801: Document feature bits in modinfo · 53229345
      Jean Delvare authored
      
      Duplicate the feature bits documentation in modinfo, as not every user
      will read the driver's source code or documentation file.
      
      Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      53229345
    • Mika Westerberg's avatar
      i2c: designware: add Intel BayTrail ACPI ID · 5a7e6bd8
      Mika Westerberg authored
      
      This is the same controller as on Intel Lynxpoint but the ACPI ID is
      different (8086F41). Add support for this.
      
      Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      5a7e6bd8
    • Mika Westerberg's avatar
      i2c: designware: always clear interrupts before enabling them · 2a2d95e9
      Mika Westerberg authored
      
      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: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      Cc: stable@kernel.org
      2a2d95e9
    • Josef Ahmad's avatar
      i2c: designware: fix RX FIFO overrun · e6f34cea
      Josef Ahmad authored
      
      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: default avatarJosef Ahmad <josef.ahmad@linux.intel.com>
      Acked-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      Cc: stable@kernel.org
      e6f34cea
  5. Apr 23, 2013
  6. Apr 19, 2013
  7. Apr 17, 2013
  8. Apr 16, 2013
  9. Apr 15, 2013
Loading