blob: c42d5f00b0e1cc2cdc75bfcd625bc02a35aa7825 [file] [log] [blame]
Jassi Brar5033f432010-11-22 15:37:25 +09001/* sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c
Ben Dooks14412ac2009-08-20 22:50:40 +01002 *
3 * Copyright 2009 Simtec Electronics
4 *
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*/
9
Paul Gortmakerda155d52011-07-15 12:38:28 -040010#include <linux/module.h>
Ben Dooks14412ac2009-08-20 22:50:40 +010011#include <sound/soc.h>
Ben Dooks14412ac2009-08-20 22:50:40 +010012
Ben Dooks14412ac2009-08-20 22:50:40 +010013#include "s3c24xx_simtec.h"
14
Ben Dooks14412ac2009-08-20 22:50:40 +010015/* supported machines:
16 *
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)
24 */
25
26static 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),
31};
32
33static const struct snd_soc_dapm_route base_map[] = {
34 { "Headphone Jack", NULL, "LHPOUT"},
35 { "Headphone Jack", NULL, "RHPOUT"},
36
37 { "Line Out", NULL, "LOUT" },
38 { "Line Out", NULL, "ROUT" },
39
40 { "LLINEIN", NULL, "Line In"},
41 { "RLINEIN", NULL, "Line In"},
42
43 { "MICIN", NULL, "Mic Jack"},
44};
45
46/**
47 * simtec_tlv320aic23_init - initialise and add controls
48 * @codec; The codec instance to attach to.
49 *
50 * Attach our controls and configure the necessary codec
51 * mappings for our sound card instance.
52*/
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000053static int simtec_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd)
Ben Dooks14412ac2009-08-20 22:50:40 +010054{
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000055 struct snd_soc_codec *codec = rtd->codec;
Liam Girdwoodce6120c2010-11-05 15:53:46 +020056 struct snd_soc_dapm_context *dapm = &codec->dapm;
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000057
Liam Girdwoodce6120c2010-11-05 15:53:46 +020058 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");
Ben Dooks14412ac2009-08-20 22:50:40 +010062
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000063 simtec_audio_init(rtd);
Ben Dooks14412ac2009-08-20 22:50:40 +010064
65 return 0;
66}
67
68static struct snd_soc_dai_link simtec_dai_aic23 = {
69 .name = "tlv320aic23",
70 .stream_name = "TLV320AIC23",
Lars-Peter Clausen81d7da52011-01-24 22:09:22 +010071 .codec_name = "tlv320aic3x-codec.0-001a",
Lars-Peter Clausen518aa592011-01-24 22:12:42 +010072 .cpu_dai_name = "s3c24xx-iis",
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000073 .codec_dai_name = "tlv320aic3x-hifi",
Jassi Brar58bb4072010-11-22 15:35:50 +090074 .platform_name = "samsung-audio",
Ben Dooks14412ac2009-08-20 22:50:40 +010075 .init = simtec_tlv320aic23_init,
76};
77
78/* simtec audio machine driver */
79static struct snd_soc_card snd_soc_machine_simtec_aic23 = {
80 .name = "Simtec",
Axel Lin095d79d2011-12-22 10:53:15 +080081 .owner = THIS_MODULE,
Ben Dooks14412ac2009-08-20 22:50:40 +010082 .dai_link = &simtec_dai_aic23,
83 .num_links = 1,
Mark Brown4f5448a2011-10-08 12:19:12 +010084
85 .dapm_widgets = dapm_widgets,
86 .num_dapm_widgets = ARRAY_SIZE(dapm_widgets),
87 .dapm_routes = base_map,
88 .num_dapm_routes = ARRAY_SIZE(base_map),
Ben Dooks14412ac2009-08-20 22:50:40 +010089};
90
Ben Dooks14412ac2009-08-20 22:50:40 +010091static int __devinit simtec_audio_tlv320aic23_probe(struct platform_device *pd)
92{
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000093 return simtec_audio_core_probe(pd, &snd_soc_machine_simtec_aic23);
Ben Dooks14412ac2009-08-20 22:50:40 +010094}
95
Axel Linc1496b42011-12-07 18:04:10 +080096static struct platform_driver simtec_audio_tlv320aic23_driver = {
Ben Dooks14412ac2009-08-20 22:50:40 +010097 .driver = {
98 .owner = THIS_MODULE,
99 .name = "s3c24xx-simtec-tlv320aic23",
100 .pm = simtec_audio_pm,
101 },
102 .probe = simtec_audio_tlv320aic23_probe,
103 .remove = __devexit_p(simtec_audio_remove),
104};
105
Axel Linc1496b42011-12-07 18:04:10 +0800106module_platform_driver(simtec_audio_tlv320aic23_driver);
Mark Browne00c3f52011-11-23 15:20:13 +0000107
Ben Dooks14412ac2009-08-20 22:50:40 +0100108MODULE_ALIAS("platform:s3c24xx-simtec-tlv320aic23");
Ben Dooks14412ac2009-08-20 22:50:40 +0100109MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
110MODULE_DESCRIPTION("ALSA SoC Simtec Audio support");
111MODULE_LICENSE("GPL");