Update snd_soc_card_get_codec() to take the codec number
Subsystems (5)
PATCH v2 1/1 Update snd_soc_card_get_codec() to take the codec number
Update function snd_soc_card_get_codec() and all the drivers that call it to take a codec number in addition to a codec name. This is necessary for codec drivers that register multiple instances of themselves that differ only by codec number.
Signed-off-by Timur Tabi <[email protected]>
---
I have only tested this code on the MPC8610, so please test this on other platforms before committing.
include/sound/soc-card.h | 2 +- sound/soc/at91/eti_b1_wm8731.c | 2 +- sound/soc/fsl/mpc8610_hpcd.c | 10 +++++----- sound/soc/imx/imx32ads-wm8350.c | 2 +- sound/soc/pxa/amesom_tlv320.c | 2 +- sound/soc/pxa/corgi.c | 2 +- sound/soc/pxa/e800_wm9712.c | 2 +- sound/soc/pxa/h5000.c | 2 +- sound/soc/pxa/magician.c | 2 +- sound/soc/pxa/mainstone_wm8753.c | 2 +- sound/soc/pxa/mainstone_wm9712.c | 2 +- sound/soc/pxa/mainstone_wm9713.c | 2 +- sound/soc/pxa/poodle.c | 2 +- sound/soc/pxa/spitz.c | 2 +- sound/soc/pxa/tosa.c | 2 +- sound/soc/pxa/zylonite.c | 2 +- sound/soc/soc-core.c | 5 +++-- 17 files changed, 23 insertions(+), 22 deletions(-)
include/sound/soc-card.h +1 -1
@@ -44,7 +44,7 @@ struct snd_ac97_bus_ops *snd_soc_card_get_ac97_ops( struct snd_soc_card *soc_card, const char *dai_id);struct snd_soc_codec *snd_soc_card_get_codec (struct snd_soc_card *soc_card, -const char *codec_id); +const char *codec_name,int codec_num);struct snd_soc_platform *snd_soc_card_get_platform (struct snd_soc_card *soc_card,const char *platform_id);
sound/soc/at91/eti_b1_wm8731.c +1 -1
@@ -242,7 +242,7 @@ static int eti_b1_init(struct snd_soc_card *soc_card)struct at91_ssc_periph *ssc;int ret; - codec =snd_soc_card_get_codec (soc_card, wm8731_codec_id); + codec =snd_soc_card_get_codec (soc_card, wm8731_codec_id,0 );if (codec ==NULL )return -ENODEV ;
sound/soc/fsl/mpc8610_hpcd.c +5 -5
@@ -38,7 +38,6 @@* MPC8610 HPCD. Some of the data is taken from the device tree. */ struct mpc8610_hpcd_data { -char codec_name[32 ];struct snd_soc_card soc_card;struct ccsr_guts __iomem *guts;unsigned int num_configs;
@@ -47,8 +46,6 @@ struct mpc8610_hpcd_data {char pcm_name[32 ];char ssi_name[32 ];char codec_name[32 ]; -char platform_name[32 ]; -char cpu_dai_name[32 ]; } names[MAX_SSI ]; };
@@ -99,7 +96,8 @@ static int mpc8610_hpcd_audio_init(struct snd_soc_card *soc_card)for (i =0 ; i < soc_card_data->num_configs; i++) { codec =snd_soc_card_get_codec (soc_card, - soc_card_data->names[i].codec_name); + soc_card_data->names[i].codec_name, + soc_card_data->configs[i].codec_num);if (!codec) {dev_err (soc_card->dev,"could not find codec\n" );
@@ -111,7 +109,9 @@ static int mpc8610_hpcd_audio_init(struct snd_soc_card *soc_card)*/ ret =snd_soc_card_init_codec (codec, soc_card);if (ret <0 ) { -dev_err (soc_card->dev,"could not initialize codec\n" ); +dev_err (soc_card->dev, +"could not initialize codec %s-%u\n" , + codec->name, codec->num);continue ; } }
sound/soc/imx/imx32ads-wm8350.c +1 -1
@@ -407,7 +407,7 @@ int imx32_audio_init(struct snd_soc_card *soc_card)if (pcm_runtime ==NULL )return -ENODEV ; - codec =snd_soc_card_get_codec (soc_card, wm8350_codec_id); + codec =snd_soc_card_get_codec (soc_card, wm8350_codec_id,0 );if (codec ==NULL )return -ENODEV ;
sound/soc/pxa/amesom_tlv320.c +1 -1
@@ -134,7 +134,7 @@ static int amesom_tlv320_init(struct snd_soc_card *soc_card) {struct snd_soc_codec *codec; - codec =snd_soc_card_get_codec (soc_card, tlv320_codec_id); + codec =snd_soc_card_get_codec (soc_card, tlv320_codec_id,0 );if (codec ==NULL )return -ENODEV ;
sound/soc/pxa/corgi.c +1 -1
@@ -313,7 +313,7 @@ static int corgi_init(struct snd_soc_card *soc_card)struct snd_soc_codec *codec;int ret; - codec =snd_soc_card_get_codec (soc_card, wm8731_codec_id); + codec =snd_soc_card_get_codec (soc_card, wm8731_codec_id,0 );if (codec ==NULL )return -ENODEV ;
sound/soc/pxa/e800_wm9712.c +1 -1
@@ -50,7 +50,7 @@ static int e800_init(struct snd_soc_card *soc_card)struct snd_ac97_bus_ops *ac97_ops;int ret; - codec =snd_soc_card_get_codec (soc_card, wm9712_codec_id); + codec =snd_soc_card_get_codec (soc_card, wm9712_codec_id,0 );if (codec ==NULL )return -ENODEV ;
sound/soc/pxa/h5000.c +1 -1
@@ -272,7 +272,7 @@ static int h5000_ak4535_init (struct snd_soc_card *soc_card)struct snd_soc_codec *codec;int ret; - codec =snd_soc_card_get_codec (soc_card, ak4535_codec_id); + codec =snd_soc_card_get_codec (soc_card, ak4535_codec_id,0 );if (codec ==NULL )return -ENODEV ;
sound/soc/pxa/magician.c +1 -1
@@ -436,7 +436,7 @@ static int magician_uda1380_init(struct snd_soc_card *soc_card)struct snd_soc_codec *codec;int ret; - codec =snd_soc_card_get_codec (soc_card, uda1380_codec_id); + codec =snd_soc_card_get_codec (soc_card, uda1380_codec_id,0 );if (codec ==NULL )return -ENODEV ;
sound/soc/pxa/mainstone_wm8753.c +1 -1
@@ -328,7 +328,7 @@ static int mainstone_wm8753_init(struct snd_soc_card *soc_card)struct snd_soc_codec *codec;int ret; - codec =snd_soc_card_get_codec (soc_card, wm8753_codec_id); + codec =snd_soc_card_get_codec (soc_card, wm8753_codec_id,0 );if (codec ==NULL )return -ENODEV ;
sound/soc/pxa/mainstone_wm9712.c +1 -1
@@ -81,7 +81,7 @@ static int mainstone_wm9712_init(struct snd_soc_card *soc_card)struct snd_ac97_bus_ops *ac97_ops;int ret; - codec =snd_soc_card_get_codec (soc_card, wm9712_codec_id); + codec =snd_soc_card_get_codec (soc_card, wm9712_codec_id,0 );if (codec ==NULL )return -ENODEV ;
sound/soc/pxa/mainstone_wm9713.c +1 -1
@@ -163,7 +163,7 @@ static int mainstone_wm9713_init(struct snd_soc_card *soc_card)struct snd_ac97_bus_ops *ac97_ops;int ret; - codec =snd_soc_card_get_codec (soc_card, wm9713_codec_id); + codec =snd_soc_card_get_codec (soc_card, wm9713_codec_id,0 );if (codec ==NULL )return -ENODEV ;
sound/soc/pxa/poodle.c +1 -1
@@ -264,7 +264,7 @@ static int poodle_init(struct snd_soc_card *soc_card)struct snd_soc_codec *codec;int ret; - codec =snd_soc_card_get_codec (soc_card, wm8731_codec_id); + codec =snd_soc_card_get_codec (soc_card, wm8731_codec_id,0 );if (codec ==NULL )return -ENODEV ;
sound/soc/pxa/spitz.c +1 -1
@@ -315,7 +315,7 @@ static int spitz_init(struct snd_soc_card *soc_card)struct snd_soc_codec *codec;int ret; - codec =snd_soc_card_get_codec (soc_card, wm8750_codec_id); + codec =snd_soc_card_get_codec (soc_card, wm8750_codec_id,0 );if (codec ==NULL )return -ENODEV ;
sound/soc/pxa/tosa.c +1 -1
@@ -211,7 +211,7 @@ static int tosa_init(struct snd_soc_card *soc_card)struct snd_ac97_bus_ops *ac97_ops;int ret; - codec =snd_soc_card_get_codec (soc_card, wm9712_codec_id); + codec =snd_soc_card_get_codec (soc_card, wm9712_codec_id,0 );if (codec ==NULL )return -ENODEV ;
sound/soc/pxa/zylonite.c +1 -1
@@ -93,7 +93,7 @@ static int zylonite_init(struct snd_soc_card *card)struct snd_ac97_bus_ops *ac97_ops;int ret; - codec =snd_soc_card_get_codec (card, wm9713_codec_id); + codec =snd_soc_card_get_codec (card, wm9713_codec_id,0 );if (codec ==NULL ) {printk (KERN_ERR "Unable to obtain WM9713 codec\n" );return -ENODEV ;
sound/soc/soc-core.c +3 -2
@@ -2172,12 +2172,13 @@ EXPORT_SYMBOL_GPL(snd_soc_card_free);* Get a codec from a codec ID. */ struct snd_soc_codec *snd_soc_card_get_codec (struct snd_soc_card *soc_card, -const char *codec_id) +const char *codec_name,int codec_num) {struct soc_pcm_config *config;list_for_each_entry (config, &soc_card->config_list, list) { -if (config->codec && !strcmp (config->codec->name, codec_id)) +if (config->codec && !strcmp (config->codec->name, codec_name) + && config->codec->num == codec_num)return config->codec; }return NULL ;
Signature · 1 line
1.5.5
Quoted 6 lines · Timur Tabi
Update function
snd_soc_card_get_codec()and all the drivers that call it to take a codec number in addition to a codec name. This is necessary for codec drivers that register multiple instances of themselves that differ only by codec number.Signed-off-by Timur Tabi <[email protected]>
Looks good - thanks!