I2C: Add helper macro for i2c_driver boilerplate
[zen-stable.git] / sound / soc / samsung / s3c24xx_simtec_tlv320aic23.c
blob5e4fd46b7200066d917e5f0a8e00fe9ffa328394
1 /* sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c
3 * Copyright 2009 Simtec Electronics
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
10 #include <linux/module.h>
11 #include <sound/soc.h>
13 #include "s3c24xx_simtec.h"
15 /* supported machines:
17 * Machine Connections AMP
18 * ------- ----------- ---
19 * BAST MIC, HPOUT, LOUT, LIN TPA2001D1 (HPOUTL,R) (gain hardwired)
20 * VR1000 HPOUT, LIN None
21 * VR2000 LIN, LOUT, MIC, HP LM4871 (HPOUTL,R)
22 * DePicture LIN, LOUT, MIC, HP LM4871 (HPOUTL,R)
23 * Anubis LIN, LOUT, MIC, HP TPA2001D1 (HPOUTL,R)
26 static const struct snd_soc_dapm_widget dapm_widgets[] = {
27 SND_SOC_DAPM_HP("Headphone Jack", NULL),
28 SND_SOC_DAPM_LINE("Line In", NULL),
29 SND_SOC_DAPM_LINE("Line Out", NULL),
30 SND_SOC_DAPM_MIC("Mic Jack", NULL),
33 static const struct snd_soc_dapm_route base_map[] = {
34 { "Headphone Jack", NULL, "LHPOUT"},
35 { "Headphone Jack", NULL, "RHPOUT"},
37 { "Line Out", NULL, "LOUT" },
38 { "Line Out", NULL, "ROUT" },
40 { "LLINEIN", NULL, "Line In"},
41 { "RLINEIN", NULL, "Line In"},
43 { "MICIN", NULL, "Mic Jack"},
46 /**
47 * simtec_tlv320aic23_init - initialise and add controls
48 * @codec; The codec instance to attach to.
50 * Attach our controls and configure the necessary codec
51 * mappings for our sound card instance.
53 static int simtec_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd)
55 struct snd_soc_codec *codec = rtd->codec;
56 struct snd_soc_dapm_context *dapm = &codec->dapm;
58 snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
59 snd_soc_dapm_enable_pin(dapm, "Line In");
60 snd_soc_dapm_enable_pin(dapm, "Line Out");
61 snd_soc_dapm_enable_pin(dapm, "Mic Jack");
63 simtec_audio_init(rtd);
65 return 0;
68 static struct snd_soc_dai_link simtec_dai_aic23 = {
69 .name = "tlv320aic23",
70 .stream_name = "TLV320AIC23",
71 .codec_name = "tlv320aic3x-codec.0-001a",
72 .cpu_dai_name = "s3c24xx-iis",
73 .codec_dai_name = "tlv320aic3x-hifi",
74 .platform_name = "samsung-audio",
75 .init = simtec_tlv320aic23_init,
78 /* simtec audio machine driver */
79 static struct snd_soc_card snd_soc_machine_simtec_aic23 = {
80 .name = "Simtec",
81 .dai_link = &simtec_dai_aic23,
82 .num_links = 1,
84 .dapm_widgets = dapm_widgets,
85 .num_dapm_widgets = ARRAY_SIZE(dapm_widgets),
86 .dapm_routes = base_map,
87 .num_dapm_routes = ARRAY_SIZE(base_map),
90 static int __devinit simtec_audio_tlv320aic23_probe(struct platform_device *pd)
92 return simtec_audio_core_probe(pd, &snd_soc_machine_simtec_aic23);
95 static struct platform_driver simtec_audio_tlv320aic23_platdrv = {
96 .driver = {
97 .owner = THIS_MODULE,
98 .name = "s3c24xx-simtec-tlv320aic23",
99 .pm = simtec_audio_pm,
101 .probe = simtec_audio_tlv320aic23_probe,
102 .remove = __devexit_p(simtec_audio_remove),
105 MODULE_ALIAS("platform:s3c24xx-simtec-tlv320aic23");
107 static int __init simtec_tlv320aic23_modinit(void)
109 return platform_driver_register(&simtec_audio_tlv320aic23_platdrv);
112 static void __exit simtec_tlv320aic23_modexit(void)
114 platform_driver_unregister(&simtec_audio_tlv320aic23_platdrv);
117 module_init(simtec_tlv320aic23_modinit);
118 module_exit(simtec_tlv320aic23_modexit);
120 MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
121 MODULE_DESCRIPTION("ALSA SoC Simtec Audio support");
122 MODULE_LICENSE("GPL");