[OEM][PATCH 0/2] Revert i2c-designware commits for issues on CHT platforms

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[OEM][PATCH 0/2] Revert i2c-designware commits for issues on CHT platforms

Wen-chien Jesse Sung
BugLink: https://launchpad.net/bugs/1810223

== Impact ==
The i2c-designware stops working after S4 thus I2C devices connected to it can't be accessed.
[ 272.628526] PM: Timekeeping suspended for 115.313 seconds
[ 272.633110] ACPI: Waking up from system sleep state S4
[ 272.655524] PM: noirq restore of devices complete after 19.377 msecs
[ 272.775692] i2c_designware 80860F41:00: Unknown Synopsys component type: 0xffffffff
[ 272.876322] PM: early restore of devices complete after 219.859 msecs
...
[ 273.060760] i2c_designware 80860F41:00: timeout waiting for bus ready
[ 274.214314] i2c_designware 80860F41:00: timeout in disabling adapter

== Fix ==
This happens after these two commits:
* 36c27d206b21 - PM: i2c-designware-platdrv: Optimize power management (2018-12-07 16:21:11 +0800)
* 489cd2fafa2d - PM: i2c-designware-platdrv: Use DPM_FLAG_SMART_PREPARE (2018-12-07 16:21:11 +0800)
Until there's a proper fix for them, both of them need to be reverted in order to make S4 works again.

== Test Case ==
Boot with the kernel, S4, and then wake the system up.

== Risk of Regression ==
Risk should be low since we're removing new features.


Wen-chien Jesse Sung (2):
  Revert "PM: i2c-designware-platdrv: Optimize power management"
  Revert "PM: i2c-designware-platdrv: Use DPM_FLAG_SMART_PREPARE"

 drivers/i2c/busses/i2c-designware-core.h    |  2 ++
 drivers/i2c/busses/i2c-designware-platdrv.c | 39 ++++++++++-----------
 2 files changed, 21 insertions(+), 20 deletions(-)

--
2.19.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[OEM][PATCH 1/2] Revert "PM: i2c-designware-platdrv: Optimize power management"

Wen-chien Jesse Sung
BugLink: https://launchpad.net/bugs/1810223

This reverts commit 36c27d206b216be34cbf5ff53853db1dd33b21ef.

This commit makes i2c-designware stops working after S4 on CHT.

Signed-off-by: Wen-chien Jesse Sung <[hidden email]>
---
 drivers/i2c/busses/i2c-designware-core.h    |  2 ++
 drivers/i2c/busses/i2c-designware-platdrv.c | 31 +++++++++++++--------
 2 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/drivers/i2c/busses/i2c-designware-core.h b/drivers/i2c/busses/i2c-designware-core.h
index 9fee4c054d3d..21bf619a86c5 100644
--- a/drivers/i2c/busses/i2c-designware-core.h
+++ b/drivers/i2c/busses/i2c-designware-core.h
@@ -280,6 +280,8 @@ struct dw_i2c_dev {
  int (*acquire_lock)(struct dw_i2c_dev *dev);
  void (*release_lock)(struct dw_i2c_dev *dev);
  bool pm_disabled;
+ bool suspended;
+ bool skip_resume;
  void (*disable)(struct dw_i2c_dev *dev);
  void (*disable_int)(struct dw_i2c_dev *dev);
  int (*init)(struct dw_i2c_dev *dev);
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 153b947702c5..4f90a6dc186f 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -42,7 +42,6 @@
 #include <linux/reset.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
-#include <linux/suspend.h>
 
 #include "i2c-designware-core.h"
 
@@ -373,10 +372,7 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
  ACPI_COMPANION_SET(&adap->dev, ACPI_COMPANION(&pdev->dev));
  adap->dev.of_node = pdev->dev.of_node;
 
- dev_pm_set_driver_flags(&pdev->dev,
- DPM_FLAG_SMART_PREPARE |
- DPM_FLAG_SMART_SUSPEND |
- DPM_FLAG_LEAVE_SUSPENDED);
+ dev_pm_set_driver_flags(&pdev->dev, DPM_FLAG_SMART_PREPARE);
 
  /* The code below assumes runtime PM to be disabled. */
  WARN_ON(pm_runtime_enabled(&pdev->dev));
@@ -452,13 +448,7 @@ static int dw_i2c_plat_prepare(struct device *dev)
 
 static void dw_i2c_plat_complete(struct device *dev)
 {
- /*
- * The device can only be in runtime suspend at this point if it has not
- * been resumed throughout the ending system suspend/resume cycle, so if
- * the platform firmware might mess up with it, request the runtime PM
- * framework to resume it.
- */
- if (pm_runtime_suspended(dev) && pm_resume_via_firmware())
+ if (dev->power.direct_complete)
  pm_request_resume(dev);
 }
 #else
@@ -471,9 +461,16 @@ static int dw_i2c_plat_suspend(struct device *dev)
 {
  struct dw_i2c_dev *i_dev = dev_get_drvdata(dev);
 
+ if (i_dev->suspended) {
+ i_dev->skip_resume = true;
+ return 0;
+ }
+
  i_dev->disable(i_dev);
  i2c_dw_plat_prepare_clk(i_dev, false);
 
+ i_dev->suspended = true;
+
  return 0;
 }
 
@@ -481,9 +478,19 @@ static int dw_i2c_plat_resume(struct device *dev)
 {
  struct dw_i2c_dev *i_dev = dev_get_drvdata(dev);
 
+ if (!i_dev->suspended)
+ return 0;
+
+ if (i_dev->skip_resume) {
+ i_dev->skip_resume = false;
+ return 0;
+ }
+
  i2c_dw_plat_prepare_clk(i_dev, true);
  i_dev->init(i_dev);
 
+ i_dev->suspended = false;
+
  return 0;
 }
 
--
2.19.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[OEM][PATCH 2/2] Revert "PM: i2c-designware-platdrv: Use DPM_FLAG_SMART_PREPARE"

Wen-chien Jesse Sung
In reply to this post by Wen-chien Jesse Sung
BugLink: https://launchpad.net/bugs/1810223

This reverts commit 489cd2fafa2d263a6a895f1445e5a8975f18b991.

This commit makes i2c-designware stops working after S4 on CHT.

Signed-off-by: Wen-chien Jesse Sung <[hidden email]>
---
 drivers/i2c/busses/i2c-designware-platdrv.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 4f90a6dc186f..58add69a441c 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -372,8 +372,6 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
  ACPI_COMPANION_SET(&adap->dev, ACPI_COMPANION(&pdev->dev));
  adap->dev.of_node = pdev->dev.of_node;
 
- dev_pm_set_driver_flags(&pdev->dev, DPM_FLAG_SMART_PREPARE);
-
  /* The code below assumes runtime PM to be disabled. */
  WARN_ON(pm_runtime_enabled(&pdev->dev));
 
@@ -437,13 +435,7 @@ MODULE_DEVICE_TABLE(of, dw_i2c_of_match);
 #ifdef CONFIG_PM_SLEEP
 static int dw_i2c_plat_prepare(struct device *dev)
 {
- /*
- * 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);
+ return pm_runtime_suspended(dev);
 }
 
 static void dw_i2c_plat_complete(struct device *dev)
--
2.19.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK/cmnt: [OEM][PATCH 0/2] Revert i2c-designware commits for issues on CHT platforms

AceLan Kao
In reply to this post by Wen-chien Jesse Sung
The 2 i2c commits introduce regression, and there is no proper fix for it,
so revert them for the time being.

Acked-By: AceLan Kao <[hidden email]>

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

APPLIED[OEM-B]: [OEM][PATCH 0/2] Revert i2c-designware commits for issues on CHT platforms

AceLan Kao
In reply to this post by Wen-chien Jesse Sung
Applied on OEM kernel 4.15.0-1031.36

Acked-By: AceLan Kao <[hidden email]>

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team