ASoC: soc-core: Generalize snd_soc_prefix_map and rename to snd_soc_codec_conf
authorDimitris Papastamos <dp@opensource.wolfsonmicro.com>
Thu, 2 Dec 2010 14:53:03 +0000 (14:53 +0000)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Fri, 3 Dec 2010 16:36:45 +0000 (16:36 +0000)
The snd_soc_codec_conf struct now holds codec specific configuration
information.

A new configuration option has been added to allow machine drivers to
override the compression type set by the codec driver.

In the absence of providing an snd_soc_codec_conf struct or when providing
one but not setting the compress_type member to anything, the one supplied
by the codec driver will be used instead.  In all other cases the one
set in the snd_soc_codec_conf struct takes effect.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Acked-by: Jarkko Nikula <jhnikula@gmail.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
include/sound/soc.h
sound/soc/soc-core.c

index 24db9101c87d10dbda2d7f5b0c3aab35c9e8bece..cf76021f04a7b92c69471eb310a51535c0e579cb 100644 (file)
@@ -581,9 +581,20 @@ struct snd_soc_dai_link {
        struct snd_soc_ops *ops;
 };
 
-struct snd_soc_prefix_map {
+struct snd_soc_codec_conf {
        const char *dev_name;
+
+       /*
+        * optional map of kcontrol, widget and path name prefixes that are
+        * associated per device
+        */
        const char *name_prefix;
+
+       /*
+        * set this to the desired compression type if you want to
+        * override the one supplied in codec->driver->compress_type
+        */
+       enum snd_soc_compress_type compress_type;
 };
 
 struct snd_soc_aux_dev {
@@ -628,12 +639,9 @@ struct snd_soc_card {
        struct snd_soc_pcm_runtime *rtd;
        int num_rtd;
 
-       /*
-        * optional map of kcontrol, widget and path name prefixes that are
-        * associated per device
-        */
-       struct snd_soc_prefix_map *prefix_map;
-       int num_prefixes;
+       /* optional codec specific configuration */
+       struct snd_soc_codec_conf *codec_conf;
+       int num_configs;
 
        /*
         * optional auxiliary devices such as amplifiers or codecs with DAI
index 1fd1d1a62af154f1894607e38fdb9ed25520b759..4649db6163b83e15f7c3557317b3c095f4a00233 100644 (file)
@@ -1401,11 +1401,11 @@ static void soc_set_name_prefix(struct snd_soc_card *card,
 {
        int i;
 
-       if (card->prefix_map == NULL)
+       if (card->codec_conf == NULL)
                return;
 
-       for (i = 0; i < card->num_prefixes; i++) {
-               struct snd_soc_prefix_map *map = &card->prefix_map[i];
+       for (i = 0; i < card->num_configs; i++) {
+               struct snd_soc_codec_conf *map = &card->codec_conf[i];
                if (map->dev_name && !strcmp(codec->name, map->dev_name)) {
                        codec->name_prefix = map->name_prefix;
                        break;