2020-11-28 05:12:33

by Srinivasa Rao Mandadapu

[permalink] [raw]
Subject: [PATCH v4 2/2] ASoC: qcom: Add support for playback recover after resume

To support playback continuation after hard suspend(bypass powerd)
and resume add component driver ops and do regcache sync.

Signed-off-by: V Sujith Kumar Reddy <[email protected]>
Signed-off-by: Srinivasa Rao Mandadapu <[email protected]>
---
sound/soc/qcom/lpass-platform.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)

diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index 0e71899..12764a8 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -827,6 +827,39 @@ static void lpass_platform_pcm_free(struct snd_soc_component *component,
}
}

+static int lpass_platform_pcmops_suspend(struct snd_soc_component *component)
+{
+ struct lpass_data *drvdata = snd_soc_component_get_drvdata(component);
+ struct regmap *map;
+ unsigned int dai_id = component->id;
+
+ if (dai_id == LPASS_DP_RX)
+ map = drvdata->hdmiif_map;
+ else
+ map = drvdata->lpaif_map;
+
+ regcache_cache_only(map, true);
+ regcache_mark_dirty(map);
+
+ return 0;
+}
+
+static int lpass_platform_pcmops_resume(struct snd_soc_component *component)
+{
+ struct lpass_data *drvdata = snd_soc_component_get_drvdata(component);
+ struct regmap *map;
+ unsigned int dai_id = component->id;
+
+ if (dai_id == LPASS_DP_RX)
+ map = drvdata->hdmiif_map;
+ else
+ map = drvdata->lpaif_map;
+
+ regcache_cache_only(map, false);
+ return regcache_sync(map);
+}
+
+
static const struct snd_soc_component_driver lpass_component_driver = {
.name = DRV_NAME,
.open = lpass_platform_pcmops_open,
@@ -839,6 +872,8 @@ static const struct snd_soc_component_driver lpass_component_driver = {
.mmap = lpass_platform_pcmops_mmap,
.pcm_construct = lpass_platform_pcm_new,
.pcm_destruct = lpass_platform_pcm_free,
+ .suspend = lpass_platform_pcmops_suspend,
+ .resume = lpass_platform_pcmops_resume,

};

--
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.


2020-11-30 11:21:57

by Srinivas Kandagatla

[permalink] [raw]
Subject: Re: [PATCH v4 2/2] ASoC: qcom: Add support for playback recover after resume



On 28/11/2020 04:59, Srinivasa Rao Mandadapu wrote:
> To support playback continuation after hard suspend(bypass powerd)
> and resume add component driver ops and do regcache sync.
>
> Signed-off-by: V Sujith Kumar Reddy <[email protected]>
> Signed-off-by: Srinivasa Rao Mandadapu <[email protected]>

LGTM,

Reviewed-by: Srinivas Kandagatla <[email protected]>


> ---
> sound/soc/qcom/lpass-platform.c | 35 +++++++++++++++++++++++++++++++++++
> 1 file changed, 35 insertions(+)
>
> diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
> index 0e71899..12764a8 100644
> --- a/sound/soc/qcom/lpass-platform.c
> +++ b/sound/soc/qcom/lpass-platform.c
> @@ -827,6 +827,39 @@ static void lpass_platform_pcm_free(struct snd_soc_component *component,
> }
> }
>
> +static int lpass_platform_pcmops_suspend(struct snd_soc_component *component)
> +{
> + struct lpass_data *drvdata = snd_soc_component_get_drvdata(component);
> + struct regmap *map;
> + unsigned int dai_id = component->id;
> +
> + if (dai_id == LPASS_DP_RX)
> + map = drvdata->hdmiif_map;
> + else
> + map = drvdata->lpaif_map;
> +
> + regcache_cache_only(map, true);
> + regcache_mark_dirty(map);
> +
> + return 0;
> +}
> +
> +static int lpass_platform_pcmops_resume(struct snd_soc_component *component)
> +{
> + struct lpass_data *drvdata = snd_soc_component_get_drvdata(component);
> + struct regmap *map;
> + unsigned int dai_id = component->id;
> +
> + if (dai_id == LPASS_DP_RX)
> + map = drvdata->hdmiif_map;
> + else
> + map = drvdata->lpaif_map;
> +
> + regcache_cache_only(map, false);
> + return regcache_sync(map);
> +}
> +
> +
> static const struct snd_soc_component_driver lpass_component_driver = {
> .name = DRV_NAME,
> .open = lpass_platform_pcmops_open,
> @@ -839,6 +872,8 @@ static const struct snd_soc_component_driver lpass_component_driver = {
> .mmap = lpass_platform_pcmops_mmap,
> .pcm_construct = lpass_platform_pcm_new,
> .pcm_destruct = lpass_platform_pcm_free,
> + .suspend = lpass_platform_pcmops_suspend,
> + .resume = lpass_platform_pcmops_resume,
>
> };
>
>

2020-11-30 16:31:43

by Steev Klimaszewski

[permalink] [raw]
Subject: Re: [PATCH v4 2/2] ASoC: qcom: Add support for playback recover after resume


On 11/27/20 10:59 PM, Srinivasa Rao Mandadapu wrote:
> To support playback continuation after hard suspend(bypass powerd)
> and resume add component driver ops and do regcache sync.
>
> Signed-off-by: V Sujith Kumar Reddy <[email protected]>
> Signed-off-by: Srinivasa Rao Mandadapu <[email protected]>
> ---
> sound/soc/qcom/lpass-platform.c | 35 +++++++++++++++++++++++++++++++++++
> 1 file changed, 35 insertions(+)
>
> diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
> index 0e71899..12764a8 100644
> --- a/sound/soc/qcom/lpass-platform.c
> +++ b/sound/soc/qcom/lpass-platform.c
> @@ -827,6 +827,39 @@ static void lpass_platform_pcm_free(struct snd_soc_component *component,
> }
> }
>
> +static int lpass_platform_pcmops_suspend(struct snd_soc_component *component)
> +{
> + struct lpass_data *drvdata = snd_soc_component_get_drvdata(component);
> + struct regmap *map;
> + unsigned int dai_id = component->id;
> +
> + if (dai_id == LPASS_DP_RX)
> + map = drvdata->hdmiif_map;
> + else
> + map = drvdata->lpaif_map;
> +
> + regcache_cache_only(map, true);
> + regcache_mark_dirty(map);
> +
> + return 0;
> +}
> +
> +static int lpass_platform_pcmops_resume(struct snd_soc_component *component)
> +{
> + struct lpass_data *drvdata = snd_soc_component_get_drvdata(component);
> + struct regmap *map;
> + unsigned int dai_id = component->id;
> +
> + if (dai_id == LPASS_DP_RX)
> + map = drvdata->hdmiif_map;
> + else
> + map = drvdata->lpaif_map;
> +
> + regcache_cache_only(map, false);
> + return regcache_sync(map);
> +}
> +
> +
> static const struct snd_soc_component_driver lpass_component_driver = {
> .name = DRV_NAME,
> .open = lpass_platform_pcmops_open,
> @@ -839,6 +872,8 @@ static const struct snd_soc_component_driver lpass_component_driver = {
> .mmap = lpass_platform_pcmops_mmap,
> .pcm_construct = lpass_platform_pcm_new,
> .pcm_destruct = lpass_platform_pcm_free,
> + .suspend = lpass_platform_pcmops_suspend,
> + .resume = lpass_platform_pcmops_resume,
>
> };
>

Tested this series on a Lenovo Yoga C630

Tested-by: Steev Klimaszewski <[email protected]>