From 45f3121615b2b354f7d95d30f795bc5fe0043e92 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Wed, 23 Nov 2011 16:55:34 -0800 Subject: ASoC: fsi-ak4642: modify specification method of FSI / ak464x Current fsi-ak4642 was using id_entry name in order to specify FSI port and ak464x codec. But it was no sense, no flexibility. Platform can specify FSI/ak464x pair by this patch. Acked-by: Paul Mundt Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- arch/arm/mach-shmobile/board-ap4evb.c | 15 ++++++++++++++- arch/arm/mach-shmobile/board-mackerel.c | 14 +++++++++++++- arch/sh/boards/mach-se/7724/setup.c | 14 +++++++++++++- 3 files changed, 40 insertions(+), 3 deletions(-) (limited to 'arch') diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c index a3aa0f6df964..ade98c2d9e81 100644 --- a/arch/arm/mach-shmobile/board-ap4evb.c +++ b/arch/arm/mach-shmobile/board-ap4evb.c @@ -762,9 +762,22 @@ static struct platform_device fsi_device = { }, }; +static struct fsi_ak4642_info fsi2_ak4643_info = { + .name = "AK4643", + .card = "FSI2A-AK4643", + .cpu_dai = "fsia-dai", + .codec = "ak4642-codec.0-0013", + .platform = "sh_fsi2", + .id = FSI_PORT_A, +}; + static struct platform_device fsi_ak4643_device = { - .name = "sh_fsi2_a_ak4643", + .name = "fsi-ak4642-audio", + .dev = { + .platform_data = &fsi_info, + }, }; + static struct sh_mobile_meram_cfg hdmi_meram_cfg = { .icb[0] = { .marker_icb = 30, diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index 9c5e598e0e3d..a2908d49a6df 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c @@ -990,8 +990,20 @@ static struct platform_device fsi_device = { }, }; +static struct fsi_ak4642_info fsi2_ak4643_info = { + .name = "AK4643", + .card = "FSI2A-AK4643", + .cpu_dai = "fsia-dai", + .codec = "ak4642-codec.0-0013", + .platform = "sh_fsi2", + .id = FSI_PORT_A, +}; + static struct platform_device fsi_ak4643_device = { - .name = "sh_fsi2_a_ak4643", + .name = "fsi-ak4642-audio", + .dev = { + .platform_data = &fsi2_ak4643_info, + }, }; /* diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c index b747c0ab9264..b49723b21912 100644 --- a/arch/sh/boards/mach-se/7724/setup.c +++ b/arch/sh/boards/mach-se/7724/setup.c @@ -315,8 +315,20 @@ static struct platform_device fsi_device = { }, }; +static struct fsi_ak4642_info fsi_ak4642_info = { + .name = "AK4642", + .card = "FSIA-AK4642", + .cpu_dai = "fsia-dai", + .codec = "ak4642-codec.0-0012", + .platform = "sh_fsi.0", + .id = FSI_PORT_A, +}; + static struct platform_device fsi_ak4642_device = { - .name = "sh_fsi_a_ak4642", + .name = "fsi-ak4642-audio", + .dev = { + .platform_data = &fsi_ak4642_info, + }, }; /* KEYSC in SoC (Needs SW33-2 set to ON) */ -- cgit v1.2.3 From 6414261f0a2af00c6ffc80f847e9202344360bb4 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 30 Nov 2011 13:30:27 +0000 Subject: ASoC: Rename Speyside WM8962 to Tobermory All the other machine drivers for non-default configurations are named after the relevant audio module so do so for Tobermory also. Signed-off-by: Mark Brown --- arch/arm/mach-s3c64xx/mach-crag6410.c | 6 +- sound/soc/samsung/Kconfig | 4 +- sound/soc/samsung/Makefile | 4 +- sound/soc/samsung/speyside_wm8962.c | 257 ---------------------------------- sound/soc/samsung/tobermory.c | 257 ++++++++++++++++++++++++++++++++++ 5 files changed, 264 insertions(+), 264 deletions(-) delete mode 100644 sound/soc/samsung/speyside_wm8962.c create mode 100644 sound/soc/samsung/tobermory.c (limited to 'arch') diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c index d04b65448510..55c0e75f5edc 100644 --- a/arch/arm/mach-s3c64xx/mach-crag6410.c +++ b/arch/arm/mach-s3c64xx/mach-crag6410.c @@ -282,8 +282,8 @@ static struct platform_device lowland_device = { .id = -1, }; -static struct platform_device speyside_wm8962_device = { - .name = "speyside-wm8962", +static struct platform_device tobermory_device = { + .name = "tobermory", .id = -1, }; @@ -338,7 +338,7 @@ static struct platform_device *crag6410_devices[] __initdata = { &crag6410_lcd_powerdev, &crag6410_backlight_device, &speyside_device, - &speyside_wm8962_device, + &tobermory_device, &lowland_device, &wallvdd_device, }; diff --git a/sound/soc/samsung/Kconfig b/sound/soc/samsung/Kconfig index 7aaaf8e8056f..09d636cc3658 100644 --- a/sound/soc/samsung/Kconfig +++ b/sound/soc/samsung/Kconfig @@ -193,8 +193,8 @@ config SND_SOC_SPEYSIDE select SND_SOC_WM9081 select SND_SOC_WM1250_EV1 -config SND_SOC_SPEYSIDE_WM8962 - tristate "Audio support for Wolfson Speyside with WM8962" +config SND_SOC_TOBERMORY + tristate "Audio support for Wolfson Tobermory" depends on SND_SOC_SAMSUNG && MACH_WLF_CRAGG_6410 select SND_SAMSUNG_I2S select SND_SOC_WM8962 diff --git a/sound/soc/samsung/Makefile b/sound/soc/samsung/Makefile index c9564e3547bb..9d03beb40c86 100644 --- a/sound/soc/samsung/Makefile +++ b/sound/soc/samsung/Makefile @@ -39,7 +39,7 @@ snd-soc-smdk-spdif-objs := smdk_spdif.o snd-soc-smdk-wm8580pcm-objs := smdk_wm8580pcm.o snd-soc-smdk-wm8994pcm-objs := smdk_wm8994pcm.o snd-soc-speyside-objs := speyside.o -snd-soc-speyside-wm8962-objs := speyside_wm8962.o +snd-soc-tobermory-objs := tobermory.o snd-soc-lowland-objs := lowland.o snd-soc-littlemill-objs := littlemill.o @@ -62,6 +62,6 @@ obj-$(CONFIG_SND_SOC_GONI_AQUILA_WM8994) += snd-soc-goni-wm8994.o obj-$(CONFIG_SND_SOC_SMDK_WM8580_PCM) += snd-soc-smdk-wm8580pcm.o obj-$(CONFIG_SND_SOC_SMDK_WM8994_PCM) += snd-soc-smdk-wm8994pcm.o obj-$(CONFIG_SND_SOC_SPEYSIDE) += snd-soc-speyside.o -obj-$(CONFIG_SND_SOC_SPEYSIDE_WM8962) += snd-soc-speyside-wm8962.o +obj-$(CONFIG_SND_SOC_TOBERMORY) += snd-soc-tobermory.o obj-$(CONFIG_SND_SOC_LOWLAND) += snd-soc-lowland.o obj-$(CONFIG_SND_SOC_LITTLEMILL) += snd-soc-littlemill.o diff --git a/sound/soc/samsung/speyside_wm8962.c b/sound/soc/samsung/speyside_wm8962.c deleted file mode 100644 index c09648efab61..000000000000 --- a/sound/soc/samsung/speyside_wm8962.c +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Speyside with WM8962 audio support - * - * Copyright 2011 Wolfson Microelectronics - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - */ - -#include -#include -#include -#include -#include - -#include "../codecs/wm8962.h" - -static int sample_rate = 44100; - -static int speyside_wm8962_set_bias_level(struct snd_soc_card *card, - struct snd_soc_dapm_context *dapm, - enum snd_soc_bias_level level) -{ - struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; - int ret; - - if (dapm->dev != codec_dai->dev) - return 0; - - switch (level) { - case SND_SOC_BIAS_PREPARE: - if (dapm->bias_level == SND_SOC_BIAS_STANDBY) { - ret = snd_soc_dai_set_pll(codec_dai, WM8962_FLL, - WM8962_FLL_MCLK, 32768, - sample_rate * 512); - if (ret < 0) - pr_err("Failed to start FLL: %d\n", ret); - - ret = snd_soc_dai_set_sysclk(codec_dai, - WM8962_SYSCLK_FLL, - sample_rate * 512, - SND_SOC_CLOCK_IN); - if (ret < 0) { - pr_err("Failed to set SYSCLK: %d\n", ret); - return ret; - } - } - break; - - default: - break; - } - - return 0; -} - -static int speyside_wm8962_set_bias_level_post(struct snd_soc_card *card, - struct snd_soc_dapm_context *dapm, - enum snd_soc_bias_level level) -{ - struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; - int ret; - - if (dapm->dev != codec_dai->dev) - return 0; - - switch (level) { - case SND_SOC_BIAS_STANDBY: - ret = snd_soc_dai_set_sysclk(codec_dai, WM8962_SYSCLK_MCLK, - 32768, SND_SOC_CLOCK_IN); - if (ret < 0) { - pr_err("Failed to switch away from FLL: %d\n", ret); - return ret; - } - - ret = snd_soc_dai_set_pll(codec_dai, WM8962_FLL, - 0, 0, 0); - if (ret < 0) { - pr_err("Failed to stop FLL: %d\n", ret); - return ret; - } - break; - - default: - break; - } - - dapm->bias_level = level; - - return 0; -} - -static int speyside_wm8962_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *params) -{ - sample_rate = params_rate(params); - - return 0; -} - -static struct snd_soc_ops speyside_wm8962_ops = { - .hw_params = speyside_wm8962_hw_params, -}; - -static struct snd_soc_dai_link speyside_wm8962_dai[] = { - { - .name = "CPU", - .stream_name = "CPU", - .cpu_dai_name = "samsung-i2s.0", - .codec_dai_name = "wm8962", - .platform_name = "samsung-audio", - .codec_name = "wm8962.1-001a", - .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF - | SND_SOC_DAIFMT_CBM_CFM, - .ops = &speyside_wm8962_ops, - }, -}; - -static const struct snd_kcontrol_new controls[] = { - SOC_DAPM_PIN_SWITCH("Main Speaker"), - SOC_DAPM_PIN_SWITCH("DMIC"), -}; - -static struct snd_soc_dapm_widget widgets[] = { - SND_SOC_DAPM_HP("Headphone", NULL), - SND_SOC_DAPM_MIC("Headset Mic", NULL), - - SND_SOC_DAPM_MIC("DMIC", NULL), - SND_SOC_DAPM_MIC("AMIC", NULL), - - SND_SOC_DAPM_SPK("Main Speaker", NULL), -}; - -static struct snd_soc_dapm_route audio_paths[] = { - { "Headphone", NULL, "HPOUTL" }, - { "Headphone", NULL, "HPOUTR" }, - - { "Main Speaker", NULL, "SPKOUTL" }, - { "Main Speaker", NULL, "SPKOUTR" }, - - { "Headset Mic", NULL, "MICBIAS" }, - { "IN4L", NULL, "Headset Mic" }, - { "IN4R", NULL, "Headset Mic" }, - - { "AMIC", NULL, "MICBIAS" }, - { "IN1L", NULL, "AMIC" }, - { "IN1R", NULL, "AMIC" }, - - { "DMIC", NULL, "MICBIAS" }, - { "DMICDAT", NULL, "DMIC" }, -}; - -static struct snd_soc_jack speyside_wm8962_headset; - -/* Headset jack detection DAPM pins */ -static struct snd_soc_jack_pin speyside_wm8962_headset_pins[] = { - { - .pin = "Headset Mic", - .mask = SND_JACK_MICROPHONE, - }, - { - .pin = "Headphone", - .mask = SND_JACK_MICROPHONE, - }, -}; - -static int speyside_wm8962_late_probe(struct snd_soc_card *card) -{ - struct snd_soc_codec *codec = card->rtd[0].codec; - struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; - int ret; - - ret = snd_soc_dai_set_sysclk(codec_dai, WM8962_SYSCLK_MCLK, - 32768, SND_SOC_CLOCK_IN); - if (ret < 0) - return ret; - - ret = snd_soc_jack_new(codec, "Headset", - SND_JACK_HEADSET | SND_JACK_BTN_0, - &speyside_wm8962_headset); - if (ret) - return ret; - - ret = snd_soc_jack_add_pins(&speyside_wm8962_headset, - ARRAY_SIZE(speyside_wm8962_headset_pins), - speyside_wm8962_headset_pins); - if (ret) - return ret; - - wm8962_mic_detect(codec, &speyside_wm8962_headset); - - return 0; -} - -static struct snd_soc_card speyside_wm8962 = { - .name = "Speyside WM8962", - .dai_link = speyside_wm8962_dai, - .num_links = ARRAY_SIZE(speyside_wm8962_dai), - - .set_bias_level = speyside_wm8962_set_bias_level, - .set_bias_level_post = speyside_wm8962_set_bias_level_post, - - .controls = controls, - .num_controls = ARRAY_SIZE(controls), - .dapm_widgets = widgets, - .num_dapm_widgets = ARRAY_SIZE(widgets), - .dapm_routes = audio_paths, - .num_dapm_routes = ARRAY_SIZE(audio_paths), - .fully_routed = true, - - .late_probe = speyside_wm8962_late_probe, -}; - -static __devinit int speyside_wm8962_probe(struct platform_device *pdev) -{ - struct snd_soc_card *card = &speyside_wm8962; - int ret; - - card->dev = &pdev->dev; - - ret = snd_soc_register_card(card); - if (ret) { - dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", - ret); - return ret; - } - - return 0; -} - -static int __devexit speyside_wm8962_remove(struct platform_device *pdev) -{ - struct snd_soc_card *card = platform_get_drvdata(pdev); - - snd_soc_unregister_card(card); - - return 0; -} - -static struct platform_driver speyside_wm8962_driver = { - .driver = { - .name = "speyside-wm8962", - .owner = THIS_MODULE, - .pm = &snd_soc_pm_ops, - }, - .probe = speyside_wm8962_probe, - .remove = __devexit_p(speyside_wm8962_remove), -}; - -module_platform_driver(speyside_wm8962_driver); - -MODULE_DESCRIPTION("Speyside WM8962 audio support"); -MODULE_AUTHOR("Mark Brown "); -MODULE_LICENSE("GPL"); -MODULE_ALIAS("platform:speyside-wm8962"); diff --git a/sound/soc/samsung/tobermory.c b/sound/soc/samsung/tobermory.c new file mode 100644 index 000000000000..6f91c65c5a0e --- /dev/null +++ b/sound/soc/samsung/tobermory.c @@ -0,0 +1,257 @@ +/* + * Tobermory audio support + * + * Copyright 2011 Wolfson Microelectronics + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ + +#include +#include +#include +#include +#include + +#include "../codecs/wm8962.h" + +static int sample_rate = 44100; + +static int tobermory_set_bias_level(struct snd_soc_card *card, + struct snd_soc_dapm_context *dapm, + enum snd_soc_bias_level level) +{ + struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; + int ret; + + if (dapm->dev != codec_dai->dev) + return 0; + + switch (level) { + case SND_SOC_BIAS_PREPARE: + if (dapm->bias_level == SND_SOC_BIAS_STANDBY) { + ret = snd_soc_dai_set_pll(codec_dai, WM8962_FLL, + WM8962_FLL_MCLK, 32768, + sample_rate * 512); + if (ret < 0) + pr_err("Failed to start FLL: %d\n", ret); + + ret = snd_soc_dai_set_sysclk(codec_dai, + WM8962_SYSCLK_FLL, + sample_rate * 512, + SND_SOC_CLOCK_IN); + if (ret < 0) { + pr_err("Failed to set SYSCLK: %d\n", ret); + return ret; + } + } + break; + + default: + break; + } + + return 0; +} + +static int tobermory_set_bias_level_post(struct snd_soc_card *card, + struct snd_soc_dapm_context *dapm, + enum snd_soc_bias_level level) +{ + struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; + int ret; + + if (dapm->dev != codec_dai->dev) + return 0; + + switch (level) { + case SND_SOC_BIAS_STANDBY: + ret = snd_soc_dai_set_sysclk(codec_dai, WM8962_SYSCLK_MCLK, + 32768, SND_SOC_CLOCK_IN); + if (ret < 0) { + pr_err("Failed to switch away from FLL: %d\n", ret); + return ret; + } + + ret = snd_soc_dai_set_pll(codec_dai, WM8962_FLL, + 0, 0, 0); + if (ret < 0) { + pr_err("Failed to stop FLL: %d\n", ret); + return ret; + } + break; + + default: + break; + } + + dapm->bias_level = level; + + return 0; +} + +static int tobermory_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + sample_rate = params_rate(params); + + return 0; +} + +static struct snd_soc_ops tobermory_ops = { + .hw_params = tobermory_hw_params, +}; + +static struct snd_soc_dai_link tobermory_dai[] = { + { + .name = "CPU", + .stream_name = "CPU", + .cpu_dai_name = "samsung-i2s.0", + .codec_dai_name = "wm8962", + .platform_name = "samsung-audio", + .codec_name = "wm8962.1-001a", + .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF + | SND_SOC_DAIFMT_CBM_CFM, + .ops = &tobermory_ops, + }, +}; + +static const struct snd_kcontrol_new controls[] = { + SOC_DAPM_PIN_SWITCH("Main Speaker"), + SOC_DAPM_PIN_SWITCH("DMIC"), +}; + +static struct snd_soc_dapm_widget widgets[] = { + SND_SOC_DAPM_HP("Headphone", NULL), + SND_SOC_DAPM_MIC("Headset Mic", NULL), + + SND_SOC_DAPM_MIC("DMIC", NULL), + SND_SOC_DAPM_MIC("AMIC", NULL), + + SND_SOC_DAPM_SPK("Main Speaker", NULL), +}; + +static struct snd_soc_dapm_route audio_paths[] = { + { "Headphone", NULL, "HPOUTL" }, + { "Headphone", NULL, "HPOUTR" }, + + { "Main Speaker", NULL, "SPKOUTL" }, + { "Main Speaker", NULL, "SPKOUTR" }, + + { "Headset Mic", NULL, "MICBIAS" }, + { "IN4L", NULL, "Headset Mic" }, + { "IN4R", NULL, "Headset Mic" }, + + { "AMIC", NULL, "MICBIAS" }, + { "IN1L", NULL, "AMIC" }, + { "IN1R", NULL, "AMIC" }, + + { "DMIC", NULL, "MICBIAS" }, + { "DMICDAT", NULL, "DMIC" }, +}; + +static struct snd_soc_jack tobermory_headset; + +/* Headset jack detection DAPM pins */ +static struct snd_soc_jack_pin tobermory_headset_pins[] = { + { + .pin = "Headset Mic", + .mask = SND_JACK_MICROPHONE, + }, + { + .pin = "Headphone", + .mask = SND_JACK_MICROPHONE, + }, +}; + +static int tobermory_late_probe(struct snd_soc_card *card) +{ + struct snd_soc_codec *codec = card->rtd[0].codec; + struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; + int ret; + + ret = snd_soc_dai_set_sysclk(codec_dai, WM8962_SYSCLK_MCLK, + 32768, SND_SOC_CLOCK_IN); + if (ret < 0) + return ret; + + ret = snd_soc_jack_new(codec, "Headset", + SND_JACK_HEADSET | SND_JACK_BTN_0, + &tobermory_headset); + if (ret) + return ret; + + ret = snd_soc_jack_add_pins(&tobermory_headset, + ARRAY_SIZE(tobermory_headset_pins), + tobermory_headset_pins); + if (ret) + return ret; + + wm8962_mic_detect(codec, &tobermory_headset); + + return 0; +} + +static struct snd_soc_card tobermory = { + .name = "Tobermory", + .dai_link = tobermory_dai, + .num_links = ARRAY_SIZE(tobermory_dai), + + .set_bias_level = tobermory_set_bias_level, + .set_bias_level_post = tobermory_set_bias_level_post, + + .controls = controls, + .num_controls = ARRAY_SIZE(controls), + .dapm_widgets = widgets, + .num_dapm_widgets = ARRAY_SIZE(widgets), + .dapm_routes = audio_paths, + .num_dapm_routes = ARRAY_SIZE(audio_paths), + .fully_routed = true, + + .late_probe = tobermory_late_probe, +}; + +static __devinit int tobermory_probe(struct platform_device *pdev) +{ + struct snd_soc_card *card = &tobermory; + int ret; + + card->dev = &pdev->dev; + + ret = snd_soc_register_card(card); + if (ret) { + dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", + ret); + return ret; + } + + return 0; +} + +static int __devexit tobermory_remove(struct platform_device *pdev) +{ + struct snd_soc_card *card = platform_get_drvdata(pdev); + + snd_soc_unregister_card(card); + + return 0; +} + +static struct platform_driver tobermory_driver = { + .driver = { + .name = "tobermory", + .owner = THIS_MODULE, + .pm = &snd_soc_pm_ops, + }, + .probe = tobermory_probe, + .remove = __devexit_p(tobermory_remove), +}; + +module_platform_driver(tobermory_driver); + +MODULE_DESCRIPTION("Tobermory audio support"); +MODULE_AUTHOR("Mark Brown "); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:tobermory"); -- cgit v1.2.3 From a0f203d384fadacba514748cd0095efeadeed96c Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Fri, 2 Dec 2011 15:08:37 -0700 Subject: ASoC: WM8903: Fix platform data gpio_cfg confusion wm8903_platform_data.gpio_cfg[] was intended to be interpreted as follows: 0: Don't touch this GPIO's configuration register 1..7fff: Write that value to the GPIO's configuration register 8000: Write zero to the GPIO's configuration register other: Undefined (invalid) The rationale is that platform data is usually global data, and a value of zero means that the field wasn't explicitly set to anything (e.g. because the field was new to the pdata type, and existing users weren't update to initialize it) and hence the value zero should be ignored. 0x8000 is an explicit way to get 0 in the register. The code worked this way until commit 7cfe561 "ASoC: wm8903: Expose GPIOs through gpiolib", where the behaviour was changed due to my lack of awareness of the above rationale. This patch reverts to the intended behaviour, and updates all in-tree users to use the correct scheme. This also makes WM8903 consistent with other devices that use a similar scheme. WM8903_GPIO_NO_CONFIG is also renamed to WM8903_GPIO_CONFIG_ZERO so that its name accurately reflects its purpose. Signed-off-by: Stephen Warren Cc: Olof Johansson Cc: Colin Cross Signed-off-by: Mark Brown --- arch/arm/mach-tegra/board-harmony.c | 8 ++++---- arch/arm/mach-tegra/board-seaboard.c | 8 ++++---- include/sound/wm8903.h | 7 +++++-- sound/soc/codecs/wm8903.c | 3 ++- 4 files changed, 15 insertions(+), 11 deletions(-) (limited to 'arch') diff --git a/arch/arm/mach-tegra/board-harmony.c b/arch/arm/mach-tegra/board-harmony.c index f0bdc5e3fe52..3c57cdcdff4d 100644 --- a/arch/arm/mach-tegra/board-harmony.c +++ b/arch/arm/mach-tegra/board-harmony.c @@ -89,11 +89,11 @@ static struct wm8903_platform_data harmony_wm8903_pdata = { .micdet_delay = 100, .gpio_base = HARMONY_GPIO_WM8903(0), .gpio_cfg = { - WM8903_GPIO_NO_CONFIG, - WM8903_GPIO_NO_CONFIG, 0, - WM8903_GPIO_NO_CONFIG, - WM8903_GPIO_NO_CONFIG, + 0, + WM8903_GPIO_CONFIG_ZERO, + 0, + 0, }, }; diff --git a/arch/arm/mach-tegra/board-seaboard.c b/arch/arm/mach-tegra/board-seaboard.c index bf13ea355efc..5c2f7751a33a 100644 --- a/arch/arm/mach-tegra/board-seaboard.c +++ b/arch/arm/mach-tegra/board-seaboard.c @@ -171,11 +171,11 @@ static struct wm8903_platform_data wm8903_pdata = { .micdet_delay = 100, .gpio_base = SEABOARD_GPIO_WM8903(0), .gpio_cfg = { - WM8903_GPIO_NO_CONFIG, - WM8903_GPIO_NO_CONFIG, 0, - WM8903_GPIO_NO_CONFIG, - WM8903_GPIO_NO_CONFIG, + 0, + WM8903_GPIO_CONFIG_ZERO, + 0, + 0, }, }; diff --git a/include/sound/wm8903.h b/include/sound/wm8903.h index cf7ccb76a8de..b310c5a3a958 100644 --- a/include/sound/wm8903.h +++ b/include/sound/wm8903.h @@ -11,8 +11,11 @@ #ifndef __LINUX_SND_WM8903_H #define __LINUX_SND_WM8903_H -/* Used to enable configuration of a GPIO to all zeros */ -#define WM8903_GPIO_NO_CONFIG 0x8000 +/* + * Used to enable configuration of a GPIO to all zeros; a gpio_cfg value of + * zero in platform data means "don't touch this pin". + */ +#define WM8903_GPIO_CONFIG_ZERO 0x8000 /* * R6 (0x06) - Mic Bias Control 0 diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index e6ecede576dc..184b67730c39 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c @@ -1893,7 +1893,8 @@ static int wm8903_probe(struct snd_soc_codec *codec) bool mic_gpio = false; for (i = 0; i < ARRAY_SIZE(pdata->gpio_cfg); i++) { - if (pdata->gpio_cfg[i] > 0x7fff) + if ((!pdata->gpio_cfg[i]) || + (pdata->gpio_cfg[i] > WM8903_GPIO_CONFIG_ZERO)) continue; snd_soc_write(codec, WM8903_GPIO_CONTROL_1 + i, -- cgit v1.2.3 From da76250e13256ec58f1b92256d847a7a8ebd9ce8 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Thu, 15 Dec 2011 11:32:26 +0200 Subject: OMAP4: mcbsp: Enable FIFO usage All McBSP instances on OMAP4 has 128 word long FIFO Signed-off-by: Peter Ujfalusi Acked-by: Tony Lindgren Signed-off-by: Mark Brown --- arch/arm/mach-omap2/mcbsp.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'arch') diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c index 292eee3be15f..857860b325b0 100644 --- a/arch/arm/mach-omap2/mcbsp.c +++ b/arch/arm/mach-omap2/mcbsp.c @@ -153,6 +153,9 @@ static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused) else /* The FIFO has 128 locations */ pdata->buffer_size = 0x80; + } else if (oh->class->rev == MCBSP_CONFIG_TYPE4) { + /* The FIFO has 128 locations for all instances */ + pdata->buffer_size = 0x80; } if (oh->class->rev >= MCBSP_CONFIG_TYPE3) -- cgit v1.2.3 From 62133829fa12a55902ac400b74e424c1ecd161b3 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 15 Dec 2011 10:52:42 +0800 Subject: ASoC: pxa: Convert e740_wm9705 to use snd_soc_register_card() Use snd_soc_register_card() instead of creating a "soc-audio" platform device. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- arch/arm/mach-pxa/eseries.c | 6 ++++ sound/soc/pxa/e740_wm9705.c | 75 +++++++++++++++++++-------------------------- 2 files changed, 38 insertions(+), 43 deletions(-) (limited to 'arch') diff --git a/arch/arm/mach-pxa/eseries.c b/arch/arm/mach-pxa/eseries.c index d82b7aa3c096..d157ca9f0f3c 100644 --- a/arch/arm/mach-pxa/eseries.c +++ b/arch/arm/mach-pxa/eseries.c @@ -525,12 +525,18 @@ static struct platform_device e740_t7l66xb_device = { .resource = eseries_tmio_resources, }; +static struct platform_device e740_audio_device = { + .name = "e740-audio", + .id = -1, +}; + /* ----------------------------------------------------------------------- */ static struct platform_device *e740_devices[] __initdata = { &e740_fb_device, &e740_t7l66xb_device, &e7xx_gpio_vbus, + &e740_audio_device, }; static void __init e740_init(void) diff --git a/sound/soc/pxa/e740_wm9705.c b/sound/soc/pxa/e740_wm9705.c index 818dc57b0b2f..203ab78a4d68 100644 --- a/sound/soc/pxa/e740_wm9705.c +++ b/sound/soc/pxa/e740_wm9705.c @@ -137,66 +137,55 @@ static struct snd_soc_card e740 = { .num_links = ARRAY_SIZE(e740_dai), }; -static struct platform_device *e740_snd_device; +static struct gpio e740_audio_gpios[] = { + { GPIO_E740_MIC_ON, GPIOF_OUT_INIT_LOW, "Mic amp" }, + { GPIO_E740_AMP_ON, GPIOF_OUT_INIT_LOW, "Output amp" }, + { GPIO_E740_WM9705_nAVDD2, GPIOF_OUT_INIT_HIGH, "Audio power" }, +}; -static int __init e740_init(void) +static int __devinit e740_probe(struct platform_device *pdev) { + struct snd_soc_card *card = &e740; int ret; - if (!machine_is_e740()) - return -ENODEV; - - /* Disable audio */ - ret = gpio_request_one(GPIO_E740_MIC_ON, GPIOF_OUT_INIT_LOW, "Mic amp"); + ret = gpio_request_array(e740_audio_gpios, + ARRAY_SIZE(e740_audio_gpios)); if (ret) return ret; - ret = gpio_request_one(GPIO_E740_AMP_ON, GPIOF_OUT_INIT_LOW, - "Output amp"); - if (ret) - goto free_mic_amp_gpio; + card->dev = &pdev->dev; - ret = gpio_request_one(GPIO_E740_WM9705_nAVDD2, GPIOF_OUT_INIT_HIGH, - "Audio power"); - if (ret) - goto free_op_amp_gpio; - - e740_snd_device = platform_device_alloc("soc-audio", -1); - if (!e740_snd_device) { - ret = -ENOMEM; - goto free_apwr_gpio; + ret = snd_soc_register_card(card); + if (ret) { + dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", + ret); + gpio_free_array(e740_audio_gpios, ARRAY_SIZE(e740_audio_gpios)); } - - platform_set_drvdata(e740_snd_device, &e740); - ret = platform_device_add(e740_snd_device); - - if (!ret) - return 0; - -/* Fail gracefully */ - platform_device_put(e740_snd_device); -free_apwr_gpio: - gpio_free(GPIO_E740_WM9705_nAVDD2); -free_op_amp_gpio: - gpio_free(GPIO_E740_AMP_ON); -free_mic_amp_gpio: - gpio_free(GPIO_E740_MIC_ON); - return ret; } -static void __exit e740_exit(void) +static int __devexit e740_remove(struct platform_device *pdev) { - platform_device_unregister(e740_snd_device); - gpio_free(GPIO_E740_WM9705_nAVDD2); - gpio_free(GPIO_E740_AMP_ON); - gpio_free(GPIO_E740_MIC_ON); + struct snd_soc_card *card = platform_get_drvdata(pdev); + + gpio_free_array(e740_audio_gpios, ARRAY_SIZE(e740_audio_gpios)); + snd_soc_unregister_card(card); + return 0; } -module_init(e740_init); -module_exit(e740_exit); +static struct platform_driver e740_driver = { + .driver = { + .name = "e740-audio", + .owner = THIS_MODULE, + }, + .probe = e740_probe, + .remove = __devexit_p(e740_remove), +}; + +module_platform_driver(e740_driver); /* Module information */ MODULE_AUTHOR("Ian Molton "); MODULE_DESCRIPTION("ALSA SoC driver for e740"); MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:e740-audio"); -- cgit v1.2.3 From 5eb2c3d9273ae63d6b347cde38fe15bda8be1361 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 15 Dec 2011 10:53:29 +0800 Subject: ASoC: pxa: Convert e750_wm9705 to use snd_soc_register_card() Use snd_soc_register_card() instead of creating a "soc-audio" platform device. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- arch/arm/mach-pxa/eseries.c | 6 +++++ sound/soc/pxa/e750_wm9705.c | 66 +++++++++++++++++++++------------------------ 2 files changed, 37 insertions(+), 35 deletions(-) (limited to 'arch') diff --git a/arch/arm/mach-pxa/eseries.c b/arch/arm/mach-pxa/eseries.c index d157ca9f0f3c..3abfdb908d4c 100644 --- a/arch/arm/mach-pxa/eseries.c +++ b/arch/arm/mach-pxa/eseries.c @@ -724,12 +724,18 @@ static struct platform_device e750_tc6393xb_device = { .resource = eseries_tmio_resources, }; +static struct platform_device e750_audio_device = { + .name = "e750-audio", + .id = -1, +}; + /* ------------------------------------------------------------- */ static struct platform_device *e750_devices[] __initdata = { &e750_fb_device, &e750_tc6393xb_device, &e7xx_gpio_vbus, + &e750_audio_device, }; static void __init e750_init(void) diff --git a/sound/soc/pxa/e750_wm9705.c b/sound/soc/pxa/e750_wm9705.c index 55c53d13bea6..27f90cc44234 100644 --- a/sound/soc/pxa/e750_wm9705.c +++ b/sound/soc/pxa/e750_wm9705.c @@ -120,58 +120,54 @@ static struct snd_soc_card e750 = { .num_links = ARRAY_SIZE(e750_dai), }; -static struct platform_device *e750_snd_device; +static struct gpio e750_audio_gpios[] = { + { GPIO_E750_HP_AMP_OFF, GPIOF_OUT_INIT_HIGH, "Headphone amp" }, + { GPIO_E750_SPK_AMP_OFF, GPIOF_OUT_INIT_HIGH, "Speaker amp" }, +}; -static int __init e750_init(void) +static int __devinit e750_probe(struct platform_device *pdev) { + struct snd_soc_card *card = &e750; int ret; - if (!machine_is_e750()) - return -ENODEV; - - ret = gpio_request_one(GPIO_E750_HP_AMP_OFF, GPIOF_OUT_INIT_HIGH, - "Headphone amp"); + ret = gpio_request_array(e750_audio_gpios, + ARRAY_SIZE(e750_audio_gpios)); if (ret) return ret; - ret = gpio_request_one(GPIO_E750_SPK_AMP_OFF, GPIOF_OUT_INIT_HIGH, - "Speaker amp"); - if (ret) - goto free_hp_amp_gpio; + card->dev = &pdev->dev; - e750_snd_device = platform_device_alloc("soc-audio", -1); - if (!e750_snd_device) { - ret = -ENOMEM; - goto free_spk_amp_gpio; + ret = snd_soc_register_card(card); + if (ret) { + dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", + ret); + gpio_free_array(e750_audio_gpios, ARRAY_SIZE(e750_audio_gpios)); } - - platform_set_drvdata(e750_snd_device, &e750); - ret = platform_device_add(e750_snd_device); - - if (!ret) - return 0; - -/* Fail gracefully */ - platform_device_put(e750_snd_device); -free_spk_amp_gpio: - gpio_free(GPIO_E750_SPK_AMP_OFF); -free_hp_amp_gpio: - gpio_free(GPIO_E750_HP_AMP_OFF); - return ret; } -static void __exit e750_exit(void) +static int __devexit e750_remove(struct platform_device *pdev) { - platform_device_unregister(e750_snd_device); - gpio_free(GPIO_E750_SPK_AMP_OFF); - gpio_free(GPIO_E750_HP_AMP_OFF); + struct snd_soc_card *card = platform_get_drvdata(pdev); + + gpio_free_array(e750_audio_gpios, ARRAY_SIZE(e750_audio_gpios)); + snd_soc_unregister_card(card); + return 0; } -module_init(e750_init); -module_exit(e750_exit); +static struct platform_driver e750_driver = { + .driver = { + .name = "e750-audio", + .owner = THIS_MODULE, + }, + .probe = e750_probe, + .remove = __devexit_p(e750_remove), +}; + +module_platform_driver(e750_driver); /* Module information */ MODULE_AUTHOR("Ian Molton "); MODULE_DESCRIPTION("ALSA SoC driver for e750"); MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:e750-audio"); -- cgit v1.2.3 From ac1e89860a89c9d91174bf5439689bba2e4f83bb Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 15 Dec 2011 10:55:24 +0800 Subject: ASoC: pxa: Convert imote2 to use snd_soc_register_card() Use snd_soc_register_card() instead of creating a "soc-audio" platform device. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- arch/arm/mach-pxa/stargate2.c | 6 ++++++ sound/soc/pxa/imote2.c | 41 ++++++++++++++++++++++++----------------- 2 files changed, 30 insertions(+), 17 deletions(-) (limited to 'arch') diff --git a/arch/arm/mach-pxa/stargate2.c b/arch/arm/mach-pxa/stargate2.c index 4c9a48bef569..b20972dba3f4 100644 --- a/arch/arm/mach-pxa/stargate2.c +++ b/arch/arm/mach-pxa/stargate2.c @@ -593,10 +593,16 @@ static struct pxa2xx_udc_mach_info imote2_udc_info __initdata = { .udc_command = sg2_udc_command, }; +static struct platform_device imote2_audio_device = { + .name = "imote2-audio", + .id = -1, +}; + static struct platform_device *imote2_devices[] = { &stargate2_flash_device, &imote2_leds, &sht15, + &imote2_audio_device, }; static void __init imote2_init(void) diff --git a/sound/soc/pxa/imote2.c b/sound/soc/pxa/imote2.c index 154fc6f23438..97d3aecfc203 100644 --- a/sound/soc/pxa/imote2.c +++ b/sound/soc/pxa/imote2.c @@ -70,39 +70,46 @@ static struct snd_soc_dai_link imote2_dai = { .ops = &imote2_asoc_ops, }; -static struct snd_soc_card snd_soc_imote2 = { +static struct snd_soc_card imote2 = { .name = "Imote2", .dai_link = &imote2_dai, .num_links = 1, }; -static struct platform_device *imote2_snd_device; - -static int __init imote2_asoc_init(void) +static int __devinit imote2_probe(struct platform_device *pdev) { + struct snd_soc_card *card = &imote2; int ret; - if (!machine_is_intelmote2()) - return -ENODEV; - imote2_snd_device = platform_device_alloc("soc-audio", -1); - if (!imote2_snd_device) - return -ENOMEM; + card->dev = &pdev->dev; - platform_set_drvdata(imote2_snd_device, &snd_soc_imote2); - ret = platform_device_add(imote2_snd_device); + ret = snd_soc_register_card(card); if (ret) - platform_device_put(imote2_snd_device); - + dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", + ret); return ret; } -module_init(imote2_asoc_init); -static void __exit imote2_asoc_exit(void) +static int __devexit imote2_remove(struct platform_device *pdev) { - platform_device_unregister(imote2_snd_device); + struct snd_soc_card *card = platform_get_drvdata(pdev); + + snd_soc_unregister_card(card); + return 0; } -module_exit(imote2_asoc_exit); + +static struct platform_driver imote2_driver = { + .driver = { + .name = "imote2-audio", + .owner = THIS_MODULE, + }, + .probe = imote2_probe, + .remove = __devexit_p(imote2_remove), +}; + +module_platform_driver(imote2_driver); MODULE_AUTHOR("Jonathan Cameron"); MODULE_DESCRIPTION("ALSA SoC Imote 2"); MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:imote2-audio"); -- cgit v1.2.3 From f285b8c83a8dccc70f168bb1eb6f04c8e36450a6 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 15 Dec 2011 10:57:22 +0800 Subject: ASoC: pxa: Convert tosa to use snd_soc_register_card() Use snd_soc_register_card() instead of creating a "soc-audio" platform device. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- arch/arm/mach-pxa/tosa.c | 6 ++++ sound/soc/pxa/tosa.c | 77 +++++++++++++++++++----------------------------- 2 files changed, 36 insertions(+), 47 deletions(-) (limited to 'arch') diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c index 402b0c96613b..9346d848e8d5 100644 --- a/arch/arm/mach-pxa/tosa.c +++ b/arch/arm/mach-pxa/tosa.c @@ -889,6 +889,11 @@ static struct platform_device wm9712_device = { .id = -1, }; +static struct platform_device tosa_audio_device = { + .name = "tosa-audio", + .id = -1, +}; + static struct platform_device *devices[] __initdata = { &tosascoop_device, &tosascoop_jc_device, @@ -901,6 +906,7 @@ static struct platform_device *devices[] __initdata = { &sharpsl_rom_device, &wm9712_device, &tosa_gpio_vbus, + &tosa_audio_device, }; static void tosa_poweroff(void) diff --git a/sound/soc/pxa/tosa.c b/sound/soc/pxa/tosa.c index 620fc69ae632..3f394de297a2 100644 --- a/sound/soc/pxa/tosa.c +++ b/sound/soc/pxa/tosa.c @@ -34,8 +34,6 @@ #include "../codecs/wm9712.h" #include "pxa2xx-ac97.h" -static struct snd_soc_card tosa; - #define TOSA_HP 0 #define TOSA_MIC_INT 1 #define TOSA_HEADSET 2 @@ -236,70 +234,55 @@ static struct snd_soc_dai_link tosa_dai[] = { }, }; -static int tosa_probe(struct snd_soc_card *card) -{ - int ret; - - ret = gpio_request(TOSA_GPIO_L_MUTE, "Headphone Jack"); - if (ret) - return ret; - ret = gpio_direction_output(TOSA_GPIO_L_MUTE, 0); - if (ret) - gpio_free(TOSA_GPIO_L_MUTE); - - return ret; -} - -static int tosa_remove(struct snd_soc_card *card) -{ - gpio_free(TOSA_GPIO_L_MUTE); - return 0; -} - static struct snd_soc_card tosa = { .name = "Tosa", .dai_link = tosa_dai, .num_links = ARRAY_SIZE(tosa_dai), - .probe = tosa_probe, - .remove = tosa_remove, }; -static struct platform_device *tosa_snd_device; - -static int __init tosa_init(void) +static int __devinit tosa_probe(struct platform_device *pdev) { + struct snd_soc_card *card = ⤩ int ret; - if (!machine_is_tosa()) - return -ENODEV; - - tosa_snd_device = platform_device_alloc("soc-audio", -1); - if (!tosa_snd_device) { - ret = -ENOMEM; - goto err_alloc; - } - - platform_set_drvdata(tosa_snd_device, &tosa); - ret = platform_device_add(tosa_snd_device); - - if (!ret) - return 0; + ret = gpio_request_one(TOSA_GPIO_L_MUTE, GPIOF_OUT_INIT_LOW, + "Headphone Jack"); + if (ret) + return ret; - platform_device_put(tosa_snd_device); + card->dev = &pdev->dev; -err_alloc: + ret = snd_soc_register_card(card); + if (ret) { + dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", + ret); + gpio_free(TOSA_GPIO_L_MUTE); + } return ret; } -static void __exit tosa_exit(void) +static int __devexit tosa_remove(struct platform_device *pdev) { - platform_device_unregister(tosa_snd_device); + struct snd_soc_card *card = platform_get_drvdata(pdev); + + gpio_free(TOSA_GPIO_L_MUTE); + snd_soc_unregister_card(card); + return 0; } -module_init(tosa_init); -module_exit(tosa_exit); +static struct platform_driver tosa_driver = { + .driver = { + .name = "tosa-audio", + .owner = THIS_MODULE, + }, + .probe = tosa_probe, + .remove = __devexit_p(tosa_remove), +}; + +module_platform_driver(tosa_driver); /* Module information */ MODULE_AUTHOR("Richard Purdie"); MODULE_DESCRIPTION("ALSA SoC Tosa"); MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:tosa-audio"); -- cgit v1.2.3 From 1eb0202dc7e45be5996416bc41489ae5a75485e5 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 15 Dec 2011 10:54:25 +0800 Subject: ASoC: pxa: Convert e800_wm9712 to use snd_soc_register_card() Use snd_soc_register_card() instead of creating a "soc-audio" platform device. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- arch/arm/mach-pxa/eseries.c | 6 +++++ sound/soc/pxa/e800_wm9712.c | 66 +++++++++++++++++++++------------------------ 2 files changed, 37 insertions(+), 35 deletions(-) (limited to 'arch') diff --git a/arch/arm/mach-pxa/eseries.c b/arch/arm/mach-pxa/eseries.c index 3abfdb908d4c..4bbc3facde69 100644 --- a/arch/arm/mach-pxa/eseries.c +++ b/arch/arm/mach-pxa/eseries.c @@ -936,12 +936,18 @@ static struct platform_device e800_tc6393xb_device = { .resource = eseries_tmio_resources, }; +static struct platform_device e800_audio_device = { + .name = "e800-audio", + .id = -1, +}; + /* ----------------------------------------------------------------------- */ static struct platform_device *e800_devices[] __initdata = { &e800_fb_device, &e800_tc6393xb_device, &e800_gpio_vbus, + &e800_audio_device, }; static void __init e800_init(void) diff --git a/sound/soc/pxa/e800_wm9712.c b/sound/soc/pxa/e800_wm9712.c index 478ff191ffb4..858bf94160c5 100644 --- a/sound/soc/pxa/e800_wm9712.c +++ b/sound/soc/pxa/e800_wm9712.c @@ -110,58 +110,54 @@ static struct snd_soc_card e800 = { .num_links = ARRAY_SIZE(e800_dai), }; -static struct platform_device *e800_snd_device; +static struct gpio e800_audio_gpios[] = { + { GPIO_E800_SPK_AMP_ON, GPIOF_OUT_INIT_HIGH, "Headphone amp" }, + { GPIO_E800_HP_AMP_OFF, GPIOF_OUT_INIT_HIGH, "Speaker amp" }, +}; -static int __init e800_init(void) +static int __devinit e800_probe(struct platform_device *pdev) { + struct snd_soc_card *card = &e800; int ret; - if (!machine_is_e800()) - return -ENODEV; - - ret = gpio_request_one(GPIO_E800_HP_AMP_OFF, GPIOF_OUT_INIT_HIGH, - "Headphone amp"); + ret = gpio_request_array(e800_audio_gpios, + ARRAY_SIZE(e800_audio_gpios)); if (ret) return ret; - ret = gpio_request_one(GPIO_E800_SPK_AMP_ON, GPIOF_OUT_INIT_HIGH, - "Speaker amp"); - if (ret) - goto free_hp_amp_gpio; + card->dev = &pdev->dev; - e800_snd_device = platform_device_alloc("soc-audio", -1); - if (!e800_snd_device) { - ret = -ENOMEM; - goto free_spk_amp_gpio; + ret = snd_soc_register_card(card); + if (ret) { + dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", + ret); + gpio_free_array(e800_audio_gpios, ARRAY_SIZE(e800_audio_gpios)); } - - platform_set_drvdata(e800_snd_device, &e800); - ret = platform_device_add(e800_snd_device); - - if (!ret) - return 0; - -/* Fail gracefully */ - platform_device_put(e800_snd_device); -free_spk_amp_gpio: - gpio_free(GPIO_E800_SPK_AMP_ON); -free_hp_amp_gpio: - gpio_free(GPIO_E800_HP_AMP_OFF); - return ret; } -static void __exit e800_exit(void) +static int __devexit e800_remove(struct platform_device *pdev) { - platform_device_unregister(e800_snd_device); - gpio_free(GPIO_E800_SPK_AMP_ON); - gpio_free(GPIO_E800_HP_AMP_OFF); + struct snd_soc_card *card = platform_get_drvdata(pdev); + + gpio_free_array(e800_audio_gpios, ARRAY_SIZE(e800_audio_gpios)); + snd_soc_unregister_card(card); + return 0; } -module_init(e800_init); -module_exit(e800_exit); +static struct platform_driver e800_driver = { + .driver = { + .name = "e800-audio", + .owner = THIS_MODULE, + }, + .probe = e800_probe, + .remove = __devexit_p(e800_remove), +}; + +module_platform_driver(e800_driver); /* Module information */ MODULE_AUTHOR("Ian Molton "); MODULE_DESCRIPTION("ALSA SoC driver for e800"); MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:e800-audio"); -- cgit v1.2.3 From 2445ecc3c036ae5f1cc0c3dfed4731d9519a3811 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 30 Dec 2011 09:16:11 +0800 Subject: 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 Acked-by: Haojian Zhuang Signed-off-by: Mark Brown --- arch/arm/mach-pxa/poodle.c | 6 ++++++ sound/soc/pxa/poodle.c | 42 +++++++++++++++++++++++------------------- 2 files changed, 29 insertions(+), 19 deletions(-) (limited to 'arch') diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c index 50c833177866..bd5682a31f34 100644 --- a/arch/arm/mach-pxa/poodle.c +++ b/arch/arm/mach-pxa/poodle.c @@ -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, }; diff --git a/sound/soc/pxa/poodle.c b/sound/soc/pxa/poodle.c index 4c29bc1f9cfe..c9e24bf51763 100644 --- a/sound/soc/pxa/poodle.c +++ b/sound/soc/pxa/poodle.c @@ -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"); -- cgit v1.2.3 From 34be9244c7d8107ab9a46af53869f826648fccc8 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 30 Dec 2011 11:18:13 +0800 Subject: ASoC: pxa: Convert corgi to use snd_soc_register_card() Use snd_soc_register_card() instead of creating a "soc-audio" platform device. Signed-off-by: Axel Lin Acked-by: Haojian Zhuang Signed-off-by: Mark Brown --- arch/arm/mach-pxa/corgi.c | 9 +++++++++ sound/soc/pxa/corgi.c | 43 +++++++++++++++++++++++-------------------- 2 files changed, 32 insertions(+), 20 deletions(-) (limited to 'arch') diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c index 549468d088b9..e12b097a5b7e 100644 --- a/arch/arm/mach-pxa/corgi.c +++ b/arch/arm/mach-pxa/corgi.c @@ -435,6 +435,14 @@ static struct platform_device corgiled_device = { }, }; +/* + * Corgi Audio + */ +static struct platform_device corgi_audio_device = { + .name = "corgi-audio", + .id = -1, +}; + /* * MMC/SD Device * @@ -641,6 +649,7 @@ static struct platform_device *devices[] __initdata = { &corgifb_device, &corgikbd_device, &corgiled_device, + &corgi_audio_device, &sharpsl_nand_device, &sharpsl_rom_device, }; diff --git a/sound/soc/pxa/corgi.c b/sound/soc/pxa/corgi.c index 30ebce26dd9d..bc21944851c4 100644 --- a/sound/soc/pxa/corgi.c +++ b/sound/soc/pxa/corgi.c @@ -291,7 +291,7 @@ static struct snd_soc_dai_link corgi_dai = { }; /* corgi audio machine driver */ -static struct snd_soc_card snd_soc_corgi = { +static struct snd_soc_card corgi = { .name = "Corgi", .owner = THIS_MODULE, .dai_link = &corgi_dai, @@ -305,38 +305,41 @@ static struct snd_soc_card snd_soc_corgi = { .num_dapm_routes = ARRAY_SIZE(corgi_audio_map), }; -static struct platform_device *corgi_snd_device; - -static int __init corgi_init(void) +static int __devinit corgi_probe(struct platform_device *pdev) { + struct snd_soc_card *card = &corgi; int ret; - if (!(machine_is_corgi() || machine_is_shepherd() || - machine_is_husky())) - return -ENODEV; - - corgi_snd_device = platform_device_alloc("soc-audio", -1); - if (!corgi_snd_device) - return -ENOMEM; - - platform_set_drvdata(corgi_snd_device, &snd_soc_corgi); - ret = platform_device_add(corgi_snd_device); + card->dev = &pdev->dev; + ret = snd_soc_register_card(card); if (ret) - platform_device_put(corgi_snd_device); - + dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", + ret); return ret; } -static void __exit corgi_exit(void) +static int __devexit corgi_remove(struct platform_device *pdev) { - platform_device_unregister(corgi_snd_device); + struct snd_soc_card *card = platform_get_drvdata(pdev); + + snd_soc_unregister_card(card); + return 0; } -module_init(corgi_init); -module_exit(corgi_exit); +static struct platform_driver corgi_driver = { + .driver = { + .name = "corgi-audio", + .owner = THIS_MODULE, + }, + .probe = corgi_probe, + .remove = __devexit_p(corgi_remove), +}; + +module_platform_driver(corgi_driver); /* Module information */ MODULE_AUTHOR("Richard Purdie"); MODULE_DESCRIPTION("ALSA SoC Corgi"); MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:corgi-audio"); -- cgit v1.2.3