@@ -246,6 +246,7 @@ struct sub_codec cs8409_cs42l42_codec = {
.mic_jack_in = 0,
.paged = 1,
.suspended = 1,
+ .no_type_dect = 0,
};
/******************************************************************************
@@ -535,6 +535,39 @@ static void cs42l42_run_jack_detect(struct sub_codec *cs42l42)
usleep_range(10000, 25000);
}
+static int cs42l42_handle_tip_sense(struct sub_codec *cs42l42, unsigned int reg_ts_status)
+{
+ int status_changed = 0;
+
+ /* TIP_SENSE INSERT/REMOVE */
+ switch (reg_ts_status) {
+ case CS42L42_JACK_INSERTED:
+ if (!cs42l42->hp_jack_in) {
+ if (cs42l42->no_type_dect) {
+ status_changed = 1;
+ cs42l42->hp_jack_in = 1;
+ cs42l42->mic_jack_in = 0;
+ } else {
+ cs42l42_run_jack_detect(cs42l42);
+ }
+ }
+ break;
+
+ case CS42L42_JACK_REMOVED:
+ if (cs42l42->hp_jack_in || cs42l42->mic_jack_in) {
+ status_changed = 1;
+ cs42l42->hp_jack_in = 0;
+ cs42l42->mic_jack_in = 0;
+ }
+ break;
+ default:
+ /* jack in transition */
+ break;
+ }
+
+ return status_changed;
+}
+
static int cs42l42_jack_unsol_event(struct sub_codec *cs42l42)
{
int status_changed = 0;
@@ -559,10 +592,13 @@ static int cs42l42_jack_unsol_event(struct sub_codec *cs42l42)
cs8409_i2c_write(cs42l42, 0x131b, 0xFF);
type = ((reg_hs_status & CS42L42_HSTYPE_MASK) + 1);
- /* CS42L42 reports optical jack as type 4
- * We don't handle optical jack
- */
- if (type != 4) {
+
+ if (cs42l42->no_type_dect) {
+ status_changed = cs42l42_handle_tip_sense(cs42l42, reg_ts_status);
+ } else if (type == 4) {
+ /* Type 4 not supported */
+ status_changed = cs42l42_handle_tip_sense(cs42l42, CS42L42_JACK_REMOVED);
+ } else {
if (!cs42l42->hp_jack_in) {
status_changed = 1;
cs42l42->hp_jack_in = 1;
@@ -572,37 +608,11 @@ static int cs42l42_jack_unsol_event(struct sub_codec *cs42l42)
status_changed = 1;
cs42l42->mic_jack_in = 1;
}
- } else {
- if (cs42l42->hp_jack_in || cs42l42->mic_jack_in) {
- status_changed = 1;
- cs42l42->hp_jack_in = 0;
- cs42l42->mic_jack_in = 0;
- }
}
-
/* Re-Enable Tip Sense Interrupt */
cs8409_i2c_write(cs42l42, 0x1320, 0xF3);
-
} else {
- /* TIP_SENSE INSERT/REMOVE */
- switch (reg_ts_status) {
- case CS42L42_JACK_INSERTED:
- cs42l42_run_jack_detect(cs42l42);
- break;
-
- case CS42L42_JACK_REMOVED:
- if (cs42l42->hp_jack_in || cs42l42->mic_jack_in) {
- status_changed = 1;
- cs42l42->hp_jack_in = 0;
- cs42l42->mic_jack_in = 0;
- }
- break;
-
- default:
- /* jack in transition */
- status_changed = 0;
- break;
- }
+ status_changed = cs42l42_handle_tip_sense(cs42l42, reg_ts_status);
}
return status_changed;
@@ -285,6 +285,7 @@ struct sub_codec {
unsigned int last_page;
unsigned int hsbias_hiz;
unsigned int full_scale_vol:1;
+ unsigned int no_type_dect:1;
s8 vol[CS42L42_VOLUMES];
};