ASoC: pxa: Convert poodle to use snd_soc_register_card()
Subsystems (5)
PATCH 1/3 ASoC: pxa: Convert poodle to use snd_soc_register_card()
Use snd_soc_register_card() instead of creating a "soc-audio" platform device.
Signed-off-by Axel Lin <[email protected]>
--- arch/arm/mach-pxa/poodle.c | 6 ++++++ sound/soc/pxa/poodle.c | 42 +++++++++++++++++++++++------------------- 2 files changed, 29 insertions(+), 19 deletions(-)
arch/arm/mach-pxa/poodle.c +6 -0
@@ -158,6 +158,11 @@ static struct scoop_pcmcia_config poodle_pcmcia_config = {EXPORT_SYMBOL (poodle_scoop_device); +static struct platform_device poodle_audio_device = { + .name ="poodle-audio" , + .id =-1 , +}; +/* LoCoMo device */ static struct resource locomo_resources[] = { [0 ] = {
@@ -407,6 +412,7 @@ static struct platform_device sharpsl_rom_device = {static struct platform_device *devices[]__initdata = { &poodle_locomo_device, &poodle_scoop_device, + &poodle_audio_device, &sharpsl_nand_device, &sharpsl_rom_device, };
sound/soc/pxa/poodle.c +23 -19
73 lines not on this page · raw message
Signature · 1 line
1.7.5.4
PATCH 2/3 ASoC: Convert poodle to table based DAPM and control init
Signed-off-by Axel Lin <[email protected]>
--- sound/soc/pxa/poodle.c | 23 ++++++++--------------- 1 files changed, 8 insertions(+), 15 deletions(-)
sound/soc/pxa/poodle.c +8 -15
@@ -214,7 +214,7 @@ SND_SOC_DAPM_SPK("Ext Spk", poodle_amp_event), };/* Corgi machine connections to the codec pins */ -static const struct snd_soc_dapm_route audio_map[] = { +static const struct snd_soc_dapm_route poodle_audio_map[] = {/* headphone connected to LHPOUT1, RHPOUT1 */ {"Headphone Jack" ,NULL ,"LHPOUT" },
@@ -246,25 +246,11 @@ static int poodle_wm8731_init(struct snd_soc_pcm_runtime *rtd) {struct snd_soc_codec *codec = rtd->codec;struct snd_soc_dapm_context *dapm = &codec->dapm; -int err;snd_soc_dapm_nc_pin (dapm,"LLINEIN" );snd_soc_dapm_nc_pin (dapm,"RLINEIN" );snd_soc_dapm_enable_pin (dapm,"MICIN" ); -/* Add poodle specific controls */ - err =snd_soc_add_controls (codec, wm8731_poodle_controls, -ARRAY_SIZE (wm8731_poodle_controls)); -if (err <0 ) -return err; - -/* Add poodle specific widgets */ -snd_soc_dapm_new_controls (dapm, wm8731_dapm_widgets, -ARRAY_SIZE (wm8731_dapm_widgets)); - -/* Set up poodle specific audio path audio_map */ -snd_soc_dapm_add_routes (dapm, audio_map,ARRAY_SIZE (audio_map)); -return 0 ; }
@@ -286,6 +272,13 @@ static struct snd_soc_card poodle = { .dai_link = &poodle_dai, .num_links = 1, .owner = THIS_MODULE, + + .controls = wm8731_poodle_controls, + .num_controls = ARRAY_SIZE(wm8731_poodle_controls), + .dapm_widgets = wm8731_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm8731_dapm_widgets), + .dapm_routes = poodle_audio_map, + .num_dapm_routes = ARRAY_SIZE(poodle_audio_map), };static int __devinit poodle_probe (struct platform_device *pdev)
Signature · 1 line
1.7.5.4
PATCH 3/3 ASoC: Use dai_fmt in poodle machine driver
In reply to Axel LinSigned-off-by Axel Lin <[email protected]>
--- sound/soc/pxa/poodle.c | 14 ++------------ 1 files changed, 2 insertions(+), 12 deletions(-)
sound/soc/pxa/poodle.c +2 -12
@@ -121,18 +121,6 @@ static int poodle_hw_params(struct snd_pcm_substream *substream,break ; } -/* set codec DAI configuration */ - ret =snd_soc_dai_set_fmt (codec_dai,SND_SOC_DAIFMT_I2S | -SND_SOC_DAIFMT_NB_NF |SND_SOC_DAIFMT_CBS_CFS ); -if (ret <0 ) -return ret; - -/* set cpu DAI configuration */ - ret =snd_soc_dai_set_fmt (cpu_dai,SND_SOC_DAIFMT_I2S | -SND_SOC_DAIFMT_NB_NF |SND_SOC_DAIFMT_CBS_CFS ); -if (ret <0 ) -return ret; -/* set the codec system clock for DAC and ADC */ ret =snd_soc_dai_set_sysclk (codec_dai,WM8731_SYSCLK_XTAL , clk,SND_SOC_CLOCK_IN );
@@ -263,6 +251,8 @@ static struct snd_soc_dai_link poodle_dai = { .platform_name = "pxa-pcm-audio", .codec_name = "wm8731.0-001b", .init = poodle_wm8731_init, + .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | + SND_SOC_DAIFMT_CBS_CFS, .ops = &poodle_ops, };
Signature · 1 line
1.7.5.4
Haojian Zhuang
maintainerQuoted 112 lines · Axel Lin
Use
snd_soc_register_card()instead of creating a "soc-audio" platform device.Signed-off-by Axel Lin <[email protected]>---
arch/arm/mach-pxa/poodle.c | 6 ++++++
sound/soc/pxa/poodle.c | 42 +++++++++++++++++++++++-------------------2 files changed, 29 insertions(+), 19 deletions(-)arch/arm/mach-pxa/poodle.c +6
-0@@ -158,6 +158,11 @@ static struct scoop_pcmcia_config poodle_pcmcia_config = { EXPORT_SYMBOL(poodle_scoop_device); +static struct platform_device poodle_audio_device = { + .name = "poodle-audio", + .id = -1, +}; + /* LoCoMo device */ static struct resource locomo_resources[] = { [0] = {@@ -407,6 +412,7 @@ static struct platform_device sharpsl_rom_device = { static struct platform_device *devices[] __initdata = { &poodle_locomo_device, &poodle_scoop_device, + &poodle_audio_device, &sharpsl_nand_device, &sharpsl_rom_device, };sound/soc/pxa/poodle.c +23
-20@@ -281,22 +281,18 @@ static struct snd_soc_dai_link poodle_dai = { }; /* poodle audio machine driver */ -static struct snd_soc_card snd_soc_poodle = { +static struct snd_soc_card poodle = { .name = "Poodle", .dai_link = &poodle_dai, .num_links = 1, .owner = THIS_MODULE, }; -static struct platform_device *poodle_snd_device; - -static int __init poodle_init (void ) +static int __devinit poodle_probe (struct platform_device *pdev) { + struct snd_soc_card *card = &poodle; int ret; - if (!machine_is_poodle()) - return -ENODEV; - locomo_gpio_set_dir(&poodle_locomo_device.dev, POODLE_LOCOMO_GPIO_AMP_ON, 0); /* should we mute HP at startup - burning power ?*/@@ -305,28 +301,36 @@ static int __init poodle_init(void) locomo_gpio_set_dir(&poodle_locomo_device.dev, POODLE_LOCOMO_GPIO_MUTE_R, 0); - poodle_snd_device = platform_device_alloc("soc-audio", -1); - if (!poodle_snd_device) - return -ENOMEM; - - platform_set_drvdata(poodle_snd_device, &snd_soc_poodle); - ret = platform_device_add(poodle_snd_device); + card->dev = &pdev->dev; + ret = snd_soc_register_card(card); if (ret) - platform_device_put(poodle_snd_device); - + dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", + ret); return ret; } -static void __exit poodle_exit(void) +static int __devexit poodle_remove(struct platform_device *pdev) { - platform_device_unregister(poodle_snd_device); + struct snd_soc_card *card = platform_get_drvdata(pdev); + + snd_soc_unregister_card(card); + return 0; } -module_init (poodle_init); -module_exit (poodle_exit); +static struct platform_driver poodle_driver = { + .driver = { + .name = "poodle-audio", + .owner = THIS_MODULE, + }, + .probe = poodle_probe, + .remove = __devexit_p(poodle_remove), +}; + +module_platform_driver (poodle_driver); /* Module information */ MODULE_AUTHOR("Richard Purdie"); MODULE_DESCRIPTION("ALSA SoC Poodle"); MODULE_LICENSE("GPL"); +MODULE_ALIAS ("platform:poodle-audio" ); --
Quoted 2 lines
1.7.5.4
Acked.
I think Mark can merge this patch series.
Best Regards
Haojian
Mark Brown
AppliedQuoted 1 line · Axel Lin
Use
snd_soc_register_card()instead of creating a "soc-audio" platform device.
Applied all, thanks.