diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-25 08:32:05 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-25 08:32:05 -0700 |
commit | 33081adf8b89d5a716d7e1c60171768d39795b39 (patch) | |
tree | 275de58bbbb5f7ddffcdc087844cfc7fbe4315be /sound/soc/codecs/pcm3008.c | |
parent | c55960499f810357a29659b32d6ea594abee9237 (diff) | |
parent | 506ecbca71d07fa327dd986be1682e90885678ee (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6: (365 commits)
ALSA: hda - Disable sticky PCM stream assignment for AD codecs
ALSA: usb - Creative USB X-Fi volume knob support
ALSA: ca0106: Use card specific dac id for mute controls.
ALSA: ca0106: Allow different sound cards to use different SPI channel mappings.
ALSA: ca0106: Create a nice spot for mapping channels to dacs.
ALSA: ca0106: Move enabling of front dac out of hardcoded setup sequence.
ALSA: ca0106: Pull out dac powering routine into separate function.
ALSA: ca0106 - add Sound Blaster 5.1vx info.
ASoC: tlv320dac33: Use usleep_range for delays
ALSA: usb-audio: add Novation Launchpad support
ALSA: hda - Add workarounds for CT-IBG controllers
ALSA: hda - Fix wrong TLV mute bit for STAC/IDT codecs
ASoC: tpa6130a2: Error handling for broken chip
ASoC: max98088: Staticise m98088_eq_band
ASoC: soc-core: Fix codec->name memory leak
ALSA: hda - Apply ideapad quirk to Acer laptops with Cxt5066
ALSA: hda - Add some workarounds for Creative IBG
ALSA: hda - Fix wrong SPDIF NID assignment for CA0110
ALSA: hda - Fix codec rename rules for ALC662-compatible codecs
ALSA: hda - Add alc_init_jacks() call to other codecs
...
Diffstat (limited to 'sound/soc/codecs/pcm3008.c')
-rw-r--r-- | sound/soc/codecs/pcm3008.c | 92 |
1 files changed, 38 insertions, 54 deletions
diff --git a/sound/soc/codecs/pcm3008.c b/sound/soc/codecs/pcm3008.c index 5a5f187a265..bd8f26e4160 100644 --- a/sound/soc/codecs/pcm3008.c +++ b/sound/soc/codecs/pcm3008.c @@ -32,8 +32,8 @@ #define PCM3008_RATES (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \ SNDRV_PCM_RATE_48000) -struct snd_soc_dai pcm3008_dai = { - .name = "PCM3008 HiFi", +static struct snd_soc_dai_driver pcm3008_dai = { + .name = "pcm3008-hifi", .playback = { .stream_name = "PCM3008 Playback", .channels_min = 1, @@ -49,7 +49,6 @@ struct snd_soc_dai pcm3008_dai = { .formats = SNDRV_PCM_FMTBIT_S16_LE, }, }; -EXPORT_SYMBOL_GPL(pcm3008_dai); static void pcm3008_gpio_free(struct pcm3008_setup_data *setup) { @@ -59,38 +58,13 @@ static void pcm3008_gpio_free(struct pcm3008_setup_data *setup) gpio_free(setup->pdda_pin); } -static int pcm3008_soc_probe(struct platform_device *pdev) +static int pcm3008_soc_probe(struct snd_soc_codec *codec) { - struct snd_soc_device *socdev = platform_get_drvdata(pdev); - struct snd_soc_codec *codec; - struct pcm3008_setup_data *setup = socdev->codec_data; + struct pcm3008_setup_data *setup = codec->dev->platform_data; int ret = 0; printk(KERN_INFO "PCM3008 SoC Audio Codec %s\n", PCM3008_VERSION); - socdev->card->codec = kzalloc(sizeof(struct snd_soc_codec), GFP_KERNEL); - if (!socdev->card->codec) - return -ENOMEM; - - codec = socdev->card->codec; - mutex_init(&codec->mutex); - - codec->name = "PCM3008"; - codec->owner = THIS_MODULE; - codec->dai = &pcm3008_dai; - codec->num_dai = 1; - codec->write = NULL; - codec->read = NULL; - INIT_LIST_HEAD(&codec->dapm_widgets); - INIT_LIST_HEAD(&codec->dapm_paths); - - /* Register PCMs. */ - ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); - if (ret < 0) { - printk(KERN_ERR "pcm3008: failed to create pcms\n"); - goto pcm_err; - } - /* DEM1 DEM0 DE-EMPHASIS_MODE * Low Low De-emphasis 44.1 kHz ON * Low High De-emphasis OFF @@ -130,33 +104,22 @@ static int pcm3008_soc_probe(struct platform_device *pdev) gpio_err: pcm3008_gpio_free(setup); -pcm_err: - kfree(socdev->card->codec); return ret; } -static int pcm3008_soc_remove(struct platform_device *pdev) +static int pcm3008_soc_remove(struct snd_soc_codec *codec) { - struct snd_soc_device *socdev = platform_get_drvdata(pdev); - struct snd_soc_codec *codec = socdev->card->codec; - struct pcm3008_setup_data *setup = socdev->codec_data; - - if (!codec) - return 0; + struct pcm3008_setup_data *setup = codec->dev->platform_data; pcm3008_gpio_free(setup); - snd_soc_free_pcms(socdev); - kfree(socdev->card->codec); - return 0; } #ifdef CONFIG_PM -static int pcm3008_soc_suspend(struct platform_device *pdev, pm_message_t msg) +static int pcm3008_soc_suspend(struct snd_soc_codec *codec, pm_message_t msg) { - struct snd_soc_device *socdev = platform_get_drvdata(pdev); - struct pcm3008_setup_data *setup = socdev->codec_data; + struct pcm3008_setup_data *setup = codec->dev->platform_data; gpio_set_value(setup->pdad_pin, 0); gpio_set_value(setup->pdda_pin, 0); @@ -164,10 +127,9 @@ static int pcm3008_soc_suspend(struct platform_device *pdev, pm_message_t msg) return 0; } -static int pcm3008_soc_resume(struct platform_device *pdev) +static int pcm3008_soc_resume(struct snd_soc_codec *codec) { - struct snd_soc_device *socdev = platform_get_drvdata(pdev); - struct pcm3008_setup_data *setup = socdev->codec_data; + struct pcm3008_setup_data *setup = codec->dev->platform_data; gpio_set_value(setup->pdad_pin, 1); gpio_set_value(setup->pdda_pin, 1); @@ -179,23 +141,45 @@ static int pcm3008_soc_resume(struct platform_device *pdev) #define pcm3008_soc_resume NULL #endif -struct snd_soc_codec_device soc_codec_dev_pcm3008 = { +static struct snd_soc_codec_driver soc_codec_dev_pcm3008 = { .probe = pcm3008_soc_probe, .remove = pcm3008_soc_remove, .suspend = pcm3008_soc_suspend, .resume = pcm3008_soc_resume, }; -EXPORT_SYMBOL_GPL(soc_codec_dev_pcm3008); -static int __init pcm3008_init(void) +static int __devinit pcm3008_codec_probe(struct platform_device *pdev) +{ + return snd_soc_register_codec(&pdev->dev, + &soc_codec_dev_pcm3008, &pcm3008_dai, 1); +} + +static int __devexit pcm3008_codec_remove(struct platform_device *pdev) +{ + snd_soc_unregister_codec(&pdev->dev); + return 0; +} + +MODULE_ALIAS("platform:pcm3008-codec"); + +static struct platform_driver pcm3008_codec_driver = { + .probe = pcm3008_codec_probe, + .remove = __devexit_p(pcm3008_codec_remove), + .driver = { + .name = "pcm3008-codec", + .owner = THIS_MODULE, + }, +}; + +static int __init pcm3008_modinit(void) { - return snd_soc_register_dai(&pcm3008_dai); + return platform_driver_register(&pcm3008_codec_driver); } -module_init(pcm3008_init); +module_init(pcm3008_modinit); static void __exit pcm3008_exit(void) { - snd_soc_unregister_dai(&pcm3008_dai); + platform_driver_unregister(&pcm3008_codec_driver); } module_exit(pcm3008_exit); |