diff options
author | Chase Wu <chasewu@google.com> | 2022-12-14 17:09:50 +0800 |
---|---|---|
committer | Chase Wu <chasewu@google.com> | 2022-12-19 19:00:12 +0800 |
commit | 9f374a98c692a587a7a9919d8a11258054864a91 (patch) | |
tree | 4494323fff5c9f8cab45643d7bae66229824b95b | |
parent | b0f4296a7368213c91a93df13f212c834689eaab (diff) | |
download | amplifiers-9f374a98c692a587a7a9919d8a11258054864a91.tar.gz |
cs40l26: Performance improvement for short haptic effect and GPIO
sensing rule
1. Remove lock in vibe state sysfd
Since HAL will only read this attribute after sysfs_nofity is called,
removing the mutex_lock to mitigate the chances that HAL only get the
stopped state in triggering the back-to-back short haptic effect
(e.g. TICK effct).
2. Disable falling edge GPIO sensing
Extend the GPIO trigger mask to ignore GPIO1 falling edge as well.
In this way, chip will not waste it's resource to monitor the GPIO
falling edge change and rise the IRQ to driver, then do nothing.
Bug: 262491181
Test: Manually trigger light_tick and check logs
Change-Id: Ie721b804c73f89d4875da17c41c5ac463b59fde8
Signed-off-by: Chase Wu <chasewu@google.com>
-rw-r--r-- | cs40l26/cs40l26-sysfs.c | 10 | ||||
-rw-r--r-- | cs40l26/cs40l26.c | 6 |
2 files changed, 16 insertions, 0 deletions
diff --git a/cs40l26/cs40l26-sysfs.c b/cs40l26/cs40l26-sysfs.c index 1f125db..6737894 100644 --- a/cs40l26/cs40l26-sysfs.c +++ b/cs40l26/cs40l26-sysfs.c @@ -168,9 +168,19 @@ static ssize_t vibe_state_show(struct device *dev, return -EPERM; } +#if IS_ENABLED(CONFIG_GOOG_CUST) + /* + * Since HAL will only read this attribute after sysfs_nofity is called, + * removing the mutex_lock to mitigate the chances that HAL only get the + * stopped state in triggering the back-to-back short haptic effect + * (e.g. TICK effct). + */ + state = cs40l26->vibe_state; +#else mutex_lock(&cs40l26->lock); state = cs40l26->vibe_state; mutex_unlock(&cs40l26->lock); +#endif return snprintf(buf, PAGE_SIZE, "%u\n", state); } diff --git a/cs40l26/cs40l26.c b/cs40l26/cs40l26.c index d4d4b3f..122842f 100644 --- a/cs40l26/cs40l26.c +++ b/cs40l26/cs40l26.c @@ -3258,8 +3258,14 @@ static int cs40l26_gpio_config(struct cs40l26_private *cs40l26) CS40L26_IRQ1_GPIO1_RISE)); if (mask_gpio) +#if IS_ENABLED(CONFIG_GOOG_CUST) + /* Extend the GPIO trigger mask to ignore GPIO1 falling edge */ + val = (u32) GENMASK(CS40L26_IRQ1_GPIO4_FALL, + CS40L26_IRQ1_GPIO1_FALL); +#else val = (u32) GENMASK(CS40L26_IRQ1_GPIO4_FALL, CS40L26_IRQ1_GPIO2_RISE); +#endif else val = 0; |