/* * SiRF Technology, Inc. GPS Software * * Copyright (C) 2006 by SiRF Technology, Inc. All rights reserved. * * linux/sound/soc/sirf3a/identity_wm9713.c * * 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. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* * Machine Specific codefor ASoC driver * This will setup ac97 controller with wm9713 codec support */ #include #include #include #include #include #include #include #include #include #include /* DMA memory is used for the buffer even if no DMA for this architecture */ #include #include #include #include #ifdef CONFIG_ARM_AMBA_DMA # include #endif #include #include #include #include #include #include #include #include #include "../codecs/ac97.h" #include "platform_sound.h" #include "aaci.h" extern struct snd_soc_cpu_dai aaci_ac97_dai[]; extern struct snd_soc_codec_dai wm9713_dai[]; extern struct snd_soc_platform sirf3a_soc_platform; extern struct snd_soc_codec_device soc_codec_dev_wm9713; extern struct ac97_pcm ac97_defs[]; extern int sirf3a_ac97_probe(struct platform_device *); extern void sirf3a_ac97_remove(struct platform_device *); extern void snd_ac97_bus_proc_init(struct snd_ac97_bus *); extern void snd_ac97_bus_proc_done(struct snd_ac97_bus *); static int identity_wm9713_startup(snd_pcm_substream_t *substream) { return 0; } static struct snd_soc_ops identity_wm9713_ops = { .startup = identity_wm9713_startup, }; static int identity_wm9713_ac97_init(struct snd_soc_codec *codec) { struct platform_controller *controller = codec->ac97->bus->private_data; struct aaci *aaci = (struct aaci *)controller->bus_controller; snd_ac97_pcm_assign(codec->ac97->bus, 3, ac97_defs); aaci->ac97_bus = codec->ac97->bus; /* * * Disable AC97 PC Beep input on audio codecs. * */ if (ac97_is_audio(codec->ac97)) snd_ac97_write_cache(codec->ac97, AC97_PC_BEEP, 0x801e); return 0; } unsigned int identity_wm9713_config_sysclk(struct snd_soc_pcm_runtime *rtd, struct snd_soc_clock_info *info) { return rtd->codec_dai->config_sysclk(rtd->codec_dai, info, 12187500); } static struct snd_soc_dai_link identity_wm9713_dai[] = { { .name = "AC97", .stream_name = "AC97 HiFi", .cpu_dai = &aaci_ac97_dai[0], .codec_dai = &wm9713_dai[0], .init = identity_wm9713_ac97_init, .config_sysclk = identity_wm9713_config_sysclk, }, /* { .name = "WM9713", .stream_name = "BLUETOOTH VOICE", .cpu_dai = &aaci_ac97_dai[1], .codec_dai = &wm9713_dai[2], }, */ }; int identity_wm9713_probe(struct platform_device *pdev) { int ret = 0; struct snd_soc_device *socdev; socdev = platform_get_drvdata(pdev); socdev->machine->dai_link->cpu_dai->probe = sirf3a_ac97_probe; socdev->machine->dai_link->cpu_dai->remove = sirf3a_ac97_remove; return ret; } int identity_wm9713_suspend_pre(struct platform_device *pdev, pm_message_t state) { struct snd_soc_device *socdev = platform_get_drvdata(pdev); struct snd_soc_codec *codec = socdev->codec; struct snd_soc_codec_dai *dai = codec->dai; struct platform_controller *controller = dai->private_data; controller->state.event = state.event; return 0; } int identity_wm9713_resume_post(struct platform_device *pdev) { struct snd_soc_device *socdev = platform_get_drvdata(pdev); struct snd_soc_codec *codec = socdev->codec; struct snd_soc_codec_dai *dai = codec->dai; struct platform_controller *controller = dai->private_data; controller->state.event = PM_EVENT_ON; return 0; } static struct snd_soc_machine identity_wm9713 = { .name = "IDENTITY", .probe = identity_wm9713_probe, .suspend_pre = identity_wm9713_suspend_pre, .resume_post = identity_wm9713_resume_post, .dai_link = identity_wm9713_dai, .num_links = ARRAY_SIZE(identity_wm9713_dai), .ops = &identity_wm9713_ops, }; static struct snd_soc_device identity_wm9713_snd_devdata = { .machine = &identity_wm9713, .platform = &sirf3a_soc_platform, .codec_dev = &soc_codec_dev_wm9713, }; extern struct platform_device identity_snd_device; struct platform_device *pidentity_wm9713_snd_device = &identity_snd_device; static int __init identity_wm9713_init(void) { int ret; device_initialize(&pidentity_wm9713_snd_device->dev); platform_set_drvdata(pidentity_wm9713_snd_device, &identity_wm9713_snd_devdata); identity_wm9713_snd_devdata.dev = &pidentity_wm9713_snd_device->dev; ret = platform_device_add(pidentity_wm9713_snd_device); if (ret) platform_device_put(pidentity_wm9713_snd_device); return ret; } static void __exit identity_wm9713_exit(void) { platform_device_unregister(pidentity_wm9713_snd_device); } module_init(identity_wm9713_init); module_exit(identity_wm9713_exit); /* Module information */ MODULE_AUTHOR("Nobin Mathew"); MODULE_DESCRIPTION("ALSA SoC SiRF3A"); MODULE_LICENSE("GPL");