mirror of
https://github.com/torvalds/linux.git
synced 2024-11-18 10:01:43 +00:00
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>
This commit is contained in:
parent
3c670dba86
commit
8afb46804d
@ -12,16 +12,6 @@
|
|||||||
|
|
||||||
#include "i2c-designware-core.h"
|
#include "i2c-designware-core.h"
|
||||||
|
|
||||||
static int baytrail_i2c_acquire(struct dw_i2c_dev *dev)
|
|
||||||
{
|
|
||||||
return iosf_mbi_block_punit_i2c_access();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void baytrail_i2c_release(struct dw_i2c_dev *dev)
|
|
||||||
{
|
|
||||||
iosf_mbi_unblock_punit_i2c_access();
|
|
||||||
}
|
|
||||||
|
|
||||||
int i2c_dw_probe_lock_support(struct dw_i2c_dev *dev)
|
int i2c_dw_probe_lock_support(struct dw_i2c_dev *dev)
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
@ -46,13 +36,9 @@ int i2c_dw_probe_lock_support(struct dw_i2c_dev *dev)
|
|||||||
return -EPROBE_DEFER;
|
return -EPROBE_DEFER;
|
||||||
|
|
||||||
dev_info(dev->dev, "I2C bus managed by PUNIT\n");
|
dev_info(dev->dev, "I2C bus managed by PUNIT\n");
|
||||||
dev->acquire_lock = baytrail_i2c_acquire;
|
dev->acquire_lock = iosf_mbi_block_punit_i2c_access;
|
||||||
dev->release_lock = baytrail_i2c_release;
|
dev->release_lock = iosf_mbi_unblock_punit_i2c_access;
|
||||||
dev->pm_disabled = true;
|
dev->pm_disabled = true;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void i2c_dw_remove_lock_support(struct dw_i2c_dev *dev)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
@ -267,7 +267,7 @@ int i2c_dw_acquire_lock(struct dw_i2c_dev *dev)
|
|||||||
if (!dev->acquire_lock)
|
if (!dev->acquire_lock)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ret = dev->acquire_lock(dev);
|
ret = dev->acquire_lock();
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -279,7 +279,7 @@ int i2c_dw_acquire_lock(struct dw_i2c_dev *dev)
|
|||||||
void i2c_dw_release_lock(struct dw_i2c_dev *dev)
|
void i2c_dw_release_lock(struct dw_i2c_dev *dev)
|
||||||
{
|
{
|
||||||
if (dev->release_lock)
|
if (dev->release_lock)
|
||||||
dev->release_lock(dev);
|
dev->release_lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/i2c.h>
|
#include <linux/i2c.h>
|
||||||
#include <linux/pm_qos.h>
|
|
||||||
|
|
||||||
#define DW_IC_DEFAULT_FUNCTIONALITY (I2C_FUNC_I2C | \
|
#define DW_IC_DEFAULT_FUNCTIONALITY (I2C_FUNC_I2C | \
|
||||||
I2C_FUNC_SMBUS_BYTE | \
|
I2C_FUNC_SMBUS_BYTE | \
|
||||||
@ -209,7 +208,6 @@
|
|||||||
* @fp_lcnt: fast plus LCNT value
|
* @fp_lcnt: fast plus LCNT value
|
||||||
* @hs_hcnt: high speed HCNT value
|
* @hs_hcnt: high speed HCNT value
|
||||||
* @hs_lcnt: high speed LCNT value
|
* @hs_lcnt: high speed LCNT value
|
||||||
* @pm_qos: pm_qos_request used while holding a hardware lock on the bus
|
|
||||||
* @acquire_lock: function to acquire a hardware lock on the bus
|
* @acquire_lock: function to acquire a hardware lock on the bus
|
||||||
* @release_lock: function to release a hardware lock on the bus
|
* @release_lock: function to release a hardware lock on the bus
|
||||||
* @pm_disabled: true if power-management should be disabled for this i2c-bus
|
* @pm_disabled: true if power-management should be disabled for this i2c-bus
|
||||||
@ -262,9 +260,8 @@ struct dw_i2c_dev {
|
|||||||
u16 fp_lcnt;
|
u16 fp_lcnt;
|
||||||
u16 hs_hcnt;
|
u16 hs_hcnt;
|
||||||
u16 hs_lcnt;
|
u16 hs_lcnt;
|
||||||
struct pm_qos_request pm_qos;
|
int (*acquire_lock)(void);
|
||||||
int (*acquire_lock)(struct dw_i2c_dev *dev);
|
void (*release_lock)(void);
|
||||||
void (*release_lock)(struct dw_i2c_dev *dev);
|
|
||||||
bool pm_disabled;
|
bool pm_disabled;
|
||||||
void (*disable)(struct dw_i2c_dev *dev);
|
void (*disable)(struct dw_i2c_dev *dev);
|
||||||
void (*disable_int)(struct dw_i2c_dev *dev);
|
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; }
|
|||||||
|
|
||||||
#if IS_ENABLED(CONFIG_I2C_DESIGNWARE_BAYTRAIL)
|
#if IS_ENABLED(CONFIG_I2C_DESIGNWARE_BAYTRAIL)
|
||||||
extern int i2c_dw_probe_lock_support(struct dw_i2c_dev *dev);
|
extern int i2c_dw_probe_lock_support(struct dw_i2c_dev *dev);
|
||||||
extern void i2c_dw_remove_lock_support(struct dw_i2c_dev *dev);
|
|
||||||
#else
|
#else
|
||||||
static inline int i2c_dw_probe_lock_support(struct dw_i2c_dev *dev) { return 0; }
|
static inline int i2c_dw_probe_lock_support(struct dw_i2c_dev *dev) { return 0; }
|
||||||
static inline void i2c_dw_remove_lock_support(struct dw_i2c_dev *dev) {}
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -388,8 +388,6 @@ static int dw_i2c_plat_remove(struct platform_device *pdev)
|
|||||||
if (!IS_ERR_OR_NULL(dev->rst))
|
if (!IS_ERR_OR_NULL(dev->rst))
|
||||||
reset_control_assert(dev->rst);
|
reset_control_assert(dev->rst);
|
||||||
|
|
||||||
i2c_dw_remove_lock_support(dev);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user