aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2018-10-11 10:29:11 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2018-10-25 11:00:05 -0400
commit8afb46804dfa88bb86d65e13f3209372f3d912e3 (patch)
treecdc6c4d85e38084b8edc0930fc5217d137811c0f
parent3c670dba864d9ab0a23612a93b7d98700734bd44 (diff)
i2c: designware: Cleanup bus lock handling
Now that most of the special Bay- / Cherry-Trail bus lock handling has been moved to the iosf_mbi code we can simplify the remaining code a bit. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Acked-by: Wolfram Sang <wsa@the-dreams.de> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/i2c/busses/i2c-designware-baytrail.c18
-rw-r--r--drivers/i2c/busses/i2c-designware-common.c4
-rw-r--r--drivers/i2c/busses/i2c-designware-core.h9
-rw-r--r--drivers/i2c/busses/i2c-designware-platdrv.c2
4 files changed, 6 insertions, 27 deletions
diff --git a/drivers/i2c/busses/i2c-designware-baytrail.c b/drivers/i2c/busses/i2c-designware-baytrail.c
index b2ba4de4e204..971b5cde7a93 100644
--- a/drivers/i2c/busses/i2c-designware-baytrail.c
+++ b/drivers/i2c/busses/i2c-designware-baytrail.c
@@ -12,16 +12,6 @@
12 12
13#include "i2c-designware-core.h" 13#include "i2c-designware-core.h"
14 14
15static int baytrail_i2c_acquire(struct dw_i2c_dev *dev)
16{
17 return iosf_mbi_block_punit_i2c_access();
18}
19
20static void baytrail_i2c_release(struct dw_i2c_dev *dev)
21{
22 iosf_mbi_unblock_punit_i2c_access();
23}
24
25int i2c_dw_probe_lock_support(struct dw_i2c_dev *dev) 15int i2c_dw_probe_lock_support(struct dw_i2c_dev *dev)
26{ 16{
27 acpi_status status; 17 acpi_status status;
@@ -46,13 +36,9 @@ int i2c_dw_probe_lock_support(struct dw_i2c_dev *dev)
46 return -EPROBE_DEFER; 36 return -EPROBE_DEFER;
47 37
48 dev_info(dev->dev, "I2C bus managed by PUNIT\n"); 38 dev_info(dev->dev, "I2C bus managed by PUNIT\n");
49 dev->acquire_lock = baytrail_i2c_acquire; 39 dev->acquire_lock = iosf_mbi_block_punit_i2c_access;
50 dev->release_lock = baytrail_i2c_release; 40 dev->release_lock = iosf_mbi_unblock_punit_i2c_access;
51 dev->pm_disabled = true; 41 dev->pm_disabled = true;
52 42
53 return 0; 43 return 0;
54} 44}
55
56void i2c_dw_remove_lock_support(struct dw_i2c_dev *dev)
57{
58}
diff --git a/drivers/i2c/busses/i2c-designware-common.c b/drivers/i2c/busses/i2c-designware-common.c
index 69ec4a791f23..7d50f230cd37 100644
--- a/drivers/i2c/busses/i2c-designware-common.c
+++ b/drivers/i2c/busses/i2c-designware-common.c
@@ -267,7 +267,7 @@ int i2c_dw_acquire_lock(struct dw_i2c_dev *dev)
267 if (!dev->acquire_lock) 267 if (!dev->acquire_lock)
268 return 0; 268 return 0;
269 269
270 ret = dev->acquire_lock(dev); 270 ret = dev->acquire_lock();
271 if (!ret) 271 if (!ret)
272 return 0; 272 return 0;
273 273
@@ -279,7 +279,7 @@ int i2c_dw_acquire_lock(struct dw_i2c_dev *dev)
279void i2c_dw_release_lock(struct dw_i2c_dev *dev) 279void i2c_dw_release_lock(struct dw_i2c_dev *dev)
280{ 280{
281 if (dev->release_lock) 281 if (dev->release_lock)
282 dev->release_lock(dev); 282 dev->release_lock();
283} 283}
284 284
285/* 285/*
diff --git a/drivers/i2c/busses/i2c-designware-core.h b/drivers/i2c/busses/i2c-designware-core.h
index e367b1af4ab2..152bf56d8404 100644
--- a/drivers/i2c/busses/i2c-designware-core.h
+++ b/drivers/i2c/busses/i2c-designware-core.h
@@ -10,7 +10,6 @@
10 */ 10 */
11 11
12#include <linux/i2c.h> 12#include <linux/i2c.h>
13#include <linux/pm_qos.h>
14 13
15#define DW_IC_DEFAULT_FUNCTIONALITY (I2C_FUNC_I2C | \ 14#define DW_IC_DEFAULT_FUNCTIONALITY (I2C_FUNC_I2C | \
16 I2C_FUNC_SMBUS_BYTE | \ 15 I2C_FUNC_SMBUS_BYTE | \
@@ -209,7 +208,6 @@
209 * @fp_lcnt: fast plus LCNT value 208 * @fp_lcnt: fast plus LCNT value
210 * @hs_hcnt: high speed HCNT value 209 * @hs_hcnt: high speed HCNT value
211 * @hs_lcnt: high speed LCNT value 210 * @hs_lcnt: high speed LCNT value
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 211 * @acquire_lock: function to acquire a hardware lock on the bus
214 * @release_lock: function to release a hardware lock on the bus 212 * @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 213 * @pm_disabled: true if power-management should be disabled for this i2c-bus
@@ -262,9 +260,8 @@ struct dw_i2c_dev {
262 u16 fp_lcnt; 260 u16 fp_lcnt;
263 u16 hs_hcnt; 261 u16 hs_hcnt;
264 u16 hs_lcnt; 262 u16 hs_lcnt;
265 struct pm_qos_request pm_qos; 263 int (*acquire_lock)(void);
266 int (*acquire_lock)(struct dw_i2c_dev *dev); 264 void (*release_lock)(void);
267 void (*release_lock)(struct dw_i2c_dev *dev);
268 bool pm_disabled; 265 bool pm_disabled;
269 void (*disable)(struct dw_i2c_dev *dev); 266 void (*disable)(struct dw_i2c_dev *dev);
270 void (*disable_int)(struct dw_i2c_dev *dev); 267 void (*disable_int)(struct dw_i2c_dev *dev);
@@ -317,8 +314,6 @@ static inline int i2c_dw_probe_slave(struct dw_i2c_dev *dev) { return -EINVAL; }
317 314
318#if IS_ENABLED(CONFIG_I2C_DESIGNWARE_BAYTRAIL) 315#if IS_ENABLED(CONFIG_I2C_DESIGNWARE_BAYTRAIL)
319extern int i2c_dw_probe_lock_support(struct dw_i2c_dev *dev); 316extern int i2c_dw_probe_lock_support(struct dw_i2c_dev *dev);
320extern void i2c_dw_remove_lock_support(struct dw_i2c_dev *dev);
321#else 317#else
322static inline int i2c_dw_probe_lock_support(struct dw_i2c_dev *dev) { return 0; } 318static inline int i2c_dw_probe_lock_support(struct dw_i2c_dev *dev) { return 0; }
323static inline void i2c_dw_remove_lock_support(struct dw_i2c_dev *dev) {}
324#endif 319#endif
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index b5750fd85125..a14fb5f933ac 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -388,8 +388,6 @@ static int dw_i2c_plat_remove(struct platform_device *pdev)
388 if (!IS_ERR_OR_NULL(dev->rst)) 388 if (!IS_ERR_OR_NULL(dev->rst))
389 reset_control_assert(dev->rst); 389 reset_control_assert(dev->rst);
390 390
391 i2c_dw_remove_lock_support(dev);
392
393 return 0; 391 return 0;
394} 392}
395 393