diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-02-05 15:20:17 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-02-11 11:06:25 -0500 |
commit | bf14ee5a460276a99ed35f9034bae9e74b01600f (patch) | |
tree | cdbdf09b18c74374952d6cc70fa65f1759f4c96a /drivers/extcon/extcon-arizona.c | |
parent | c37b387f077c54c5a01fa240dc8448b60bd731c1 (diff) |
extcon: arizona: Use MICDET for final microphone identification
When using HPDET to identify the accessory still run MICDET before we
report a microphone in order to ensure that the accessory identified is
compatible with the MICDET detection ranges after having confirmed that
the device is not using a headphone.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/extcon/extcon-arizona.c')
-rw-r--r-- | drivers/extcon/extcon-arizona.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c index d9918421e80b..dc357a4051f6 100644 --- a/drivers/extcon/extcon-arizona.c +++ b/drivers/extcon/extcon-arizona.c | |||
@@ -56,6 +56,7 @@ struct arizona_extcon_info { | |||
56 | struct delayed_work hpdet_work; | 56 | struct delayed_work hpdet_work; |
57 | 57 | ||
58 | bool hpdet_active; | 58 | bool hpdet_active; |
59 | bool hpdet_done; | ||
59 | 60 | ||
60 | int num_hpdet_res; | 61 | int num_hpdet_res; |
61 | unsigned int hpdet_res[3]; | 62 | unsigned int hpdet_res[3]; |
@@ -394,7 +395,6 @@ static int arizona_hpdet_do_id(struct arizona_extcon_info *info, int *reading) | |||
394 | { | 395 | { |
395 | struct arizona *arizona = info->arizona; | 396 | struct arizona *arizona = info->arizona; |
396 | int id_gpio = arizona->pdata.hpdet_id_gpio; | 397 | int id_gpio = arizona->pdata.hpdet_id_gpio; |
397 | int ret; | ||
398 | 398 | ||
399 | /* | 399 | /* |
400 | * If we're using HPDET for accessory identification we need | 400 | * If we're using HPDET for accessory identification we need |
@@ -463,13 +463,7 @@ static int arizona_hpdet_do_id(struct arizona_extcon_info *info, int *reading) | |||
463 | (id_gpio && info->hpdet_res[2] > 10)) { | 463 | (id_gpio && info->hpdet_res[2] > 10)) { |
464 | dev_dbg(arizona->dev, "Detected mic\n"); | 464 | dev_dbg(arizona->dev, "Detected mic\n"); |
465 | info->mic = true; | 465 | info->mic = true; |
466 | ret = extcon_set_cable_state_(&info->edev, | 466 | info->detecting = true; |
467 | ARIZONA_CABLE_MICROPHONE, | ||
468 | true); | ||
469 | if (ret != 0) { | ||
470 | dev_err(arizona->dev, | ||
471 | "Failed to report mic: %d\n", ret); | ||
472 | } | ||
473 | } else { | 467 | } else { |
474 | dev_dbg(arizona->dev, "Detected headphone\n"); | 468 | dev_dbg(arizona->dev, "Detected headphone\n"); |
475 | } | 469 | } |
@@ -586,6 +580,8 @@ done: | |||
586 | info->hpdet_active = false; | 580 | info->hpdet_active = false; |
587 | } | 581 | } |
588 | 582 | ||
583 | info->hpdet_done = true; | ||
584 | |||
589 | out: | 585 | out: |
590 | mutex_unlock(&info->lock); | 586 | mutex_unlock(&info->lock); |
591 | 587 | ||
@@ -597,6 +593,9 @@ static void arizona_identify_headphone(struct arizona_extcon_info *info) | |||
597 | struct arizona *arizona = info->arizona; | 593 | struct arizona *arizona = info->arizona; |
598 | int ret; | 594 | int ret; |
599 | 595 | ||
596 | if (info->hpdet_done) | ||
597 | return; | ||
598 | |||
600 | dev_dbg(arizona->dev, "Starting HPDET\n"); | 599 | dev_dbg(arizona->dev, "Starting HPDET\n"); |
601 | 600 | ||
602 | /* Make sure we keep the device enabled during the measurement */ | 601 | /* Make sure we keep the device enabled during the measurement */ |
@@ -923,6 +922,7 @@ static irqreturn_t arizona_jackdet(int irq, void *data) | |||
923 | for (i = 0; i < ARRAY_SIZE(info->hpdet_res); i++) | 922 | for (i = 0; i < ARRAY_SIZE(info->hpdet_res); i++) |
924 | info->hpdet_res[i] = 0; | 923 | info->hpdet_res[i] = 0; |
925 | info->mic = false; | 924 | info->mic = false; |
925 | info->hpdet_done = false; | ||
926 | 926 | ||
927 | for (i = 0; i < ARIZONA_NUM_BUTTONS; i++) | 927 | for (i = 0; i < ARIZONA_NUM_BUTTONS; i++) |
928 | input_report_key(info->input, | 928 | input_report_key(info->input, |