Skip to contentSkip to conversation

extcon: arizona: Correct typo in headphone detect range transitions

PATCH Applied Charles Keepax 2 participants 3 messages Sep 23, 2013 – Sep 26, 2013 External connector subsystem (extcon)

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 extcon: arizona: Correct typo in headphone detect range transitions

We should move range when the measured value is greater than or equal to the max value not when greater than.

---
 drivers/extcon/extcon-arizona.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/extcon/extcon-arizona.c +2 -2
index f639f2a..5096919 100644
@@ -388,7 +388,7 @@ static int arizona_hpdet_read(struct arizona_extcon_info *info)
 			   >> ARIZONA_HP_IMPEDANCE_RANGE_SHIFT;
 
 		if (range < ARRAY_SIZE(arizona_hpdet_b_ranges) - 1 &&
-		    (val < 100 || val > 0x3fb)) {
+		    (val < 100 || val >= 0x3fb)) {
 			range++;
 			dev_dbg(arizona->dev, "Moving to HPDET range %d\n",
 				range);
@@ -401,7 +401,7 @@ static int arizona_hpdet_read(struct arizona_extcon_info *info)
 		}
 
 		/* If we go out of range report top of range */
-		if (val < 100 || val > 0x3fb) {
+		if (val < 100 || val >= 0x3fb) {
 			dev_dbg(arizona->dev, "Measurement out of range\n");
 			return ARIZONA_HPDET_MAX;
 		}
Signature · 1 line
1.7.2.5
#1 lore raw

PATCH 2/2 extcon: arizona: Don't require micbias to be shifted in pdata

Every other pdata field is specified unshifted the patch handles shifting for the MICBIAS from the microphone detection polarity configurations in the extcon driver rather than demanding it in pdata to match other fields.

---
 drivers/extcon/extcon-arizona.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
drivers/extcon/extcon-arizona.c +5 -4
index 5096919..3c55ec8 100644
@@ -86,8 +86,8 @@ struct arizona_extcon_info {
 };
 
 static const struct arizona_micd_config micd_default_modes[] = {
-	{ ARIZONA_ACCDET_SRC, 1 << ARIZONA_MICD_BIAS_SRC_SHIFT, 0 },
-	{ 0,                  2 << ARIZONA_MICD_BIAS_SRC_SHIFT, 1 },
+	{ ARIZONA_ACCDET_SRC, 1, 0 },
+	{ 0,                  2, 1 },
 };
 
 static const struct arizona_micd_range micd_default_ranges[] = {
@@ -182,7 +182,8 @@ static void arizona_extcon_set_mode(struct arizona_extcon_info *info, int mode)
 					info->micd_modes[mode].gpio);
 	regmap_update_bits(arizona->regmap, ARIZONA_MIC_DETECT_1,
 			   ARIZONA_MICD_BIAS_SRC_MASK,
-			   info->micd_modes[mode].bias);
+			   info->micd_modes[mode].bias <<
+			   ARIZONA_MICD_BIAS_SRC_SHIFT);
 	regmap_update_bits(arizona->regmap, ARIZONA_ACCESSORY_DETECT_MODE_1,
 			   ARIZONA_ACCDET_SRC, info->micd_modes[mode].src);
 
@@ -193,7 +194,7 @@ static void arizona_extcon_set_mode(struct arizona_extcon_info *info, int mode)
 
 static const char *arizona_extcon_get_micbias(struct arizona_extcon_info *info)
 {
-	switch (info->micd_modes[0].bias >> ARIZONA_MICD_BIAS_SRC_SHIFT) {
+	switch (info->micd_modes[0].bias) {
 	case 1:
 		return "MICBIAS1";
 	case 2:
Signature · 1 line
1.7.2.5
maintainer Applied
#2 lore raw
In reply to Charles Keepax
Quoted 8 lines · Charles Keepax

We should move range when the measured value is greater than or equal to the max value not when greater than.

---
 drivers/extcon/extcon-arizona.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Applied this patchset on extcon-linus branch.

Thanks,
Chanwoo Choi