aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/extcon/extcon-arizona.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/extcon/extcon-arizona.c')
-rw-r--r--drivers/extcon/extcon-arizona.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index f36debffe6e8..4487bdaf9b43 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -441,20 +441,7 @@ static int arizona_hpdet_read(struct arizona_extcon_info *info)
441 range = (range & ARIZONA_HP_IMPEDANCE_RANGE_MASK) 441 range = (range & ARIZONA_HP_IMPEDANCE_RANGE_MASK)
442 >> ARIZONA_HP_IMPEDANCE_RANGE_SHIFT; 442 >> ARIZONA_HP_IMPEDANCE_RANGE_SHIFT;
443 443
444 /* Skip up or down a range? */ 444 /* Skip up a range, or report? */
445 if (range && (val < arizona_hpdet_c_ranges[range].min)) {
446 range--;
447 dev_dbg(arizona->dev, "Moving to HPDET range %d-%d\n",
448 arizona_hpdet_c_ranges[range].min,
449 arizona_hpdet_c_ranges[range].max);
450 regmap_update_bits(arizona->regmap,
451 ARIZONA_HEADPHONE_DETECT_1,
452 ARIZONA_HP_IMPEDANCE_RANGE_MASK,
453 range <<
454 ARIZONA_HP_IMPEDANCE_RANGE_SHIFT);
455 return -EAGAIN;
456 }
457
458 if (range < ARRAY_SIZE(arizona_hpdet_c_ranges) - 1 && 445 if (range < ARRAY_SIZE(arizona_hpdet_c_ranges) - 1 &&
459 (val >= arizona_hpdet_c_ranges[range].max)) { 446 (val >= arizona_hpdet_c_ranges[range].max)) {
460 range++; 447 range++;
@@ -468,6 +455,12 @@ static int arizona_hpdet_read(struct arizona_extcon_info *info)
468 ARIZONA_HP_IMPEDANCE_RANGE_SHIFT); 455 ARIZONA_HP_IMPEDANCE_RANGE_SHIFT);
469 return -EAGAIN; 456 return -EAGAIN;
470 } 457 }
458
459 if (range && (val < arizona_hpdet_c_ranges[range].min)) {
460 dev_dbg(arizona->dev, "Reporting range boundary %d\n",
461 arizona_hpdet_c_ranges[range].min);
462 val = arizona_hpdet_c_ranges[range].min;
463 }
471 } 464 }
472 465
473 dev_dbg(arizona->dev, "HP impedance %d ohms\n", val); 466 dev_dbg(arizona->dev, "HP impedance %d ohms\n", val);