MADERA_MICD_ENA, MADERA_MICD_ENA);
}
+void madera_set_magic_bit(struct madera_extcon *info, bool on)
+{
+ int rate = 1;
+ struct madera *madera = info->madera;
+ if (on) {
+ regmap_update_bits(madera->regmap,
+ MADERA_ACCESSORY_DETECT_MODE_1,
+ MADERA_ACCDET_POLARITY_INV_ENA_MASK,
+ 0);
+ regmap_update_bits(madera->regmap, MADERA_MIC_DETECT_1_CONTROL_1,
+ MADERA_MICD_RATE_MASK ,
+ 0);
+ } else {
+ if (info->pdata->micd_rate)
+ rate = info->pdata->micd_rate;
+ regmap_update_bits(madera->regmap,
+ MADERA_ACCESSORY_DETECT_MODE_1,
+ MADERA_ACCDET_POLARITY_INV_ENA_MASK,
+ MADERA_ACCDET_POLARITY_INV_ENA);
+ regmap_update_bits(madera->regmap, MADERA_MIC_DETECT_1_CONTROL_1,
+ MADERA_MICD_RATE_MASK ,
+ rate << MADERA_MICD_RATE_SHIFT);
+ }
+}
+
static void madera_hpdet_stop_micd(struct madera_extcon *info)
{
struct madera *madera = info->madera;
/* Reset back to starting range */
madera_hpdet_stop_micd(info);
+ madera_set_magic_bit(info, info->have_mic);
+
regmap_update_bits(madera->regmap, MADERA_HEADPHONE_DETECT_1,
MADERA_HP_IMPEDANCE_RANGE_MASK | MADERA_HP_POLL,
info->hpdet_init_range <<
madera_set_headphone_imp(info, MADERA_HP_Z_OPEN);
madera_extcon_notify_micd(info, false, 0);
+
+ madera_set_magic_bit(info, false);
}
out: