]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
ASoC: Add compress_type as a member to snd_soc_codec
authorDimitris Papastamos <dp@opensource.wolfsonmicro.com>
Thu, 2 Dec 2010 14:53:01 +0000 (14:53 +0000)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Fri, 3 Dec 2010 16:36:03 +0000 (16:36 +0000)
We need to keep a copy of the compress_type supplied by the codec driver
so that we can override it if necessary with whatever the machine driver
has provided us with.  The reason for not modifying the codec->driver
struct directly is that ideally we'd like to keep it const.

Adjust the code in soc-cache and soc-core to make use of the compress_type
member in the snd_soc_codec struct.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.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-cache.c
sound/soc/soc-core.c

index 714a70441bf2a5230929ffe4500413c7ea5b0844..586bfb99fedbbaebb75429e9ecf33d050e8f3050 100644 (file)
@@ -460,6 +460,7 @@ struct snd_soc_codec {
        struct list_head list;
        struct list_head card_list;
        int num_dai;
+       enum snd_soc_compress_type compress_type;
 
        /* runtime */
        struct snd_ac97 *ac97;  /* for ad-hoc ac97 devices */
index 78b25e8c03f6ed20767ab08dfceac7a30bc5f8cb..cb58b11d4f473a656bab4f82d11db83f01ce6652 100644 (file)
@@ -1550,11 +1550,11 @@ int snd_soc_cache_init(struct snd_soc_codec *codec)
        int i;
 
        for (i = 0; i < ARRAY_SIZE(cache_types); ++i)
-               if (cache_types[i].id == codec->driver->compress_type)
+               if (cache_types[i].id == codec->compress_type)
                        break;
        if (i == ARRAY_SIZE(cache_types)) {
                dev_err(codec->dev, "Could not match compress type: %d\n",
-                       codec->driver->compress_type);
+                       codec->compress_type);
                return -EINVAL;
        }
 
index 2b1fcae4131ea23ddb1cd5c1fd710e415a2fcbe6..1fd1d1a62af154f1894607e38fdb9ed25520b759 100644 (file)
@@ -3450,6 +3450,11 @@ int snd_soc_register_codec(struct device *dev,
                return -ENOMEM;
        }
 
+       if (codec_drv->compress_type)
+               codec->compress_type = codec_drv->compress_type;
+       else
+               codec->compress_type = SND_SOC_FLAT_COMPRESSION;
+
        INIT_LIST_HEAD(&codec->dapm.widgets);
        INIT_LIST_HEAD(&codec->dapm.paths);
        codec->write = codec_drv->write;