1. 25 4月, 2020 1 次提交
  2. 16 4月, 2020 2 次提交
  3. 15 4月, 2020 3 次提交
    • W
      i2c: remove i2c_new_probed_device API · 3c1d1613
      Wolfram Sang 提交于
      All in-tree users have been converted to the new i2c_new_scanned_device
      function, so remove this deprecated one.
      Signed-off-by: NWolfram Sang <wsa+renesas@sang-engineering.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      3c1d1613
    • W
      i2c: altera: use proper variable to hold errno · edb2c9dd
      Wolfram Sang 提交于
      device_property_read_u32() returns errno or 0, so we should use the
      integer variable 'ret' and not the u32 'val' to hold the retval.
      
      Fixes: 0560ad57 ("i2c: altera: Add Altera I2C Controller driver")
      Signed-off-by: NWolfram Sang <wsa+renesas@sang-engineering.com>
      Reviewed-by: NThor Thayer <thor.thayer@linux.intel.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      edb2c9dd
    • H
      i2c: designware: platdrv: Remove DPM_FLAG_SMART_SUSPEND flag on BYT and CHT · d79294d0
      Hans de Goede 提交于
      We already set DPM_FLAG_SMART_PREPARE, so we completely skip all
      callbacks (other then prepare) where possible, quoting from
      dw_i2c_plat_prepare():
      
              /*
               * If the ACPI companion device object is present for this device, it
               * may be accessed during suspend and resume of other devices via I2C
               * operation regions, so tell the PM core and middle layers to avoid
               * skipping system suspend/resume callbacks for it in that case.
               */
              return !has_acpi_companion(dev);
      
      Also setting the DPM_FLAG_SMART_SUSPEND will cause acpi_subsys_suspend()
      to leave the controller runtime-suspended even if dw_i2c_plat_prepare()
      returned 0.
      
      Leaving the controller runtime-suspended normally, when the I2C controller
      is suspended during the suspend_late phase, is not an issue because
      the pm_runtime_get_sync() done by i2c_dw_xfer() will (runtime-)resume it.
      
      But for dw I2C controllers on Bay- and Cherry-Trail devices acpi_lpss.c
      leaves the controller alive until the suspend_noirq phase, because it may
      be used by the _PS3 ACPI methods of PCI devices and PCI devices are left
      powered on until the suspend_noirq phase.
      
      Between the suspend_late and resume_early phases runtime-pm is disabled.
      So for any ACPI I2C OPRegion accesses done after the suspend_late phase,
      the pm_runtime_get_sync() done by i2c_dw_xfer() is a no-op and the
      controller is left runtime-suspended.
      
      i2c_dw_xfer() has a check to catch this condition (rather then waiting
      for the I2C transfer to timeout because the controller is suspended).
      acpi_subsys_suspend() leaving the controller runtime-suspended in
      combination with an ACPI I2C OPRegion access done after the suspend_late
      phase triggers this check, leading to the following error being logged
      on a Bay Trail based Lenovo Thinkpad 8 tablet:
      
      [   93.275882] i2c_designware 80860F41:00: Transfer while suspended
      [   93.275993] WARNING: CPU: 0 PID: 412 at drivers/i2c/busses/i2c-designware-master.c:429 i2c_dw_xfer+0x239/0x280
      ...
      [   93.276252] Workqueue: kacpi_notify acpi_os_execute_deferred
      [   93.276267] RIP: 0010:i2c_dw_xfer+0x239/0x280
      ...
      [   93.276340] Call Trace:
      [   93.276366]  __i2c_transfer+0x121/0x520
      [   93.276379]  i2c_transfer+0x4c/0x100
      [   93.276392]  i2c_acpi_space_handler+0x219/0x510
      [   93.276408]  ? up+0x40/0x60
      [   93.276419]  ? i2c_acpi_notify+0x130/0x130
      [   93.276433]  acpi_ev_address_space_dispatch+0x1e1/0x252
      ...
      
      So since on BYT and CHT platforms we want ACPI I2c OPRegion accesses
      to work until the suspend_noirq phase, we need the controller to be
      runtime-resumed during the suspend phase if it is runtime-suspended
      suspended at that time. This means that we must not set the
      DPM_FLAG_SMART_SUSPEND on these platforms.
      
      On BYT and CHT we already have a special ACCESS_NO_IRQ_SUSPEND flag
      to make sure the controller stays functional until the suspend_noirq
      phase. This commit makes the driver not set the DPM_FLAG_SMART_SUSPEND
      flag when that flag is set.
      
      Cc: stable@vger.kernel.org
      Fixes: b30f2f65 ("i2c: designware: Set IRQF_NO_SUSPEND flag for all BYT and CHT controllers")
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Acked-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NJarkko Nikula <jarkko.nikula@linux.intel.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      d79294d0
  4. 31 3月, 2020 1 次提交
  5. 28 3月, 2020 2 次提交
  6. 25 3月, 2020 7 次提交
  7. 23 3月, 2020 2 次提交
  8. 22 3月, 2020 4 次提交
  9. 21 3月, 2020 1 次提交
    • K
      i2c: dev: Fix the race between the release of i2c_dev and cdev · 1413ef63
      Kevin Hao 提交于
      The struct cdev is embedded in the struct i2c_dev. In the current code,
      we would free the i2c_dev struct directly in put_i2c_dev(), but the
      cdev is manged by a kobject, and the release of it is not predictable.
      So it is very possible that the i2c_dev is freed before the cdev is
      entirely released. We can easily get the following call trace with
      CONFIG_DEBUG_KOBJECT_RELEASE and CONFIG_DEBUG_OBJECTS_TIMERS enabled.
        ODEBUG: free active (active state 0) object type: timer_list hint: delayed_work_timer_fn+0x0/0x38
        WARNING: CPU: 19 PID: 1 at lib/debugobjects.c:325 debug_print_object+0xb0/0xf0
        Modules linked in:
        CPU: 19 PID: 1 Comm: swapper/0 Tainted: G        W         5.2.20-yocto-standard+ #120
        Hardware name: Marvell OcteonTX CN96XX board (DT)
        pstate: 80c00089 (Nzcv daIf +PAN +UAO)
        pc : debug_print_object+0xb0/0xf0
        lr : debug_print_object+0xb0/0xf0
        sp : ffff00001292f7d0
        x29: ffff00001292f7d0 x28: ffff800b82151788
        x27: 0000000000000001 x26: ffff800b892c0000
        x25: ffff0000124a2558 x24: 0000000000000000
        x23: ffff00001107a1d8 x22: ffff0000116b5088
        x21: ffff800bdc6afca8 x20: ffff000012471ae8
        x19: ffff00001168f2c8 x18: 0000000000000010
        x17: 00000000fd6f304b x16: 00000000ee79de43
        x15: ffff800bc0e80568 x14: 79616c6564203a74
        x13: 6e6968207473696c x12: 5f72656d6974203a
        x11: ffff0000113f0018 x10: 0000000000000000
        x9 : 000000000000001f x8 : 0000000000000000
        x7 : ffff0000101294cc x6 : 0000000000000000
        x5 : 0000000000000000 x4 : 0000000000000001
        x3 : 00000000ffffffff x2 : 0000000000000000
        x1 : 387fc15c8ec0f200 x0 : 0000000000000000
        Call trace:
         debug_print_object+0xb0/0xf0
         __debug_check_no_obj_freed+0x19c/0x228
         debug_check_no_obj_freed+0x1c/0x28
         kfree+0x250/0x440
         put_i2c_dev+0x68/0x78
         i2cdev_detach_adapter+0x60/0xc8
         i2cdev_notifier_call+0x3c/0x70
         notifier_call_chain+0x8c/0xe8
         blocking_notifier_call_chain+0x64/0x88
         device_del+0x74/0x380
         device_unregister+0x54/0x78
         i2c_del_adapter+0x278/0x2d0
         unittest_i2c_bus_remove+0x3c/0x80
         platform_drv_remove+0x30/0x50
         device_release_driver_internal+0xf4/0x1c0
         driver_detach+0x58/0xa0
         bus_remove_driver+0x84/0xd8
         driver_unregister+0x34/0x60
         platform_driver_unregister+0x20/0x30
         of_unittest_overlay+0x8d4/0xbe0
         of_unittest+0xae8/0xb3c
         do_one_initcall+0xac/0x450
         do_initcall_level+0x208/0x224
         kernel_init_freeable+0x2d8/0x36c
         kernel_init+0x18/0x108
         ret_from_fork+0x10/0x1c
        irq event stamp: 3934661
        hardirqs last  enabled at (3934661): [<ffff00001009fa04>] debug_exception_exit+0x4c/0x58
        hardirqs last disabled at (3934660): [<ffff00001009fb14>] debug_exception_enter+0xa4/0xe0
        softirqs last  enabled at (3934654): [<ffff000010081d94>] __do_softirq+0x46c/0x628
        softirqs last disabled at (3934649): [<ffff0000100b4a1c>] irq_exit+0x104/0x118
      
      This is a common issue when using cdev embedded in a struct.
      Fortunately, we already have a mechanism to solve this kind of issue.
      Please see commit 233ed09d ("chardev: add helper function to
      register char devs with a struct device") for more detail.
      
      In this patch, we choose to embed the struct device into the i2c_dev,
      and use the API provided by the commit 233ed09d to make sure that
      the release of i2c_dev and cdev are in sequence.
      Signed-off-by: NKevin Hao <haokexin@gmail.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      1413ef63
  10. 13 3月, 2020 5 次提交
  11. 10 3月, 2020 11 次提交
  12. 26 2月, 2020 1 次提交