summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchasewu <chasewu@google.com>2021-09-24 00:51:39 +0800
committerVince Leung <leungv@google.com>2021-09-25 00:12:11 +0000
commit5d5df134c9808c5471f5e53f51aa96709ba2b57d (patch)
treeb086b39301a282812107bc810a5d3e2a9a848591
parent594e3999aa1fad393a432902151d71513dc9cd95 (diff)
downloadamplifiers-5d5df134c9808c5471f5e53f51aa96709ba2b57d.tar.gz
cs40l25: Remove unreliable condition checking and add status control
Since the chip might got stuck, removing the unreliable condition checking could solve device enter ramdump mode due to performance watchdog mechanism. Following the concept in cs40l26-codec.c, I add the vibe_state update function when device is running the audio coupled haptics effects. Bug: 200067948 Test: Manual trigger audio coupled haptics by sound picker Test: Typing, receive a notification Signed-off-by: chasewu <chasewu@google.com> Change-Id: I21b3d4972e78581c2b621390139565f97efd4807
-rw-r--r--cs40l25/cs40l2x.c3
-rw-r--r--cs40l25/include/linux/mfd/cs40l2x.h2
-rw-r--r--cs40l25/snd-soc-codec-cs40l2x.c5
3 files changed, 6 insertions, 4 deletions
diff --git a/cs40l25/cs40l2x.c b/cs40l25/cs40l2x.c
index 17d4ee2..7751023 100644
--- a/cs40l25/cs40l2x.c
+++ b/cs40l25/cs40l2x.c
@@ -266,13 +266,14 @@ static int cs40l2x_write_pwle(struct cs40l2x_private *cs40l2x, void *buf,
return dspmem_chunk_bytes(&ch);
}
-static void cs40l2x_set_state(struct cs40l2x_private *cs40l2x, bool state)
+void cs40l2x_set_state(struct cs40l2x_private *cs40l2x, bool state)
{
if (cs40l2x->vibe_state != state) {
cs40l2x->vibe_state = state;
cs40l2x_sysfs_notify(cs40l2x, "vibe_state");
}
}
+EXPORT_SYMBOL(cs40l2x_set_state);
static void cs40l2x_set_gpio_event(struct cs40l2x_private *cs40l2x, bool value)
{
diff --git a/cs40l25/include/linux/mfd/cs40l2x.h b/cs40l25/include/linux/mfd/cs40l2x.h
index d25919b..2c7d404 100644
--- a/cs40l25/include/linux/mfd/cs40l2x.h
+++ b/cs40l25/include/linux/mfd/cs40l2x.h
@@ -1535,6 +1535,8 @@ int cs40l2x_coeff_file_parse(struct cs40l2x_private *cs40l2x,
int cs40l2x_ack_write(struct cs40l2x_private *cs40l2x, unsigned int reg,
unsigned int write_val, unsigned int reset_val);
+void cs40l2x_set_state(struct cs40l2x_private *cs40l2x, bool state);
+
struct cs40l2x_virtual_waveform {
bool is_xm;
unsigned int index;
diff --git a/cs40l25/snd-soc-codec-cs40l2x.c b/cs40l25/snd-soc-codec-cs40l2x.c
index ae694df..1e95888 100644
--- a/cs40l25/snd-soc-codec-cs40l2x.c
+++ b/cs40l25/snd-soc-codec-cs40l2x.c
@@ -191,11 +191,9 @@ static int cs40l2x_clk_en(struct snd_soc_dapm_widget *w,
dev_info(dev, "%s: SND_SOC_DAPM_POST_PMU\n", __func__);
mutex_lock(&core->lock);
core->a2h_enable = true;
+ cs40l2x_set_state(core, CS40L2X_VIBE_STATE_RUNNING);
mutex_unlock(&core->lock);
- if (!completion_done(&core->hap_done))
- wait_for_completion(&core->hap_done);
-
ret = cs40l2x_swap_ext_clk(priv, CS40L2X_SCLK);
if (ret)
return ret;
@@ -208,6 +206,7 @@ static int cs40l2x_clk_en(struct snd_soc_dapm_widget *w,
mutex_lock(&core->lock);
core->a2h_enable = false;
+ cs40l2x_set_state(core, CS40L2X_VIBE_STATE_STOPPED);
mutex_unlock(&core->lock);
break;
default: