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:
Mark Brown 2013-01-11 08:55:36 +09:00 • committed by Chanwoo Choi
commit dab63eb25c
3 changed files with 50 additions and 1 deletions

View file

@ -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);