power: supply: axp288-charger: Optimize register reading method
The original implementation access the charger the same register value several times to get the charger status, such as online, enabled, and bus limits. It takes a long time and bandwidth for every "status get" operation. To reduce the access of the register and save bandwidth, this commit integrated every read operation into only one "register value get" operation and cache them in the variables. Once the "get properties" is requested from the user space, the cached information can be returned immediately. I2C access between Linux kernel and P-Unit is improved by explicitly taking semaphore once for the entire set of register accesses in the new axp288_charger_usb_update_property() function. The I2C-Bus to the XPower AXP288 is shared between the Linux kernel and SoCs P-Unit. The P-Unit has a semaphore which the kernel must "lock" before it may use the bus. If not explicitly taken by the I2C-Driver, then this semaphore is automatically taken by the I2C-bus-driver for each I2C-transfer. In other words, the semaphore will be locked and released several times for entire set of register accesses. Signed-off-by: Kate Hsuan <hpa@redhat.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Tested-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Showing
Please register or sign in to comment