29 #include <linux/module.h>
35 #include "../codecs/tpa6130a2.h"
42 #define RX51_TVOUT_SEL_GPIO 40
43 #define RX51_JACK_DETECT_GPIO 177
44 #define RX51_ECI_SW_GPIO 182
49 #define RX51_SPEAKER_AMP_TWL_GPIO (192 + 7)
58 static int rx51_spk_func;
59 static int rx51_dmic_func;
60 static int rx51_jack_func;
64 int hp = 0, hs = 0, tvout = 0;
66 switch (rx51_jack_func) {
108 rx51_ext_control(&card->
dapm);
125 .startup = rx51_startup,
126 .hw_params = rx51_hw_params,
132 ucontrol->
value.integer.value[0] = rx51_spk_func;
142 if (rx51_spk_func == ucontrol->
value.integer.value[0])
145 rx51_spk_func = ucontrol->
value.integer.value[0];
146 rx51_ext_control(&card->
dapm);
175 static int rx51_get_input(
struct snd_kcontrol *kcontrol,
178 ucontrol->
value.integer.value[0] = rx51_dmic_func;
183 static int rx51_set_input(
struct snd_kcontrol *kcontrol,
188 if (rx51_dmic_func == ucontrol->
value.integer.value[0])
191 rx51_dmic_func = ucontrol->
value.integer.value[0];
192 rx51_ext_control(&card->
dapm);
200 ucontrol->
value.integer.value[0] = rx51_jack_func;
210 if (rx51_jack_func == ucontrol->
value.integer.value[0])
213 rx51_jack_func = ucontrol->
value.integer.value[0];
214 rx51_ext_control(&card->
dapm);
221 static struct snd_soc_jack_gpio rx51_av_jack_gpios[] = {
224 .name =
"avdet-gpio",
227 .debounce_time = 200,
244 {
"Ext Spk",
NULL,
"HPLOUT"},
245 {
"Ext Spk",
NULL,
"HPROUT"},
246 {
"Headphone Jack",
NULL,
"LLOUT"},
247 {
"Headphone Jack",
NULL,
"RLOUT"},
248 {
"FM Transmitter",
NULL,
"LLOUT"},
249 {
"FM Transmitter",
NULL,
"RLOUT"},
251 {
"DMic Rate 64",
NULL,
"Mic Bias 2V"},
252 {
"Mic Bias 2V",
NULL,
"DMic"},
256 {
"b LINE2R",
NULL,
"MONO_LOUT"},
257 {
"Earphone",
NULL,
"b HPLOUT"},
259 {
"LINE1L",
NULL,
"b Mic Bias 2.5V"},
260 {
"b Mic Bias 2.5V",
NULL,
"HS Mic"}
263 static const char *spk_function[] = {
"Off",
"On"};
264 static const char *input_function[] = {
"ADC",
"Digital Mic"};
265 static const char *jack_function[] = {
"Off",
"TV-OUT",
"Headphone",
"Headset"};
267 static const struct soc_enum rx51_enum[] = {
275 rx51_get_spk, rx51_set_spk),
277 rx51_get_input, rx51_set_input),
279 rx51_get_jack, rx51_set_jack),
326 err = snd_soc_jack_add_gpios(&rx51_av_jack,
354 .name =
"TLV320AIC34",
355 .stream_name =
"AIC34",
356 .cpu_dai_name =
"omap-mcbsp.2",
357 .codec_dai_name =
"tlv320aic3x-hifi",
358 .platform_name =
"omap-pcm-audio",
359 .codec_name =
"tlv320aic3x-codec.2-0018",
362 .init = rx51_aic34_init,
369 .name =
"TLV320AIC34b",
370 .codec_name =
"tlv320aic3x-codec.2-0019",
371 .init = rx51_aic34b_init,
377 .dev_name =
"tlv320aic3x-codec.2-0019",
386 .dai_link = rx51_dai,
388 .aux_dev = rx51_aux_dev,
390 .codec_conf = rx51_codec_conf,
396 static int __init rx51_soc_init(
void)
400 if (!machine_is_nokia_rx51())
406 goto err_gpio_tvout_sel;
410 goto err_gpio_eci_sw;
413 if (!rx51_snd_device) {
418 platform_set_drvdata(rx51_snd_device, &rx51_sound_card);
436 static void __exit rx51_soc_exit(
void)
438 snd_soc_jack_free_gpios(&rx51_av_jack,
ARRAY_SIZE(rx51_av_jack_gpios),