summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2019-07-26 00:50:34 -0400
committerMark Brown <broonie@kernel.org>2019-08-05 11:20:16 -0400
commit66c51573b89d0a5c1089139a2f0dd029a755c37d (patch)
tree49546b960d4dab2ccc334060b8466d4a2fde1a68
parent5693d50c830272cb3c4a04d2ce4db502debd1259 (diff)
ASoC: soc-component: add snd_soc_component_suspend()
Current ALSA SoC is directly using component->driver->xxx, thus, it is deep nested, and makes code difficult to read, and is not good for encapsulation. This patch adds new snd_soc_component_suspend() and use it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/877e855rn0.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--include/sound/soc-component.h1
-rw-r--r--sound/soc/soc-component.c7
-rw-r--r--sound/soc/soc-core.c4
3 files changed, 9 insertions, 3 deletions
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index 302e27a89d47..cdb014f41fd1 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -353,5 +353,6 @@ int snd_soc_component_hw_free(struct snd_soc_component *component,
353int snd_soc_component_trigger(struct snd_soc_component *component, 353int snd_soc_component_trigger(struct snd_soc_component *component,
354 struct snd_pcm_substream *substream, 354 struct snd_pcm_substream *substream,
355 int cmd); 355 int cmd);
356void snd_soc_component_suspend(struct snd_soc_component *component);
356 357
357#endif /* __SOC_COMPONENT_H */ 358#endif /* __SOC_COMPONENT_H */
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index cf0d20a877e6..f0e63cd991c8 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -347,3 +347,10 @@ int snd_soc_component_trigger(struct snd_soc_component *component,
347 347
348 return 0; 348 return 0;
349} 349}
350
351void snd_soc_component_suspend(struct snd_soc_component *component)
352{
353 if (component->driver->suspend)
354 component->driver->suspend(component);
355 component->suspended = 1;
356}
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 9ba19efcc56c..855b19abc1d2 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -520,9 +520,7 @@ int snd_soc_suspend(struct device *dev)
520 /* fall through */ 520 /* fall through */
521 521
522 case SND_SOC_BIAS_OFF: 522 case SND_SOC_BIAS_OFF:
523 if (component->driver->suspend) 523 snd_soc_component_suspend(component);
524 component->driver->suspend(component);
525 component->suspended = 1;
526 if (component->regmap) 524 if (component->regmap)
527 regcache_mark_dirty(component->regmap); 525 regcache_mark_dirty(component->regmap);
528 /* deactivate pins to sleep state */ 526 /* deactivate pins to sleep state */