Merge tag 'acpi-4.20-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull more ACPI updates from Rafael Wysocki:
 "Rework the handling of the P-unit semaphore on Intel Baytrail and
  Cherrytrail systems to avoid race conditions and excessive overhead
  related to it (Hans de Goede)"

* tag 'acpi-4.20-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  ACPI / PMIC: xpower: Add depends on IOSF_MBI to Kconfig entry
  i2c: designware: Cleanup bus lock handling
  ACPI / PMIC: xpower: Block P-Unit I2C access during read-modify-write
  x86: baytrail/cherrytrail: Rework and move P-Unit PMIC bus semaphore code
This commit is contained in:
Linus Torvalds
2018-10-30 09:15:31 -07:00
8 changed files with 250 additions and 183 deletions

View File

@@ -105,8 +105,10 @@ int iosf_mbi_modify(u8 port, u8 opcode, u32 offset, u32 mdr, u32 mask);
* the PMIC bus while another driver is also accessing the PMIC bus various bad
* things happen.
*
* To avoid these problems this function must be called before accessing the
* P-Unit or the PMIC, be it through iosf_mbi* functions or through other means.
* Call this function before sending requests to the P-Unit which may make it
* access the PMIC, be it through iosf_mbi* functions or through other means.
* This function will block all kernel access to the PMIC I2C bus, so that the
* P-Unit can safely access the PMIC over the shared I2C bus.
*
* Note on these systems the i2c-bus driver will request a sempahore from the
* P-Unit for exclusive access to the PMIC bus when i2c drivers are accessing
@@ -122,6 +124,31 @@ void iosf_mbi_punit_acquire(void);
*/
void iosf_mbi_punit_release(void);
/**
* iosf_mbi_block_punit_i2c_access() - Block P-Unit accesses to the PMIC bus
*
* Call this function to block P-Unit access to the PMIC I2C bus, so that the
* kernel can safely access the PMIC over the shared I2C bus.
*
* This function acquires the P-Unit bus semaphore and notifies
* pmic_bus_access_notifier listeners that they may no longer access the
* P-Unit in a way which may cause it to access the shared I2C bus.
*
* Note this function may be called multiple times and the bus will not
* be released until iosf_mbi_unblock_punit_i2c_access() has been called the
* same amount of times.
*
* Return: Nonzero on error
*/
int iosf_mbi_block_punit_i2c_access(void);
/*
* iosf_mbi_unblock_punit_i2c_access() - Release PMIC I2C bus block
*
* Release i2c access block gotten through iosf_mbi_block_punit_i2c_access().
*/
void iosf_mbi_unblock_punit_i2c_access(void);
/**
* iosf_mbi_register_pmic_bus_access_notifier - Register PMIC bus notifier
*
@@ -158,14 +185,6 @@ int iosf_mbi_unregister_pmic_bus_access_notifier(struct notifier_block *nb);
int iosf_mbi_unregister_pmic_bus_access_notifier_unlocked(
struct notifier_block *nb);
/**
* iosf_mbi_call_pmic_bus_access_notifier_chain - Call PMIC bus notifier chain
*
* @val: action to pass into listener's notifier_call function
* @v: data pointer to pass into listener's notifier_call function
*/
int iosf_mbi_call_pmic_bus_access_notifier_chain(unsigned long val, void *v);
/**
* iosf_mbi_assert_punit_acquired - Assert that the P-Unit has been acquired.
*/