mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
extcon: arizona: Use microphone clamp function if available
Newer Arizona devices include a microphone clamp function which is tied to jack detect. Activate this feature when present in order to ensure best performance of the subsystem. Signed-off-by: Mark Brown <[email protected]> Signed-off-by: Chanwoo Choi <[email protected]> Signed-off-by: Myungjoo Ham <[email protected]>
This commit is contained in:
parent
b17e54625c
commit
dab63eb25c
3 changed files with 50 additions and 1 deletions
|
|
@ -45,6 +45,7 @@ struct arizona_extcon_info {
|
|||
int micd_num_modes;
|
||||
|
||||
bool micd_reva;
|
||||
bool micd_clamp;
|
||||
|
||||
bool mic;
|
||||
bool detecting;
|
||||
|
|
@ -375,6 +376,7 @@ static int arizona_extcon_probe(struct platform_device *pdev)
|
|||
info->micd_reva = true;
|
||||
break;
|
||||
default:
|
||||
info->micd_clamp = true;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
|
@ -423,6 +425,19 @@ static int arizona_extcon_probe(struct platform_device *pdev)
|
|||
arizona->pdata.micd_bias_start_time
|
||||
<< ARIZONA_MICD_BIAS_STARTTIME_SHIFT);
|
||||
|
||||
/*
|
||||
* If we have a clamp use it.
|
||||
*/
|
||||
if (info->micd_clamp) {
|
||||
regmap_update_bits(arizona->regmap,
|
||||
ARIZONA_MICD_CLAMP_CONTROL,
|
||||
ARIZONA_MICD_CLAMP_MODE_MASK, 4);
|
||||
regmap_update_bits(arizona->regmap,
|
||||
ARIZONA_JACK_DETECT_DEBOUNCE,
|
||||
ARIZONA_MICD_CLAMP_DB,
|
||||
ARIZONA_MICD_CLAMP_DB);
|
||||
}
|
||||
|
||||
arizona_extcon_set_mode(info, 0);
|
||||
|
||||
info->input = devm_input_allocate_device(&pdev->dev);
|
||||
|
|
@ -529,6 +544,10 @@ static int arizona_extcon_remove(struct platform_device *pdev)
|
|||
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
|
||||
regmap_update_bits(arizona->regmap,
|
||||
ARIZONA_MICD_CLAMP_CONTROL,
|
||||
ARIZONA_MICD_CLAMP_MODE_MASK, 0);
|
||||
|
||||
arizona_set_irq_wake(arizona, ARIZONA_IRQ_JD_RISE, 0);
|
||||
arizona_set_irq_wake(arizona, ARIZONA_IRQ_JD_FALL, 0);
|
||||
arizona_free_irq(arizona, ARIZONA_IRQ_MICDET, info);
|
||||
|
|
|
|||
Loading…
Reference in a new issue