aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2018-09-05 15:51:31 -0400
committerWolfram Sang <wsa@the-dreams.de>2018-09-06 14:29:10 -0400
commit9cbeeca05049b1109e7e445369898b8a88d5ea7b (patch)
tree65214501d12a354b9e79cefe4d28c7ca5be3dc32
parent1bb39959623b438d6b7705abfd0538e8ef4f5f0f (diff)
i2c: designware: Remove Cherry Trail PMIC I2C bus pm_disabled workaround
Commit a3d411fb38c0 ("i2c: designware: Disable pm for PMIC i2c-bus even if there is no _SEM method"), always set the pm_disabled flag on the I2C7 controller, even if its bus was not shared with the PUNIT. This was a workaround for various suspend/resume issues, after the following 2 commits this workaround is no longer necessary: Commit 541527728341 ("PM: i2c-designware-platdrv: Suspend/resume at the late/early stages") Commit e6ce0ce34f65 ("ACPI / LPSS: Add device link for CHT SD card dependency on I2C") Therefor this commit removes this workaround. After this commit the pm_disabled flag is only used to indicate that the bus is shared with the PUNIT and after other recent changes we no longer call dev_pm_syscore_device(dev, true), so we are no longer actually disabling (non-runtime) pm, so this commit also renames the flag to shared_with_punit to better reflect what it is for. Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
-rw-r--r--drivers/i2c/busses/i2c-designware-baytrail.c2
-rw-r--r--drivers/i2c/busses/i2c-designware-core.h4
-rw-r--r--drivers/i2c/busses/i2c-designware-master.c2
-rw-r--r--drivers/i2c/busses/i2c-designware-platdrv.c23
4 files changed, 8 insertions, 23 deletions
diff --git a/drivers/i2c/busses/i2c-designware-baytrail.c b/drivers/i2c/busses/i2c-designware-baytrail.c
index a2a275cfc1f6..9ca1feaba98f 100644
--- a/drivers/i2c/busses/i2c-designware-baytrail.c
+++ b/drivers/i2c/busses/i2c-designware-baytrail.c
@@ -164,7 +164,7 @@ int i2c_dw_probe_lock_support(struct dw_i2c_dev *dev)
164 dev_info(dev->dev, "I2C bus managed by PUNIT\n"); 164 dev_info(dev->dev, "I2C bus managed by PUNIT\n");
165 dev->acquire_lock = baytrail_i2c_acquire; 165 dev->acquire_lock = baytrail_i2c_acquire;
166 dev->release_lock = baytrail_i2c_release; 166 dev->release_lock = baytrail_i2c_release;
167 dev->pm_disabled = true; 167 dev->shared_with_punit = true;
168 168
169 pm_qos_add_request(&dev->pm_qos, PM_QOS_CPU_DMA_LATENCY, 169 pm_qos_add_request(&dev->pm_qos, PM_QOS_CPU_DMA_LATENCY,
170 PM_QOS_DEFAULT_VALUE); 170 PM_QOS_DEFAULT_VALUE);
diff --git a/drivers/i2c/busses/i2c-designware-core.h b/drivers/i2c/busses/i2c-designware-core.h
index 5b550ab9a009..fb40d76639da 100644
--- a/drivers/i2c/busses/i2c-designware-core.h
+++ b/drivers/i2c/busses/i2c-designware-core.h
@@ -212,7 +212,7 @@
212 * @pm_qos: pm_qos_request used while holding a hardware lock on the bus 212 * @pm_qos: pm_qos_request used while holding a hardware lock on the bus
213 * @acquire_lock: function to acquire a hardware lock on the bus 213 * @acquire_lock: function to acquire a hardware lock on the bus
214 * @release_lock: function to release a hardware lock on the bus 214 * @release_lock: function to release a hardware lock on the bus
215 * @pm_disabled: true if power-management should be disabled for this i2c-bus 215 * @shared_with_punit: true if this bus is shared with the SoCs PUNIT
216 * @disable: function to disable the controller 216 * @disable: function to disable the controller
217 * @disable_int: function to disable all interrupts 217 * @disable_int: function to disable all interrupts
218 * @init: function to initialize the I2C hardware 218 * @init: function to initialize the I2C hardware
@@ -266,7 +266,7 @@ struct dw_i2c_dev {
266 struct pm_qos_request pm_qos; 266 struct pm_qos_request pm_qos;
267 int (*acquire_lock)(struct dw_i2c_dev *dev); 267 int (*acquire_lock)(struct dw_i2c_dev *dev);
268 void (*release_lock)(struct dw_i2c_dev *dev); 268 void (*release_lock)(struct dw_i2c_dev *dev);
269 bool pm_disabled; 269 bool shared_with_punit;
270 void (*disable)(struct dw_i2c_dev *dev); 270 void (*disable)(struct dw_i2c_dev *dev);
271 void (*disable_int)(struct dw_i2c_dev *dev); 271 void (*disable_int)(struct dw_i2c_dev *dev);
272 int (*init)(struct dw_i2c_dev *dev); 272 int (*init)(struct dw_i2c_dev *dev);
diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c
index 94d94b4a9a0d..2ccb527735f9 100644
--- a/drivers/i2c/busses/i2c-designware-master.c
+++ b/drivers/i2c/busses/i2c-designware-master.c
@@ -707,7 +707,7 @@ int i2c_dw_probe(struct dw_i2c_dev *dev)
707 adap->dev.parent = dev->dev; 707 adap->dev.parent = dev->dev;
708 i2c_set_adapdata(adap, dev); 708 i2c_set_adapdata(adap, dev);
709 709
710 if (dev->pm_disabled) { 710 if (dev->shared_with_punit) {
711 irq_flags = IRQF_NO_SUSPEND; 711 irq_flags = IRQF_NO_SUSPEND;
712 } else { 712 } else {
713 irq_flags = IRQF_SHARED | IRQF_COND_SUSPEND; 713 irq_flags = IRQF_SHARED | IRQF_COND_SUSPEND;
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index a56af235e9a6..51cb17287c47 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -85,9 +85,6 @@ static int dw_i2c_acpi_configure(struct platform_device *pdev)
85 struct dw_i2c_dev *dev = platform_get_drvdata(pdev); 85 struct dw_i2c_dev *dev = platform_get_drvdata(pdev);
86 struct i2c_timings *t = &dev->timings; 86 struct i2c_timings *t = &dev->timings;
87 u32 ss_ht = 0, fp_ht = 0, hs_ht = 0, fs_ht = 0; 87 u32 ss_ht = 0, fp_ht = 0, hs_ht = 0, fs_ht = 0;
88 acpi_handle handle = ACPI_HANDLE(&pdev->dev);
89 struct acpi_device *adev;
90 const char *uid;
91 88
92 dev->adapter.nr = -1; 89 dev->adapter.nr = -1;
93 dev->tx_fifo_depth = 32; 90 dev->tx_fifo_depth = 32;
@@ -118,18 +115,6 @@ static int dw_i2c_acpi_configure(struct platform_device *pdev)
118 break; 115 break;
119 } 116 }
120 117
121 if (acpi_bus_get_device(handle, &adev))
122 return -ENODEV;
123
124 /*
125 * Cherrytrail I2C7 gets used for the PMIC which gets accessed
126 * through ACPI opregions during late suspend / early resume
127 * disable pm for it.
128 */
129 uid = adev->pnp.unique_id;
130 if ((dev->flags & MODEL_CHERRYTRAIL) && !strcmp(uid, "7"))
131 dev->pm_disabled = true;
132
133 return 0; 118 return 0;
134} 119}
135 120
@@ -261,7 +246,7 @@ static void dw_i2c_plat_pm_cleanup(struct dw_i2c_dev *dev)
261{ 246{
262 pm_runtime_disable(dev->dev); 247 pm_runtime_disable(dev->dev);
263 248
264 if (dev->pm_disabled) 249 if (dev->shared_with_punit)
265 pm_runtime_put_noidle(dev->dev); 250 pm_runtime_put_noidle(dev->dev);
266} 251}
267 252
@@ -393,7 +378,7 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
393 pm_runtime_use_autosuspend(&pdev->dev); 378 pm_runtime_use_autosuspend(&pdev->dev);
394 pm_runtime_set_active(&pdev->dev); 379 pm_runtime_set_active(&pdev->dev);
395 380
396 if (dev->pm_disabled) 381 if (dev->shared_with_punit)
397 pm_runtime_get_noresume(&pdev->dev); 382 pm_runtime_get_noresume(&pdev->dev);
398 383
399 pm_runtime_enable(&pdev->dev); 384 pm_runtime_enable(&pdev->dev);
@@ -471,7 +456,7 @@ static int dw_i2c_plat_suspend(struct device *dev)
471{ 456{
472 struct dw_i2c_dev *i_dev = dev_get_drvdata(dev); 457 struct dw_i2c_dev *i_dev = dev_get_drvdata(dev);
473 458
474 if (i_dev->pm_disabled) 459 if (i_dev->shared_with_punit)
475 return 0; 460 return 0;
476 461
477 i_dev->disable(i_dev); 462 i_dev->disable(i_dev);
@@ -484,7 +469,7 @@ static int dw_i2c_plat_resume(struct device *dev)
484{ 469{
485 struct dw_i2c_dev *i_dev = dev_get_drvdata(dev); 470 struct dw_i2c_dev *i_dev = dev_get_drvdata(dev);
486 471
487 if (!i_dev->pm_disabled) 472 if (!i_dev->shared_with_punit)
488 i2c_dw_prepare_clk(i_dev, true); 473 i2c_dw_prepare_clk(i_dev, true);
489 474
490 i_dev->init(i_dev); 475 i_dev->init(i_dev);