]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ASoC: Move active count from CODEC to component
authorLars-Peter Clausen <lars@metafoo.de>
Wed, 5 Mar 2014 12:17:47 +0000 (13:17 +0100)
committerMark Brown <broonie@linaro.org>
Thu, 6 Mar 2014 09:04:55 +0000 (17:04 +0800)
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>
include/sound/soc.h
sound/soc/soc-pcm.c

index 5c2b4f4b5cfaa9a87e23832de8ce31fe7ede91cd..0495b4aaeb7017498047edd713550c3cc3794ee1 100644 (file)
@@ -660,6 +660,9 @@ struct snd_soc_component {
        const char *name;
        int id;
        struct device *dev;
+
+       unsigned int active;
+
        struct list_head list;
 
        struct snd_soc_dai_driver *dai_drv;
@@ -687,7 +690,6 @@ struct snd_soc_codec {
 
        /* runtime */
        struct snd_ac97 *ac97;  /* for ad-hoc ac97 devices */
-       unsigned int active;
        unsigned int cache_bypass:1; /* Suppress access to the cache */
        unsigned int suspended:1; /* Codec is in suspend PM state */
        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)
        return 1;
 }
 
+static inline bool snd_soc_component_is_active(
+       struct snd_soc_component *component)
+{
+       return component->active != 0;
+}
+
 static inline bool snd_soc_codec_is_active(struct snd_soc_codec *codec)
 {
-       return codec->active != 0;
+       return snd_soc_component_is_active(&codec->component);
 }
 
 int snd_soc_util_init(void);
index 71a01dda1867e54dbd4de8a6c268501ebb60df4d..98b46295785de60d8a337c22c9fa7c3470cf2348 100644 (file)
@@ -61,9 +61,8 @@ void snd_soc_runtime_activate(struct snd_soc_pcm_runtime *rtd, int stream)
 
        cpu_dai->active++;
        codec_dai->active++;
-       if (cpu_dai->codec)
-               cpu_dai->codec->active++;
-       codec_dai->codec->active++;
+       cpu_dai->component->active++;
+       codec_dai->component->active++;
 }
 
 /**
@@ -93,9 +92,8 @@ void snd_soc_runtime_deactivate(struct snd_soc_pcm_runtime *rtd, int stream)
 
        cpu_dai->active--;
        codec_dai->active--;
-       if (cpu_dai->codec)
-               cpu_dai->codec->active--;
-       codec_dai->codec->active--;
+       cpu_dai->component->active--;
+       codec_dai->component->active--;
 }
 
 /**