extcon: extcon-axp288: Use P-Unit semaphore lock for register accesses
authorFabio Aiuto <fabioaiuto83@gmail.com>
Thu, 16 Sep 2021 07:12:55 +0000 (09:12 +0200)
committerChanwoo Choi <cw00.choi@samsung.com>
Wed, 27 Oct 2021 05:13:38 +0000 (14:13 +0900)
commit968bd3f0388b8eaf6746336856348dc3ddf2ed39
tree472a5c3878f20b390559cf1bb0f90ab8dcb7ce03
parent3177308a9421f7735482fd56091bc09ef521b933
extcon: extcon-axp288: Use P-Unit semaphore lock for register accesses

use low level P-Unit semaphore lock for axp288 register
accesses directly and for more than one access a time,
to reduce the number of times this semaphore is locked
and released which is an expensive operation.

i2c-bus to the XPower is shared between the kernel and the
SoCs P-Unit. The P-Unit has a semaphore wich the kernel must
lock for axp288 register accesses. When the P-Unit semaphore
is locked CPU and GPU power states cannot change or the system
will freeze.

The P-Unit semaphore lock is already managed inside the regmap
access logic, but for each access the semaphore is locked and
released. So use directly iosf_mbi_(un)block_punit_i2c_access(),
we are safe in doing so because nested calls to the same
semaphore are turned to nops.

Suggested-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
drivers/extcon/Kconfig
drivers/extcon/extcon-axp288.c