4040
4141#define RX51_TVOUT_SEL_GPIO 40
4242#define RX51_JACK_DETECT_GPIO 177
43+ #define RX51_ECI_SW_GPIO 182
4344/*
4445 * REVISIT: TWL4030 GPIO base in RX-51. Now statically defined to 192. This
4546 * gpio is reserved in arch/arm/mach-omap2/board-rx51-peripherals.c
5051 RX51_JACK_DISABLED ,
5152 RX51_JACK_TVOUT , /* tv-out with stereo output */
5253 RX51_JACK_HP , /* headphone: stereo output, no mic */
54+ RX51_JACK_HS , /* headset: stereo output with mic */
5355};
5456
5557static int rx51_spk_func ;
@@ -59,11 +61,15 @@ static int rx51_jack_func;
5961static void rx51_ext_control (struct snd_soc_codec * codec )
6062{
6163 struct snd_soc_dapm_context * dapm = & codec -> dapm ;
62- int hp = 0 , tvout = 0 ;
64+ int hp = 0 , hs = 0 , tvout = 0 ;
6365
6466 switch (rx51_jack_func ) {
6567 case RX51_JACK_TVOUT :
6668 tvout = 1 ;
69+ hp = 1 ;
70+ break ;
71+ case RX51_JACK_HS :
72+ hs = 1 ;
6773 case RX51_JACK_HP :
6874 hp = 1 ;
6975 break ;
@@ -81,6 +87,10 @@ static void rx51_ext_control(struct snd_soc_codec *codec)
8187 snd_soc_dapm_enable_pin (dapm , "Headphone Jack" );
8288 else
8389 snd_soc_dapm_disable_pin (dapm , "Headphone Jack" );
90+ if (hs )
91+ snd_soc_dapm_enable_pin (dapm , "HS Mic" );
92+ else
93+ snd_soc_dapm_disable_pin (dapm , "HS Mic" );
8494
8595 gpio_set_value (RX51_TVOUT_SEL_GPIO , tvout );
8696
@@ -230,7 +240,7 @@ static struct snd_soc_jack_gpio rx51_av_jack_gpios[] = {
230240 {
231241 .gpio = RX51_JACK_DETECT_GPIO ,
232242 .name = "avdet-gpio" ,
233- .report = SND_JACK_VIDEOOUT ,
243+ .report = SND_JACK_HEADSET ,
234244 .invert = 1 ,
235245 .debounce_time = 200 ,
236246 },
@@ -240,6 +250,8 @@ static const struct snd_soc_dapm_widget aic34_dapm_widgets[] = {
240250 SND_SOC_DAPM_SPK ("Ext Spk" , rx51_spk_event ),
241251 SND_SOC_DAPM_MIC ("DMic" , NULL ),
242252 SND_SOC_DAPM_HP ("Headphone Jack" , rx51_hp_event ),
253+ SND_SOC_DAPM_MIC ("HS Mic" , NULL ),
254+ SND_SOC_DAPM_LINE ("FM Transmitter" , NULL ),
243255};
244256
245257static const struct snd_soc_dapm_widget aic34_dapm_widgetsb [] = {
@@ -251,6 +263,8 @@ static const struct snd_soc_dapm_route audio_map[] = {
251263 {"Ext Spk" , NULL , "HPROUT" },
252264 {"Headphone Jack" , NULL , "LLOUT" },
253265 {"Headphone Jack" , NULL , "RLOUT" },
266+ {"FM Transmitter" , NULL , "LLOUT" },
267+ {"FM Transmitter" , NULL , "RLOUT" },
254268
255269 {"DMic Rate 64" , NULL , "Mic Bias 2V" },
256270 {"Mic Bias 2V" , NULL , "DMic" },
@@ -259,11 +273,14 @@ static const struct snd_soc_dapm_route audio_map[] = {
259273static const struct snd_soc_dapm_route audio_mapb [] = {
260274 {"b LINE2R" , NULL , "MONO_LOUT" },
261275 {"Earphone" , NULL , "b HPLOUT" },
276+
277+ {"LINE1L" , NULL , "b Mic Bias 2.5V" },
278+ {"b Mic Bias 2.5V" , NULL , "HS Mic" }
262279};
263280
264281static const char * spk_function [] = {"Off" , "On" };
265282static const char * input_function [] = {"ADC" , "Digital Mic" };
266- static const char * jack_function [] = {"Off" , "TV-OUT" , "Headphone" };
283+ static const char * jack_function [] = {"Off" , "TV-OUT" , "Headphone" , "Headset" };
267284
268285static const struct soc_enum rx51_enum [] = {
269286 SOC_ENUM_SINGLE_EXT (ARRAY_SIZE (spk_function ), spk_function ),
@@ -278,6 +295,7 @@ static const struct snd_kcontrol_new aic34_rx51_controls[] = {
278295 rx51_get_input , rx51_set_input ),
279296 SOC_ENUM_EXT ("Jack Function" , rx51_enum [2 ],
280297 rx51_get_jack , rx51_set_jack ),
298+ SOC_DAPM_PIN_SWITCH ("FM Transmitter" ),
281299};
282300
283301static const struct snd_kcontrol_new aic34_rx51_controlsb [] = {
@@ -313,11 +331,16 @@ static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd)
313331 return err ;
314332 snd_soc_limit_volume (codec , "TPA6130A2 Headphone Playback Volume" , 42 );
315333
334+ err = omap_mcbsp_st_add_controls (codec , 1 );
335+ if (err < 0 )
336+ return err ;
337+
316338 snd_soc_dapm_sync (dapm );
317339
318340 /* AV jack detection */
319341 err = snd_soc_jack_new (codec , "AV Jack" ,
320- SND_JACK_VIDEOOUT , & rx51_av_jack );
342+ SND_JACK_HEADSET | SND_JACK_VIDEOOUT ,
343+ & rx51_av_jack );
321344 if (err )
322345 return err ;
323346 err = snd_soc_jack_add_gpios (& rx51_av_jack ,
@@ -394,10 +417,14 @@ static int __init rx51_soc_init(void)
394417 if (!machine_is_nokia_rx51 ())
395418 return - ENODEV ;
396419
397- err = gpio_request (RX51_TVOUT_SEL_GPIO , "tvout_sel" );
420+ err = gpio_request_one (RX51_TVOUT_SEL_GPIO ,
421+ GPIOF_DIR_OUT | GPIOF_INIT_LOW , "tvout_sel" );
398422 if (err )
399423 goto err_gpio_tvout_sel ;
400- gpio_direction_output (RX51_TVOUT_SEL_GPIO , 0 );
424+ err = gpio_request_one (RX51_ECI_SW_GPIO ,
425+ GPIOF_DIR_OUT | GPIOF_INIT_HIGH , "eci_sw" );
426+ if (err )
427+ goto err_gpio_eci_sw ;
401428
402429 rx51_snd_device = platform_device_alloc ("soc-audio" , -1 );
403430 if (!rx51_snd_device ) {
@@ -415,6 +442,8 @@ static int __init rx51_soc_init(void)
415442err2 :
416443 platform_device_put (rx51_snd_device );
417444err1 :
445+ gpio_free (RX51_ECI_SW_GPIO );
446+ err_gpio_eci_sw :
418447 gpio_free (RX51_TVOUT_SEL_GPIO );
419448err_gpio_tvout_sel :
420449
@@ -427,6 +456,7 @@ static void __exit rx51_soc_exit(void)
427456 rx51_av_jack_gpios );
428457
429458 platform_device_unregister (rx51_snd_device );
459+ gpio_free (RX51_ECI_SW_GPIO );
430460 gpio_free (RX51_TVOUT_SEL_GPIO );
431461}
432462
0 commit comments