aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/extcon/extcon-arizona.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2013-01-10 18:55:36 -0500
committerChanwoo Choi <cw00.choi@samsung.com>2013-01-15 01:42:17 -0500
commitdab63eb25ced7539a51b8f4218f7b6b56d34df22 (patch)
tree1f97a0380d70d4207b57a2d2987f3ce18ebc9586 /drivers/extcon/extcon-arizona.c
parentb17e54625cff1b06aec9df505b46c9bcdcd4823d (diff)
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 <broonie@opensource.wolfsonmicro.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Diffstat (limited to 'drivers/extcon/extcon-arizona.c')
-rw-r--r--drivers/extcon/extcon-arizona.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index 635b7078ce5e..3ef3bee7d1e6 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -45,6 +45,7 @@ struct arizona_extcon_info {
45 int micd_num_modes; 45 int micd_num_modes;
46 46
47 bool micd_reva; 47 bool micd_reva;
48 bool micd_clamp;
48 49
49 bool mic; 50 bool mic;
50 bool detecting; 51 bool detecting;
@@ -375,6 +376,7 @@ static int arizona_extcon_probe(struct platform_device *pdev)
375 info->micd_reva = true; 376 info->micd_reva = true;
376 break; 377 break;
377 default: 378 default:
379 info->micd_clamp = true;
378 break; 380 break;
379 } 381 }
380 break; 382 break;
@@ -423,6 +425,19 @@ static int arizona_extcon_probe(struct platform_device *pdev)
423 arizona->pdata.micd_bias_start_time 425 arizona->pdata.micd_bias_start_time
424 << ARIZONA_MICD_BIAS_STARTTIME_SHIFT); 426 << ARIZONA_MICD_BIAS_STARTTIME_SHIFT);
425 427
428 /*
429 * If we have a clamp use it.
430 */
431 if (info->micd_clamp) {
432 regmap_update_bits(arizona->regmap,
433 ARIZONA_MICD_CLAMP_CONTROL,
434 ARIZONA_MICD_CLAMP_MODE_MASK, 4);
435 regmap_update_bits(arizona->regmap,
436 ARIZONA_JACK_DETECT_DEBOUNCE,
437 ARIZONA_MICD_CLAMP_DB,
438 ARIZONA_MICD_CLAMP_DB);
439 }
440
426 arizona_extcon_set_mode(info, 0); 441 arizona_extcon_set_mode(info, 0);
427 442
428 info->input = devm_input_allocate_device(&pdev->dev); 443 info->input = devm_input_allocate_device(&pdev->dev);
@@ -529,6 +544,10 @@ static int arizona_extcon_remove(struct platform_device *pdev)
529 544
530 pm_runtime_disable(&pdev->dev); 545 pm_runtime_disable(&pdev->dev);
531 546
547 regmap_update_bits(arizona->regmap,
548 ARIZONA_MICD_CLAMP_CONTROL,
549 ARIZONA_MICD_CLAMP_MODE_MASK, 0);
550
532 arizona_set_irq_wake(arizona, ARIZONA_IRQ_JD_RISE, 0); 551 arizona_set_irq_wake(arizona, ARIZONA_IRQ_JD_RISE, 0);
533 arizona_set_irq_wake(arizona, ARIZONA_IRQ_JD_FALL, 0); 552 arizona_set_irq_wake(arizona, ARIZONA_IRQ_JD_FALL, 0);
534 arizona_free_irq(arizona, ARIZONA_IRQ_MICDET, info); 553 arizona_free_irq(arizona, ARIZONA_IRQ_MICDET, info);