[RAMEN9610-14248] extcon: line out support
authorSatish Kumar Reddy <palli.satish@samsung.com>
Sat, 23 Feb 2019 04:06:21 +0000 (13:06 +0900)
committerhskang <hs1218.kang@samsung.com>
Sun, 21 Apr 2019 09:10:08 +0000 (18:10 +0900)
Change-Id: Ic5ea097aa97305a093076ce5ebc5e36ad926fabb
Signed-off-by: Satish Kumar Reddy <palli.satish@samsung.com>
drivers/extcon/extcon-madera.c

index e9cabd29c547ad1f4de838cd3ee7878380fbed8b..cdab15ef5bdcec6fb18505e5cb7da5956cdaf622 100644 (file)
@@ -62,6 +62,7 @@ static const unsigned int madera_cable[] = {
        EXTCON_MECHANICAL,
        EXTCON_JACK_MICROPHONE,
        EXTCON_JACK_HEADPHONE,
+       EXTCON_JACK_LINE_OUT,
        EXTCON_NONE,
 };
 
@@ -669,6 +670,11 @@ inline void madera_extcon_report(struct madera_extcon *info,
                                            SW_MICROPHONE_INSERT,
                                            attached);
                        break;
+               case EXTCON_JACK_LINE_OUT:
+                       input_report_switch(info->input,
+                                           SW_LINEOUT_INSERT,
+                                           attached);
+                       break;
                }
 
                input_sync(info->input);
@@ -1854,7 +1860,11 @@ int madera_hpdet_reading(struct madera_extcon *info, int val)
 
        madera_set_headphone_imp(info, val);
 
-       madera_extcon_report(info, EXTCON_JACK_HEADPHONE, true);
+       /* Report high impedence cables as line outputs */
+       if(val>= 5000)
+           madera_extcon_report(info, EXTCON_JACK_LINE_OUT, true);
+        else
+           madera_extcon_report(info, EXTCON_JACK_HEADPHONE, true);
 
        if (info->have_mic)
                madera_jds_set_state(info, &madera_micd_button);
@@ -3409,6 +3419,9 @@ static int madera_extcon_probe(struct platform_device *pdev)
                input_set_capability(info->input,
                                     EV_SW,
                                     SW_JACK_PHYSICAL_INSERT);
+               input_set_capability(info->input,
+                                    EV_SW,
+                                    SW_LINEOUT_INSERT);
        }
 
        ret = input_register_device(info->input);