From: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>,
Liam Girdwood <lrg@slimlogic.co.uk>
Cc: alsa-devel@alsa-project.org, patches@opensource.wolfsonmicro.com
Subject: [PATCH 1/3] ASoC: Add compress_type as a member to snd_soc_codec
Date: Thu, 2 Dec 2010 14:53:01 +0000 [thread overview]
Message-ID: <1291301583-15491-2-git-send-email-dp@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1291301583-15491-1-git-send-email-dp@opensource.wolfsonmicro.com>
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>
---
include/sound/soc.h | 1 +
sound/soc/soc-cache.c | 4 ++--
sound/soc/soc-core.c | 5 +++++
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 4a9195c5..838ad36 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -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 */
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index 5143984..081221d 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -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;
}
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index eb950f7..1f142ae 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3446,6 +3446,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->dapm.bias_level = SND_SOC_BIAS_OFF;
--
1.7.3.2
next prev parent reply other threads:[~2010-12-02 14:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-02 14:53 [PATCH 0/3] ASoC: Laying the groundwork for compress_type overriding Dimitris Papastamos
2010-12-02 14:53 ` Dimitris Papastamos [this message]
2010-12-02 14:53 ` [PATCH 2/3] ASoC: Change the base value of compress_type Dimitris Papastamos
2010-12-02 14:53 ` [PATCH 3/3] ASoC: soc-core: Generalize snd_soc_prefix_map and rename to snd_soc_codec_conf Dimitris Papastamos
2010-12-02 15:26 ` Jarkko Nikula
2010-12-03 16:15 ` [PATCH 0/3] ASoC: Laying the groundwork for compress_type overriding Liam Girdwood
2010-12-03 16:41 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1291301583-15491-2-git-send-email-dp@opensource.wolfsonmicro.com \
--to=dp@opensource.wolfsonmicro.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=lrg@slimlogic.co.uk \
--cc=patches@opensource.wolfsonmicro.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox