* [PATCH 0/3] ASoC: Laying the groundwork for compress_type overriding
@ 2010-12-02 14:53 Dimitris Papastamos
2010-12-02 14:53 ` [PATCH 1/3] ASoC: Add compress_type as a member to snd_soc_codec Dimitris Papastamos
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Dimitris Papastamos @ 2010-12-02 14:53 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood; +Cc: alsa-devel, patches
This patch series is to prepare ASoC for allowing the compress_type of the
codec to be overriden by the machine driver. Typically this will be done by
providing an snd_soc_codec_conf struct which will contain the new compress_type
in the machine driver.
Dimitris Papastamos (3):
ASoC: Add compress_type as a member to snd_soc_codec
ASoC: Change the base value of compress_type
ASoC: soc-core: Generalize snd_soc_prefix_map and rename to
snd_soc_codec_conf
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/3] ASoC: Add compress_type as a member to snd_soc_codec
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
2010-12-02 14:53 ` [PATCH 2/3] ASoC: Change the base value of compress_type Dimitris Papastamos
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Dimitris Papastamos @ 2010-12-02 14:53 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood; +Cc: alsa-devel, patches
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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/3] ASoC: Change the base value of compress_type
2010-12-02 14:53 [PATCH 0/3] ASoC: Laying the groundwork for compress_type overriding Dimitris Papastamos
2010-12-02 14:53 ` [PATCH 1/3] ASoC: Add compress_type as a member to snd_soc_codec Dimitris Papastamos
@ 2010-12-02 14:53 ` 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
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Dimitris Papastamos @ 2010-12-02 14:53 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood; +Cc: alsa-devel, patches
Ensure that the base value of compress_type starts at 1 so that
we know whether the machine driver has provided a compress_type
for overriding the codec supplied one.
Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
---
include/sound/soc.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 838ad36..a26cdf9 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -256,7 +256,7 @@ enum snd_soc_control_type {
};
enum snd_soc_compress_type {
- SND_SOC_FLAT_COMPRESSION,
+ SND_SOC_FLAT_COMPRESSION = 1,
SND_SOC_LZO_COMPRESSION,
SND_SOC_RBTREE_COMPRESSION
};
--
1.7.3.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] ASoC: soc-core: Generalize snd_soc_prefix_map and rename to snd_soc_codec_conf
2010-12-02 14:53 [PATCH 0/3] ASoC: Laying the groundwork for compress_type overriding Dimitris Papastamos
2010-12-02 14:53 ` [PATCH 1/3] ASoC: Add compress_type as a member to snd_soc_codec Dimitris Papastamos
2010-12-02 14:53 ` [PATCH 2/3] ASoC: Change the base value of compress_type Dimitris Papastamos
@ 2010-12-02 14:53 ` 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
4 siblings, 1 reply; 7+ messages in thread
From: Dimitris Papastamos @ 2010-12-02 14:53 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood; +Cc: alsa-devel, patches
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>
---
include/sound/soc.h | 22 +++++++++++++++-------
sound/soc/soc-core.c | 6 +++---
2 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/include/sound/soc.h b/include/sound/soc.h
index a26cdf9..4409e97 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -579,9 +579,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 {
@@ -626,12 +637,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
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 1f142ae..a6565eb 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -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;
--
1.7.3.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] ASoC: soc-core: Generalize snd_soc_prefix_map and rename to snd_soc_codec_conf
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
0 siblings, 0 replies; 7+ messages in thread
From: Jarkko Nikula @ 2010-12-02 15:26 UTC (permalink / raw)
To: Dimitris Papastamos; +Cc: alsa-devel, Mark Brown, patches, Liam Girdwood
On Thu, 2 Dec 2010 14:53:03 +0000
Dimitris Papastamos <dp@opensource.wolfsonmicro.com> wrote:
> 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>
> ---
> include/sound/soc.h | 22 +++++++++++++++-------
> sound/soc/soc-core.c | 6 +++---
> 2 files changed, 18 insertions(+), 10 deletions(-)
>
> diff --git a/include/sound/soc.h b/include/sound/soc.h
> index a26cdf9..4409e97 100644
> --- a/include/sound/soc.h
> +++ b/include/sound/soc.h
> @@ -579,9 +579,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;
No any objections from my side. Good to generalize this struct.
Acked-by: Jarkko Nikula <jhnikula@gmail.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/3] ASoC: Laying the groundwork for compress_type overriding
2010-12-02 14:53 [PATCH 0/3] ASoC: Laying the groundwork for compress_type overriding Dimitris Papastamos
` (2 preceding siblings ...)
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-03 16:15 ` Liam Girdwood
2010-12-03 16:41 ` Mark Brown
4 siblings, 0 replies; 7+ messages in thread
From: Liam Girdwood @ 2010-12-03 16:15 UTC (permalink / raw)
To: Dimitris Papastamos; +Cc: alsa-devel, Mark Brown, patches
On Thu, 2010-12-02 at 14:53 +0000, Dimitris Papastamos wrote:
> This patch series is to prepare ASoC for allowing the compress_type of the
> codec to be overriden by the machine driver. Typically this will be done by
> providing an snd_soc_codec_conf struct which will contain the new compress_type
> in the machine driver.
>
> Dimitris Papastamos (3):
> ASoC: Add compress_type as a member to snd_soc_codec
> ASoC: Change the base value of compress_type
> ASoC: soc-core: Generalize snd_soc_prefix_map and rename to
> snd_soc_codec_conf
>
> _______________________________________________
All
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
--
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/3] ASoC: Laying the groundwork for compress_type overriding
2010-12-02 14:53 [PATCH 0/3] ASoC: Laying the groundwork for compress_type overriding Dimitris Papastamos
` (3 preceding siblings ...)
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
4 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2010-12-03 16:41 UTC (permalink / raw)
To: Dimitris Papastamos; +Cc: alsa-devel, patches, Liam Girdwood
On Thu, Dec 02, 2010 at 02:53:00PM +0000, Dimitris Papastamos wrote:
> This patch series is to prepare ASoC for allowing the compress_type of the
> codec to be overriden by the machine driver. Typically this will be done by
> providing an snd_soc_codec_conf struct which will contain the new compress_type
> in the machine driver.
Applied, thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-12-03 16:41 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-02 14:53 [PATCH 0/3] ASoC: Laying the groundwork for compress_type overriding Dimitris Papastamos
2010-12-02 14:53 ` [PATCH 1/3] ASoC: Add compress_type as a member to snd_soc_codec Dimitris Papastamos
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
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.