aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2014-03-05 07:17:47 -0500
committerMark Brown <broonie@linaro.org>2014-03-06 04:04:55 -0500
commitcdde4ccb14b4959bd1c96a07367bf02b746328d3 (patch)
treed810edb5e51f268dfb1005a8e74ba90cc3dd9f69
parent6106d12947d1b05dc15ca3933eb514347d6ed726 (diff)
ASoC: Move active count from CODEC to component
There is no reason why active count tracking should only be done for CODECs but not for other components. Moving the active count from the snd_soc_codec struct to the snd_soc_component struct reduces the differences between CODECs and other components and will eventually allow component to component DAI links (Which is a prerequisite for converting CODECs to components). Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--include/sound/soc.h12
-rw-r--r--sound/soc/soc-pcm.c10
2 files changed, 14 insertions, 8 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 5c2b4f4b5cfa..0495b4aaeb70 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -660,6 +660,9 @@ struct snd_soc_component {
660 const char *name; 660 const char *name;
661 int id; 661 int id;
662 struct device *dev; 662 struct device *dev;
663
664 unsigned int active;
665
663 struct list_head list; 666 struct list_head list;
664 667
665 struct snd_soc_dai_driver *dai_drv; 668 struct snd_soc_dai_driver *dai_drv;
@@ -687,7 +690,6 @@ struct snd_soc_codec {
687 690
688 /* runtime */ 691 /* runtime */
689 struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */ 692 struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */
690 unsigned int active;
691 unsigned int cache_bypass:1; /* Suppress access to the cache */ 693 unsigned int cache_bypass:1; /* Suppress access to the cache */
692 unsigned int suspended:1; /* Codec is in suspend PM state */ 694 unsigned int suspended:1; /* Codec is in suspend PM state */
693 unsigned int probed:1; /* Codec has been probed */ 695 unsigned int probed:1; /* Codec has been probed */
@@ -1172,9 +1174,15 @@ static inline bool snd_soc_volsw_is_stereo(struct soc_mixer_control *mc)
1172 return 1; 1174 return 1;
1173} 1175}
1174 1176
1177static inline bool snd_soc_component_is_active(
1178 struct snd_soc_component *component)
1179{
1180 return component->active != 0;
1181}
1182
1175static inline bool snd_soc_codec_is_active(struct snd_soc_codec *codec) 1183static inline bool snd_soc_codec_is_active(struct snd_soc_codec *codec)
1176{ 1184{
1177 return codec->active != 0; 1185 return snd_soc_component_is_active(&codec->component);
1178} 1186}
1179 1187
1180int snd_soc_util_init(void); 1188int snd_soc_util_init(void);
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 71a01dda1867..98b46295785d 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -61,9 +61,8 @@ void snd_soc_runtime_activate(struct snd_soc_pcm_runtime *rtd, int stream)
61 61
62 cpu_dai->active++; 62 cpu_dai->active++;
63 codec_dai->active++; 63 codec_dai->active++;
64 if (cpu_dai->codec) 64 cpu_dai->component->active++;
65 cpu_dai->codec->active++; 65 codec_dai->component->active++;
66 codec_dai->codec->active++;
67} 66}
68 67
69/** 68/**
@@ -93,9 +92,8 @@ void snd_soc_runtime_deactivate(struct snd_soc_pcm_runtime *rtd, int stream)
93 92
94 cpu_dai->active--; 93 cpu_dai->active--;
95 codec_dai->active--; 94 codec_dai->active--;
96 if (cpu_dai->codec) 95 cpu_dai->component->active--;
97 cpu_dai->codec->active--; 96 codec_dai->component->active--;
98 codec_dai->codec->active--;
99} 97}
100 98
101/** 99/**