From 2aa344da6edbe944c771034ad03bbc9b283e1d91 Mon Sep 17 00:00:00 2001 From: Laxminath Kasam Date: Mon, 16 Mar 2020 19:07:00 +0530 Subject: [PATCH] SoC: wsa883x: Remove from soundwire group during teardown After playback on speaker, remove from soundwire group to properly close the soundwire port configuration. Change-Id: I278e7510869200bc1236eb45968bc8d986a93a96 Signed-off-by: Sudheer Papothi Signed-off-by: Laxminath Kasam --- asoc/codecs/wsa883x/internal.h | 1 + asoc/codecs/wsa883x/wsa883x.c | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/asoc/codecs/wsa883x/internal.h b/asoc/codecs/wsa883x/internal.h index 5e19ac2ab2..1863aacf89 100644 --- a/asoc/codecs/wsa883x/internal.h +++ b/asoc/codecs/wsa883x/internal.h @@ -129,6 +129,7 @@ struct wsa883x_priv { struct cdc_regulator *regulator; int num_supplies; struct regulator_bulk_data *supplies; + unsigned long status_mask; }; #endif /* WSA883X_INTERNAL_H */ diff --git a/asoc/codecs/wsa883x/wsa883x.c b/asoc/codecs/wsa883x/wsa883x.c index 78d5e80382..af9291204d 100644 --- a/asoc/codecs/wsa883x/wsa883x.c +++ b/asoc/codecs/wsa883x/wsa883x.c @@ -117,6 +117,10 @@ enum { WSA8835, }; +enum { + SPKR_STATUS = 0, +}; + enum { WSA883X_IRQ_INT_SAF2WAR = 0, WSA883X_IRQ_INT_WAR2SAF, @@ -936,6 +940,10 @@ static int wsa883x_enable_swr_dac_port(struct snd_soc_dapm_widget *w, &ch_mask[0], &port_type[0]); break; case SND_SOC_DAPM_POST_PMD: + if (swr_set_device_group(wsa883x->swr_slave, SWR_GROUP_NONE)) + dev_err(component->dev, + "%s: set num ch failed\n", __func__); + swr_slvdev_datapath_control(wsa883x->swr_slave, wsa883x->swr_slave->dev_num, false); @@ -971,6 +979,7 @@ static int wsa883x_spkr_event(struct snd_soc_dapm_widget *w, 0x01, 0x01); schedule_delayed_work(&wsa883x->vbat_work, msecs_to_jiffies(wsa883x_vbat_timer_sec * 1000)); + set_bit(SPKR_STATUS, &wsa883x->status_mask); break; case SND_SOC_DAPM_PRE_PMD: cancel_delayed_work_sync(&wsa883x->vbat_work); @@ -983,6 +992,7 @@ static int wsa883x_spkr_event(struct snd_soc_dapm_widget *w, snd_soc_component_update_bits(component, WSA883X_PA_FSM_CTL, 0x01, 0x00); wcd_disable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_PDM_WD); + clear_bit(SPKR_STATUS, &wsa883x->status_mask); break; } return 0; @@ -1281,7 +1291,8 @@ static int wsa883x_event_notify(struct notifier_block *nb, 0x01, 0x00); break; case BOLERO_WSA_EVT_PA_ON_POST_FSCLK: - snd_soc_component_update_bits(wsa883x->component, + if (test_bit(SPKR_STATUS, &wsa883x->status_mask)) + snd_soc_component_update_bits(wsa883x->component, WSA883X_PA_FSM_CTL, 0x01, 0x01); break;