aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/extcon
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2013-01-25 07:14:44 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-04-01 17:06:39 -0400
commit84eaa13616b6e7d001b7f7b909228087779b677b (patch)
treecdf7359a290cda17faa26078b22bdd37c5a733f6 /drivers/extcon
parent253b5374f08f3908cc380c5665470a5b7609be1c (diff)
extcon: arizona: Attempt more microphone measurements
In some pathological use cases users may insert an accessory very slowly causing multiple indeterminate measurements. Handle this by retrying many measurements before we give up and declare a headphone. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/extcon')
-rw-r--r--drivers/extcon/extcon-arizona.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index b28927972128..4bb0e9ae405d 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -153,6 +153,8 @@ static void arizona_extcon_set_mode(struct arizona_extcon_info *info, int mode)
153{ 153{
154 struct arizona *arizona = info->arizona; 154 struct arizona *arizona = info->arizona;
155 155
156 mode %= info->num_micd_modes;
157
156 if (arizona->pdata.micd_pol_gpio > 0) 158 if (arizona->pdata.micd_pol_gpio > 0)
157 gpio_set_value_cansleep(arizona->pdata.micd_pol_gpio, 159 gpio_set_value_cansleep(arizona->pdata.micd_pol_gpio,
158 info->micd_modes[mode].gpio); 160 info->micd_modes[mode].gpio);
@@ -783,7 +785,7 @@ static irqreturn_t arizona_micdet(int irq, void *data)
783 * impedence then give up and report headphones. 785 * impedence then give up and report headphones.
784 */ 786 */
785 if (info->detecting && (val & 0x3f8)) { 787 if (info->detecting && (val & 0x3f8)) {
786 if (info->jack_flips >= info->micd_num_modes) { 788 if (info->jack_flips >= info->micd_num_modes * 10) {
787 dev_dbg(arizona->dev, "Detected HP/line\n"); 789 dev_dbg(arizona->dev, "Detected HP/line\n");
788 arizona_identify_headphone(info); 790 arizona_identify_headphone(info);
789 791