Skip to contentSkip to conversation

extcon: arizona: Add defines for microphone detection levels

PATCH In review Charles Keepax 3 participants 21 messages Nov 8, 2013 – Nov 13, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/4 extcon: arizona: Add defines for microphone detection levels

Improve readability by creating a define for each microphone detection level.

---
 drivers/extcon/extcon-arizona.c       |   21 ++++++++++++++++-----
 include/linux/mfd/arizona/registers.h |    9 +++++++++
 2 files changed, 25 insertions(+), 5 deletions(-)
drivers/extcon/extcon-arizona.c +16 -5
index 3c55ec8..6d914ba 100644
@@ -44,6 +44,17 @@
 #define HPDET_DEBOUNCE 500
 #define DEFAULT_MICD_TIMEOUT 2000
 
+enum {
+	MICD_LVL_1_TO_7 = ARIZONA_MICD_LVL_1 | ARIZONA_MICD_LVL_2 |
+			  ARIZONA_MICD_LVL_3 | ARIZONA_MICD_LVL_4 |
+			  ARIZONA_MICD_LVL_5 | ARIZONA_MICD_LVL_6 |
+			  ARIZONA_MICD_LVL_7,
+
+	MICD_LVL_0_TO_7 = ARIZONA_MICD_LVL_0 | MICD_LVL_1_TO_7,
+
+	MICD_LVL_0_TO_8 = MICD_LVL_0_TO_7 | ARIZONA_MICD_LVL_8,
+};
+
 struct arizona_extcon_info {
 	struct device *dev;
 	struct arizona *arizona;
@@ -765,7 +776,7 @@ static void arizona_micd_detect(struct work_struct *work)
 
 	mutex_lock(&info->lock);
 
-	for (i = 0; i < 10 && !(val & 0x7fc); i++) {
+	for (i = 0; i < 10 && !(val & MICD_LVL_0_TO_8); i++) {
 		ret = regmap_read(arizona->regmap, ARIZONA_MIC_DETECT_3, &val);
 		if (ret != 0) {
 			dev_err(arizona->dev,
@@ -784,7 +795,7 @@ static void arizona_micd_detect(struct work_struct *work)
 		}
 	}
 
-	if (i == 10 && !(val & 0x7fc)) {
+	if (i == 10 && !(val & MICD_LVL_0_TO_8)) {
 		dev_err(arizona->dev, "Failed to get valid MICDET value\n");
 		mutex_unlock(&info->lock);
 		return;
@@ -798,7 +809,7 @@ static void arizona_micd_detect(struct work_struct *work)
 	}
 
 	/* If we got a high impedence we should have a headset, report it. */
-	if (info->detecting && (val & 0x400)) {
+	if (info->detecting && (val & ARIZONA_MICD_LVL_8)) {
 		arizona_identify_headphone(info);
 
 		ret = extcon_update_state(&info->edev,
@@ -827,7 +838,7 @@ static void arizona_micd_detect(struct work_struct *work)
 	 * plain headphones.  If both polarities report a low
 	 * impedence then give up and report headphones.
 	 */
-	if (info->detecting && (val & 0x3f8)) {
+	if (info->detecting && (val & MICD_LVL_1_TO_7)) {
 		if (info->jack_flips >= info->micd_num_modes * 10) {
 			dev_dbg(arizona->dev, "Detected HP/line\n");
 			arizona_identify_headphone(info);
@@ -851,7 +862,7 @@ static void arizona_micd_detect(struct work_struct *work)
 	 * If we're still detecting and we detect a short then we've
 	 * got a headphone.  Otherwise it's a button press.
 	 */
-	if (val & 0x3fc) {
+	if (val & MICD_LVL_0_TO_7) {
 		if (info->mic) {
 			dev_dbg(arizona->dev, "Mic button detected\n");
 
include/linux/mfd/arizona/registers.h +9 -0
index 4706d3d..10d9e70 100644
@@ -2196,6 +2196,15 @@
 /*
  * R677 (0x2A5) - Mic Detect 3
  */
+#define ARIZONA_MICD_LVL_0                       0x0004  /* MICD_LVL - [2] */
+#define ARIZONA_MICD_LVL_1                       0x0008  /* MICD_LVL - [3] */
+#define ARIZONA_MICD_LVL_2                       0x0010  /* MICD_LVL - [4] */
+#define ARIZONA_MICD_LVL_3                       0x0020  /* MICD_LVL - [5] */
+#define ARIZONA_MICD_LVL_4                       0x0040  /* MICD_LVL - [6] */
+#define ARIZONA_MICD_LVL_5                       0x0080  /* MICD_LVL - [7] */
+#define ARIZONA_MICD_LVL_6                       0x0100  /* MICD_LVL - [8] */
+#define ARIZONA_MICD_LVL_7                       0x0200  /* MICD_LVL - [9] */
+#define ARIZONA_MICD_LVL_8                       0x0400  /* MICD_LVL - [10] */
 #define ARIZONA_MICD_LVL_MASK                    0x07FC  /* MICD_LVL - [10:2] */
 #define ARIZONA_MICD_LVL_SHIFT                        2  /* MICD_LVL - [10:2] */
 #define ARIZONA_MICD_LVL_WIDTH                        9  /* MICD_LVL - [10:2] */
Signature · 1 line
1.7.2.5
#1 lore raw

PATCH 2/4 extcon: arizona: Fix reset of HPDET after race with removal

We need to make sure we reset back to our starting state, especially making sure that we have disabled poll in the register cache.

---
 drivers/extcon/extcon-arizona.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
drivers/extcon/extcon-arizona.c +7 -1
index 6d914ba..cce24de 100644
@@ -605,9 +605,15 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data)
 		dev_err(arizona->dev, "Failed to report HP/line: %d\n",
 			ret);
 
+done:
+	/* Reset back to starting range */
+	regmap_update_bits(arizona->regmap,
+			   ARIZONA_HEADPHONE_DETECT_1,
+			   ARIZONA_HP_IMPEDANCE_RANGE_MASK | ARIZONA_HP_POLL,
+			   0);
+
 	arizona_extcon_do_magic(info, 0);
 
-done:
 	if (id_gpio)
 		gpio_set_value_cansleep(id_gpio, 0);
 
Signature · 1 line
1.7.2.5
#2 lore raw

PATCH 3/4 extcon: arizona: Fix race with microphone detection and removal

In reply to Charles Keepax

The microphone detection code is run as delayed work to provide additional debounce, it is possible that the jack could have been removed by the time we process the microphone detection. Turn this case into a no op.

---
 drivers/extcon/extcon-arizona.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
drivers/extcon/extcon-arizona.c +13 -0
index cce24de..0d70bf6 100644
@@ -782,6 +782,19 @@ static void arizona_micd_detect(struct work_struct *work)
 
 	mutex_lock(&info->lock);
 
+	/* If the cable was removed while measuring ignore the result */
+	ret = extcon_get_cable_state_(&info->edev, ARIZONA_CABLE_MECHANICAL);
+	if (ret < 0) {
+		dev_err(arizona->dev, "Failed to check cable state: %d\n",
+				ret);
+		mutex_unlock(&info->lock);
+		return;
+	} else if (!ret) {
+		dev_dbg(arizona->dev, "Ignoring MICDET for removed cable\n");
+		mutex_unlock(&info->lock);
+		return;
+	}
+
 	for (i = 0; i < 10 && !(val & MICD_LVL_0_TO_8); i++) {
 		ret = regmap_read(arizona->regmap, ARIZONA_MIC_DETECT_3, &val);
 		if (ret != 0) {
Signature · 1 line
1.7.2.5
#3 lore raw

PATCH 4/4 extcon: arizona: Eliminate dead error handling code

In reply to Charles Keepax

As a small disclaimer I would personally prefer to not merge this patch. I have added it based on previous code review of the other patches in this chain.

arizona_hpdet_do_id currently can only return 0 or -EAGAIN making the else if clause handling error codes redundant, this patch removes this clause.

Whilst this clause is not currently hit removing it makes the code fragile. It will not be obvious whilst editing arizona_hpdet_do_id that you shouldn't add a return value other than 0 or -EAGAIN.

---
 drivers/extcon/extcon-arizona.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/extcon/extcon-arizona.c +3 -2
index 0d70bf6..2313b1e 100644
@@ -476,6 +476,9 @@ static int arizona_hpdet_read(struct arizona_extcon_info *info)
 	return val;
 }
 
+/* This function should only return 0 or -EAGAIN, if other return values are
+ * added additional handling should be added in arizona_hpdet_irq.
+ */
 static int arizona_hpdet_do_id(struct arizona_extcon_info *info, int *reading,
 			       bool *mic)
 {
@@ -591,8 +594,6 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data)
 	ret = arizona_hpdet_do_id(info, &reading, &mic);
 	if (ret == -EAGAIN)
 		goto out;
-	else if (ret < 0)
-		goto done;
 
 	/* Report high impedence cables as line outputs */
 	if (reading >= 5000)
Signature · 1 line
1.7.2.5
#4 lore raw

Re: [PATCH 4/4] extcon: arizona: Eliminate dead error handling code

Quoted 3 lines

As a small disclaimer I would personally prefer to not merge this patch. I have added it based on previous code review of the other patches in this chain.

I'd prefer the functionally redundant 'else if' over the comment.

I'm happy not to merge this patch.

Quoted 18 lines

arizona_hpdet_do_id currently can only return 0 or -EAGAIN making the else if clause handling error codes redundant, this patch removes this clause.

Whilst this clause is not currently hit removing it makes the code fragile. It will not be obvious whilst editing arizona_hpdet_do_id that you shouldn't add a return value other than 0 or -EAGAIN.

---
 drivers/extcon/extcon-arizona.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/extcon/extcon-arizona.c +0 -0
index 0d70bf6..2313b1e 100644

drivers/extcon/extcon-arizona.c static int arizona_hpdet_read(struct arizona_extcon_info *info) · line 481

Quoted 6 lines
drivers/extcon/extcon-arizona.c +3 -0
@@ -476,6 +476,9 @@ static int arizona_hpdet_read(struct arizona_extcon_info *info)
 	return val;
 }
 
+/* This function should only return 0 or -EAGAIN, if other return values are
+ * added additional handling should be added in arizona_hpdet_irq.
+ */

Please see: Documentation/CodingStyle: Chapter 8: Commenting

Quoted 12 lines
drivers/extcon/extcon-arizona.c +0 -2
 static int arizona_hpdet_do_id(struct arizona_extcon_info *info, int *reading,
 			       bool *mic)
 {
@@ -591,8 +594,6 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data)
 	ret = arizona_hpdet_do_id(info, &reading, &mic);
 	if (ret == -EAGAIN)
 		goto out;
-	else if (ret < 0)
-		goto done;
 
 	/* Report high impedence cables as line outputs */
 	if (reading >= 5000)
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#5 lore raw

Re: [PATCH 4/4] extcon: arizona: Eliminate dead error handling code

Quoted 7 lines · Lee Jones
Quoted 3 lines

As a small disclaimer I would personally prefer to not merge this patch. I have added it based on previous code review of the other patches in this chain.

I'd prefer the functionally redundant 'else if' over the comment.

I'm happy not to merge this patch.

I agree entirely the redundant 'else if' is much better.

Thanks,
Charles

maintainer
#6 lore raw

Re: [PATCH 4/4] extcon: arizona: Eliminate dead error handling code

In reply to Charles Keepax

Hi CHarles,

Quoted 22 lines · Charles Keepax

As a small disclaimer I would personally prefer to not merge this patch. I have added it based on previous code review of the other patches in this chain.

arizona_hpdet_do_id currently can only return 0 or -EAGAIN making the else if clause handling error codes redundant, this patch removes this clause.

Whilst this clause is not currently hit removing it makes the code fragile. It will not be obvious whilst editing arizona_hpdet_do_id that you shouldn't add a return value other than 0 or -EAGAIN.

---
 drivers/extcon/extcon-arizona.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/extcon/extcon-arizona.c +0 -0
index 0d70bf6..2313b1e 100644

drivers/extcon/extcon-arizona.c static int arizona_hpdet_read(struct arizona_extcon_info *info) · line 481

Quoted 6 lines
drivers/extcon/extcon-arizona.c +3 -0
@@ -476,6 +476,9 @@ static int arizona_hpdet_read(struct arizona_extcon_info *info)
 	return val;
 }
 
+/* This function should only return 0 or -EAGAIN, if other return values are
+ * added additional handling should be added in arizona_hpdet_irq.
+ */

As Lee Jones commented, you should modify this comment of arizona_hpdet_do_id() and add the description of return value. Because arizoa_hpdet_do_id() has different meaning between -EAGAIN and other minus value.

drivers/extcon/extcon-arizona.c static irqreturn_t arizona_hpdet_irq(int irq, void *data) · line 599

Quoted 13 lines
drivers/extcon/extcon-arizona.c +0 -2
 static int arizona_hpdet_do_id(struct arizona_extcon_info *info, int *reading,
 			       bool *mic)
 {
@@ -591,8 +594,6 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data)
 	ret = arizona_hpdet_do_id(info, &reading, &mic);
 	if (ret == -EAGAIN)
 		goto out;
-	else if (ret < 0)
-		goto done;
 
 	/* Report high impedence cables as line outputs */
 	if (reading >= 5000)

Thanks,
Chanwoo Choi

#7 lore raw

Re: [PATCH 4/4] extcon: arizona: Eliminate dead error handling code

Quoted 28 lines · Chanwoo Choi

Hi CHarles,

Quoted 25 lines · Charles Keepax

As a small disclaimer I would personally prefer to not merge this patch. I have added it based on previous code review of the other patches in this chain.

arizona_hpdet_do_id currently can only return 0 or -EAGAIN making the else if clause handling error codes redundant, this patch removes this clause.

Whilst this clause is not currently hit removing it makes the code fragile. It will not be obvious whilst editing arizona_hpdet_do_id that you shouldn't add a return value other than 0 or -EAGAIN.

---
 drivers/extcon/extcon-arizona.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/extcon/extcon-arizona.c +0 -0
index 0d70bf6..2313b1e 100644
@@ -476,6 +476,9 @@ static int arizona_hpdet_read(struct arizona_extcon_info *info)
 	return val;
 }
 
Quoted 7 lines

drivers/extcon/extcon-arizona.c static int arizona_hpdet_read(struct arizona_extcon_info *info) · line 481

Quoted 3 lines
drivers/extcon/extcon-arizona.c +3 -0
+/* This function should only return 0 or -EAGAIN, if other return values are
+ * added additional handling should be added in arizona_hpdet_irq.
+ */

As Lee Jones commented, you should modify this comment of arizona_hpdet_do_id() and add the description of return value. Because arizoa_hpdet_do_id() has different meaning between -EAGAIN and other minus value.

I take it you are still very keen on applying a patch for this dead code elimination? I really do feel it would be better to leave this part of the code as it currently is, the extra safety clearly outweights the cost of a redundant else if.

Thanks,
Charles

maintainer
#8 lore raw

Re: [PATCH 4/4] extcon: arizona: Eliminate dead error handling code

Quoted 37 lines · Charles Keepax
Quoted 28 lines · Chanwoo Choi

Hi CHarles,

Quoted 25 lines · Charles Keepax

As a small disclaimer I would personally prefer to not merge this patch. I have added it based on previous code review of the other patches in this chain.

arizona_hpdet_do_id currently can only return 0 or -EAGAIN making the else if clause handling error codes redundant, this patch removes this clause.

Whilst this clause is not currently hit removing it makes the code fragile. It will not be obvious whilst editing arizona_hpdet_do_id that you shouldn't add a return value other than 0 or -EAGAIN.

---
 drivers/extcon/extcon-arizona.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/extcon/extcon-arizona.c +0 -0
index 0d70bf6..2313b1e 100644
@@ -476,6 +476,9 @@ static int arizona_hpdet_read(struct arizona_extcon_info *info)
 	return val;
 }
 
Quoted 7 lines

drivers/extcon/extcon-arizona.c static int arizona_hpdet_read(struct arizona_extcon_info *info) · line 481

Quoted 3 lines
drivers/extcon/extcon-arizona.c +3 -0
+/* This function should only return 0 or -EAGAIN, if other return values are
+ * added additional handling should be added in arizona_hpdet_irq.
+ */

As Lee Jones commented, you should modify this comment of arizona_hpdet_do_id() and add the description of return value. Because arizoa_hpdet_do_id() has different meaning between -EAGAIN and other minus value.

Quoted 4 lines

I take it you are still very keen on applying a patch for this dead code elimination? I really do feel it would be better to leave this part of the code as it currently is, the extra safety clearly outweights the cost of a redundant else if.

In that case, I think that you could modify arizona_hpdet_read() to add exception handling for minus return value instead of elimination.

I knew about your opinion. But I think it isn't proper method remaining dead code on mainline tree. People who don't know the history about this dead code would think that "Is this code necessary?".

Thanks,
Chanwoo Choi

maintainer
#9 lore raw
In reply to Charles Keepax

Hi Charles,

Quoted 17 lines · Charles Keepax

Improve readability by creating a define for each microphone detection level.

---
 drivers/extcon/extcon-arizona.c       |   21 ++++++++++++++++-----
 include/linux/mfd/arizona/registers.h |    9 +++++++++
 2 files changed, 25 insertions(+), 5 deletions(-)
drivers/extcon/extcon-arizona.c +0 -0
index 3c55ec8..6d914ba 100644
@@ -44,6 +44,17 @@
 #define HPDET_DEBOUNCE 500
 #define DEFAULT_MICD_TIMEOUT 2000
 

drivers/extcon/extcon-arizona.c line 56

Quoted 10 lines
drivers/extcon/extcon-arizona.c +10 -0
+enum {
+	MICD_LVL_1_TO_7 = ARIZONA_MICD_LVL_1 | ARIZONA_MICD_LVL_2 |
+			  ARIZONA_MICD_LVL_3 | ARIZONA_MICD_LVL_4 |
+			  ARIZONA_MICD_LVL_5 | ARIZONA_MICD_LVL_6 |
+			  ARIZONA_MICD_LVL_7,
+
+	MICD_LVL_0_TO_7 = ARIZONA_MICD_LVL_0 | MICD_LVL_1_TO_7,
+
+	MICD_LVL_0_TO_8 = MICD_LVL_0_TO_7 | ARIZONA_MICD_LVL_8,
+};

MICD_LVL_1_TO_7 / MICD_LVL_0_TO_7 /MICD_LVL_0_TO_8 haven't the sequential value. I prefer '#define' keyword to define MICD_LVL_1_TO_7 / MICD_LVL_0_TO_7 /MICD_LVL_0_TO_8 instead of enum keyword.

Quoted 69 lines
drivers/extcon/extcon-arizona.c +6 -5
+
 struct arizona_extcon_info {
 	struct device *dev;
 	struct arizona *arizona;
@@ -765,7 +776,7 @@ static void arizona_micd_detect(struct work_struct *work)
 
 	mutex_lock(&info->lock);
 
-	for (i = 0; i < 10 && !(val & 0x7fc); i++) {
+	for (i = 0; i < 10 && !(val & MICD_LVL_0_TO_8); i++) {
 		ret = regmap_read(arizona->regmap, ARIZONA_MIC_DETECT_3, &val);
 		if (ret != 0) {
 			dev_err(arizona->dev,
@@ -784,7 +795,7 @@ static void arizona_micd_detect(struct work_struct *work)
 		}
 	}
 
-	if (i == 10 && !(val & 0x7fc)) {
+	if (i == 10 && !(val & MICD_LVL_0_TO_8)) {
 		dev_err(arizona->dev, "Failed to get valid MICDET value\n");
 		mutex_unlock(&info->lock);
 		return;
@@ -798,7 +809,7 @@ static void arizona_micd_detect(struct work_struct *work)
 	}
 
 	/* If we got a high impedence we should have a headset, report it. */
-	if (info->detecting && (val & 0x400)) {
+	if (info->detecting && (val & ARIZONA_MICD_LVL_8)) {
 		arizona_identify_headphone(info);
 
 		ret = extcon_update_state(&info->edev,
@@ -827,7 +838,7 @@ static void arizona_micd_detect(struct work_struct *work)
 	 * plain headphones.  If both polarities report a low
 	 * impedence then give up and report headphones.
 	 */
-	if (info->detecting && (val & 0x3f8)) {
+	if (info->detecting && (val & MICD_LVL_1_TO_7)) {
 		if (info->jack_flips >= info->micd_num_modes * 10) {
 			dev_dbg(arizona->dev, "Detected HP/line\n");
 			arizona_identify_headphone(info);
@@ -851,7 +862,7 @@ static void arizona_micd_detect(struct work_struct *work)
 	 * If we're still detecting and we detect a short then we've
 	 * got a headphone.  Otherwise it's a button press.
 	 */
-	if (val & 0x3fc) {
+	if (val & MICD_LVL_0_TO_7) {
 		if (info->mic) {
 			dev_dbg(arizona->dev, "Mic button detected\n");
 
include/linux/mfd/arizona/registers.h +9 -0
index 4706d3d..10d9e70 100644
@@ -2196,6 +2196,15 @@
 /*
  * R677 (0x2A5) - Mic Detect 3
  */
+#define ARIZONA_MICD_LVL_0                       0x0004  /* MICD_LVL - [2] */
+#define ARIZONA_MICD_LVL_1                       0x0008  /* MICD_LVL - [3] */
+#define ARIZONA_MICD_LVL_2                       0x0010  /* MICD_LVL - [4] */
+#define ARIZONA_MICD_LVL_3                       0x0020  /* MICD_LVL - [5] */
+#define ARIZONA_MICD_LVL_4                       0x0040  /* MICD_LVL - [6] */
+#define ARIZONA_MICD_LVL_5                       0x0080  /* MICD_LVL - [7] */
+#define ARIZONA_MICD_LVL_6                       0x0100  /* MICD_LVL - [8] */
+#define ARIZONA_MICD_LVL_7                       0x0200  /* MICD_LVL - [9] */
+#define ARIZONA_MICD_LVL_8                       0x0400  /* MICD_LVL - [10] */
 
 #define ARIZONA_MICD_LVL_MASK                    0x07FC  /* MICD_LVL - [10:2] */
 #define ARIZONA_MICD_LVL_SHIFT                        2  /* MICD_LVL - [10:2] */
Quoted 2 lines

#define ARIZONA_MICD_LVL_WIDTH 9 /* MICD_LVL - [10:2] */

Thanks,
Chanwoo Choi

#10 lore raw
Quoted 18 lines · Charles Keepax
Quoted 17 lines

Improve readability by creating a define for each microphone detection level.

---
 drivers/extcon/extcon-arizona.c       |   21 ++++++++++++++++-----
 include/linux/mfd/arizona/registers.h |    9 +++++++++
 2 files changed, 25 insertions(+), 5 deletions(-)
drivers/extcon/extcon-arizona.c +0 -0
index 3c55ec8..6d914ba 100644
@@ -44,6 +44,17 @@
 #define HPDET_DEBOUNCE 500
 #define DEFAULT_MICD_TIMEOUT 2000
 
Quoted 14 lines

drivers/extcon/extcon-arizona.c line 56

Quoted 10 lines
drivers/extcon/extcon-arizona.c +10 -0
+enum {
+	MICD_LVL_1_TO_7 = ARIZONA_MICD_LVL_1 | ARIZONA_MICD_LVL_2 |
+			  ARIZONA_MICD_LVL_3 | ARIZONA_MICD_LVL_4 |
+			  ARIZONA_MICD_LVL_5 | ARIZONA_MICD_LVL_6 |
+			  ARIZONA_MICD_LVL_7,
+
+	MICD_LVL_0_TO_7 = ARIZONA_MICD_LVL_0 | MICD_LVL_1_TO_7,
+
+	MICD_LVL_0_TO_8 = MICD_LVL_0_TO_7 | ARIZONA_MICD_LVL_8,
+};

MICD_LVL_1_TO_7 / MICD_LVL_0_TO_7 /MICD_LVL_0_TO_8 haven't the sequential value. I prefer '#define' keyword to define MICD_LVL_1_TO_7 / MICD_LVL_0_TO_7 /MICD_LVL_0_TO_8 instead of enum keyword.

Actually Charles has already sent me this patch and I applied it a while ago.

I'm inclined to agree with you though, so if you want to send a patch based on v3.14-rc1 I'd be happy to accept it.

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
maintainer
#11 lore raw
Quoted 33 lines · Lee Jones
Quoted 18 lines · Charles Keepax
Quoted 17 lines

Improve readability by creating a define for each microphone detection level.

---
 drivers/extcon/extcon-arizona.c       |   21 ++++++++++++++++-----
 include/linux/mfd/arizona/registers.h |    9 +++++++++
 2 files changed, 25 insertions(+), 5 deletions(-)
drivers/extcon/extcon-arizona.c +0 -0
index 3c55ec8..6d914ba 100644
@@ -44,6 +44,17 @@
 #define HPDET_DEBOUNCE 500
 #define DEFAULT_MICD_TIMEOUT 2000
 
Quoted 14 lines

drivers/extcon/extcon-arizona.c line 56

Quoted 10 lines
drivers/extcon/extcon-arizona.c +10 -0
+enum {
+	MICD_LVL_1_TO_7 = ARIZONA_MICD_LVL_1 | ARIZONA_MICD_LVL_2 |
+			  ARIZONA_MICD_LVL_3 | ARIZONA_MICD_LVL_4 |
+			  ARIZONA_MICD_LVL_5 | ARIZONA_MICD_LVL_6 |
+			  ARIZONA_MICD_LVL_7,
+
+	MICD_LVL_0_TO_7 = ARIZONA_MICD_LVL_0 | MICD_LVL_1_TO_7,
+
+	MICD_LVL_0_TO_8 = MICD_LVL_0_TO_7 | ARIZONA_MICD_LVL_8,
+};

MICD_LVL_1_TO_7 / MICD_LVL_0_TO_7 /MICD_LVL_0_TO_8 haven't the sequential value. I prefer '#define' keyword to define MICD_LVL_1_TO_7 / MICD_LVL_0_TO_7 /MICD_LVL_0_TO_8 instead of enum keyword.

Quoted 3 lines

Actually Charles has already sent me this patch and I applied it a while ago.

Why did you applied extcon driver patch on your tree?

#12 lore raw
Quoted 34 lines · Chanwoo Choi
Quoted 33 lines · Lee Jones
Quoted 32 lines · Charles Keepax
Quoted 17 lines

Improve readability by creating a define for each microphone detection level.

---
 drivers/extcon/extcon-arizona.c       |   21 ++++++++++++++++-----
 include/linux/mfd/arizona/registers.h |    9 +++++++++
 2 files changed, 25 insertions(+), 5 deletions(-)
drivers/extcon/extcon-arizona.c +0 -0
index 3c55ec8..6d914ba 100644
@@ -44,6 +44,17 @@
 #define HPDET_DEBOUNCE 500
 #define DEFAULT_MICD_TIMEOUT 2000
 

drivers/extcon/extcon-arizona.c line 56

Quoted 10 lines
drivers/extcon/extcon-arizona.c +10 -0
+enum {
+	MICD_LVL_1_TO_7 = ARIZONA_MICD_LVL_1 | ARIZONA_MICD_LVL_2 |
+			  ARIZONA_MICD_LVL_3 | ARIZONA_MICD_LVL_4 |
+			  ARIZONA_MICD_LVL_5 | ARIZONA_MICD_LVL_6 |
+			  ARIZONA_MICD_LVL_7,
+
+	MICD_LVL_0_TO_7 = ARIZONA_MICD_LVL_0 | MICD_LVL_1_TO_7,
+
+	MICD_LVL_0_TO_8 = MICD_LVL_0_TO_7 | ARIZONA_MICD_LVL_8,
+};

MICD_LVL_1_TO_7 / MICD_LVL_0_TO_7 /MICD_LVL_0_TO_8 haven't the sequential value. I prefer '#define' keyword to define MICD_LVL_1_TO_7 / MICD_LVL_0_TO_7 /MICD_LVL_0_TO_8 instead of enum keyword.

Quoted 4 lines
Quoted 2 lines

Actually Charles has already sent me this patch and I applied it a while ago.

Why did you applied extcon driver patch on your tree?

Good point, well presented!

I should have just Acked the MFD parts in this case.

It's not too late to pull it back - I'll do just that.

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
maintainer
#13 lore raw
Quoted 36 lines · Lee Jones
Quoted 34 lines · Chanwoo Choi
Quoted 33 lines · Lee Jones
Quoted 32 lines · Charles Keepax
Quoted 17 lines

Improve readability by creating a define for each microphone detection level.

---
 drivers/extcon/extcon-arizona.c       |   21 ++++++++++++++++-----
 include/linux/mfd/arizona/registers.h |    9 +++++++++
 2 files changed, 25 insertions(+), 5 deletions(-)
drivers/extcon/extcon-arizona.c +0 -0
index 3c55ec8..6d914ba 100644
@@ -44,6 +44,17 @@
 #define HPDET_DEBOUNCE 500
 #define DEFAULT_MICD_TIMEOUT 2000
 

drivers/extcon/extcon-arizona.c line 56

Quoted 10 lines
drivers/extcon/extcon-arizona.c +10 -0
+enum {
+	MICD_LVL_1_TO_7 = ARIZONA_MICD_LVL_1 | ARIZONA_MICD_LVL_2 |
+			  ARIZONA_MICD_LVL_3 | ARIZONA_MICD_LVL_4 |
+			  ARIZONA_MICD_LVL_5 | ARIZONA_MICD_LVL_6 |
+			  ARIZONA_MICD_LVL_7,
+
+	MICD_LVL_0_TO_7 = ARIZONA_MICD_LVL_0 | MICD_LVL_1_TO_7,
+
+	MICD_LVL_0_TO_8 = MICD_LVL_0_TO_7 | ARIZONA_MICD_LVL_8,
+};

MICD_LVL_1_TO_7 / MICD_LVL_0_TO_7 /MICD_LVL_0_TO_8 haven't the sequential value. I prefer '#define' keyword to define MICD_LVL_1_TO_7 / MICD_LVL_0_TO_7 /MICD_LVL_0_TO_8 instead of enum keyword.

Quoted 9 lines
Quoted 4 lines
Quoted 2 lines

Actually Charles has already sent me this patch and I applied it a while ago.

Why did you applied extcon driver patch on your tree?

Good point, well presented!

I should have just Acked the MFD parts in this case.

OK, I understand.

Thanks,
Chanwoo Choi

#14 lore raw
In reply to Lee Jones
Quoted 18 lines · Lee Jones
Quoted 18 lines · Charles Keepax
Quoted 17 lines

Improve readability by creating a define for each microphone detection level.

---
 drivers/extcon/extcon-arizona.c       |   21 ++++++++++++++++-----
 include/linux/mfd/arizona/registers.h |    9 +++++++++
 2 files changed, 25 insertions(+), 5 deletions(-)
drivers/extcon/extcon-arizona.c +0 -0
index 3c55ec8..6d914ba 100644
@@ -44,6 +44,17 @@
 #define HPDET_DEBOUNCE 500
 #define DEFAULT_MICD_TIMEOUT 2000
 
Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
drivers/extcon/extcon-arizona.c +6 -0
+enum {
+	MICD_LVL_1_TO_7 = ARIZONA_MICD_LVL_1 | ARIZONA_MICD_LVL_2 |
+			  ARIZONA_MICD_LVL_3 | ARIZONA_MICD_LVL_4 |
+			  ARIZONA_MICD_LVL_5 | ARIZONA_MICD_LVL_6 |
+			  ARIZONA_MICD_LVL_7,
+
Quoted 8 lines

drivers/extcon/extcon-arizona.c line 56

Quoted 4 lines
drivers/extcon/extcon-arizona.c +4 -0
+	MICD_LVL_0_TO_7 = ARIZONA_MICD_LVL_0 | MICD_LVL_1_TO_7,
+
+	MICD_LVL_0_TO_8 = MICD_LVL_0_TO_7 | ARIZONA_MICD_LVL_8,
+};

MICD_LVL_1_TO_7 / MICD_LVL_0_TO_7 /MICD_LVL_0_TO_8 haven't the sequential value. I prefer '#define' keyword to define MICD_LVL_1_TO_7 / MICD_LVL_0_TO_7 /MICD_LVL_0_TO_8 instead of enum keyword.

I will do an incremental patch to update them to defines.

Quoted 5 lines

Actually Charles has already sent me this patch and I applied it a while ago.

I'm inclined to agree with you though, so if you want to send a patch based on v3.14-rc1 I'd be happy to accept it.

Apologies for causing confusion here I checked your tree for the patch and didn't see it, so I assumed you had decided not to apply it. I must have missed it some how.

Thanks,
Charles

#15 lore raw
Quoted 41 lines · Charles Keepax
Quoted 18 lines · Lee Jones
Quoted 18 lines · Charles Keepax
Quoted 17 lines

Improve readability by creating a define for each microphone detection level.

---
 drivers/extcon/extcon-arizona.c       |   21 ++++++++++++++++-----
 include/linux/mfd/arizona/registers.h |    9 +++++++++
 2 files changed, 25 insertions(+), 5 deletions(-)
drivers/extcon/extcon-arizona.c +0 -0
index 3c55ec8..6d914ba 100644
@@ -44,6 +44,17 @@
 #define HPDET_DEBOUNCE 500
 #define DEFAULT_MICD_TIMEOUT 2000
 
Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
drivers/extcon/extcon-arizona.c +6 -0
+enum {
+	MICD_LVL_1_TO_7 = ARIZONA_MICD_LVL_1 | ARIZONA_MICD_LVL_2 |
+			  ARIZONA_MICD_LVL_3 | ARIZONA_MICD_LVL_4 |
+			  ARIZONA_MICD_LVL_5 | ARIZONA_MICD_LVL_6 |
+			  ARIZONA_MICD_LVL_7,
+
Quoted 8 lines

drivers/extcon/extcon-arizona.c line 56

Quoted 4 lines
drivers/extcon/extcon-arizona.c +4 -0
+	MICD_LVL_0_TO_7 = ARIZONA_MICD_LVL_0 | MICD_LVL_1_TO_7,
+
+	MICD_LVL_0_TO_8 = MICD_LVL_0_TO_7 | ARIZONA_MICD_LVL_8,
+};

MICD_LVL_1_TO_7 / MICD_LVL_0_TO_7 /MICD_LVL_0_TO_8 haven't the sequential value. I prefer '#define' keyword to define MICD_LVL_1_TO_7 / MICD_LVL_0_TO_7 /MICD_LVL_0_TO_8 instead of enum keyword.

I will do an incremental patch to update them to defines.

Quoted 3 lines

Actually Charles has already sent me this patch and I applied it a while ago.

Quoted 6 lines
Quoted 2 lines

I'm inclined to agree with you though, so if you want to send a patch based on v3.14-rc1 I'd be happy to accept it.

Apologies for causing confusion here I checked your tree for the patch and didn't see it, so I assumed you had decided not to apply it. I must have missed it some how.

So I am partly to blame here. My public repos sometimes aren't as up-to-date and my private ones, but if I've replied to a patch and said I've applied it, I inevitably have.

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
maintainer
#16 lore raw
Quoted 46 lines · Lee Jones
Quoted 44 lines · Charles Keepax
Quoted 18 lines · Lee Jones
Quoted 18 lines · Charles Keepax
Quoted 17 lines

Improve readability by creating a define for each microphone detection level.

---
 drivers/extcon/extcon-arizona.c       |   21 ++++++++++++++++-----
 include/linux/mfd/arizona/registers.h |    9 +++++++++
 2 files changed, 25 insertions(+), 5 deletions(-)
drivers/extcon/extcon-arizona.c +0 -0
index 3c55ec8..6d914ba 100644
@@ -44,6 +44,17 @@
 #define HPDET_DEBOUNCE 500
 #define DEFAULT_MICD_TIMEOUT 2000
 
Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
drivers/extcon/extcon-arizona.c +6 -0
+enum {
+	MICD_LVL_1_TO_7 = ARIZONA_MICD_LVL_1 | ARIZONA_MICD_LVL_2 |
+			  ARIZONA_MICD_LVL_3 | ARIZONA_MICD_LVL_4 |
+			  ARIZONA_MICD_LVL_5 | ARIZONA_MICD_LVL_6 |
+			  ARIZONA_MICD_LVL_7,
+
Quoted 8 lines

drivers/extcon/extcon-arizona.c line 56

Quoted 4 lines
drivers/extcon/extcon-arizona.c +4 -0
+	MICD_LVL_0_TO_7 = ARIZONA_MICD_LVL_0 | MICD_LVL_1_TO_7,
+
+	MICD_LVL_0_TO_8 = MICD_LVL_0_TO_7 | ARIZONA_MICD_LVL_8,
+};

MICD_LVL_1_TO_7 / MICD_LVL_0_TO_7 /MICD_LVL_0_TO_8 haven't the sequential value. I prefer '#define' keyword to define MICD_LVL_1_TO_7 / MICD_LVL_0_TO_7 /MICD_LVL_0_TO_8 instead of enum keyword.

I will do an incremental patch to update them to defines.

Quoted 5 lines

Actually Charles has already sent me this patch and I applied it a while ago.

I'm inclined to agree with you though, so if you want to send a patch based on v3.14-rc1 I'd be happy to accept it.

Quoted 8 lines
Quoted 3 lines

Apologies for causing confusion here I checked your tree for the patch and didn't see it, so I assumed you had decided not to apply it. I must have missed it some how.

So I am partly to blame here. My public repos sometimes aren't as up-to-date and my private ones, but if I've replied to a patch and said I've applied it, I inevitably have.

But this patch has only the dependency of extcon subsystem.
At least, you have to get 'Acked-by' or 'Signed-off-by' from subsystem maintainer. I didn't agree applying this patch on mainline tree.

#17 lore raw
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines

I'm inclined to agree with you though, so if you want to send a patch based on v3.14-rc1 I'd be happy to accept it.

Apologies for causing confusion here I checked your tree for the patch and didn't see it, so I assumed you had decided not to apply it. I must have missed it some how.

Quoted 7 lines
Quoted 4 lines

So I am partly to blame here. My public repos sometimes aren't as up-to-date and my private ones, but if I've replied to a patch and said I've applied it, I inevitably have.

But this patch has only the dependency of extcon subsystem.
At least, you have to get 'Acked-by' or 'Signed-off-by' from subsystem maintainer. I didn't agree applying this patch on mainline tree.

Please see my other mail.

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#18 lore raw
Quoted 11 lines · Lee Jones
Quoted 11 lines
Quoted 11 lines
Quoted 6 lines
Quoted 2 lines

I'm inclined to agree with you though, so if you want to send a patch based on v3.14-rc1 I'd be happy to accept it.

Apologies for causing confusion here I checked your tree for the patch and didn't see it, so I assumed you had decided not to apply it. I must have missed it some how.

So I am partly to blame here. My public repos sometimes aren't as up-to-date and my private ones, but if I've replied to a patch and said I've applied it, I inevitably have.

Quoted 5 lines
Quoted 3 lines

But this patch has only the dependency of extcon subsystem.
At least, you have to get 'Acked-by' or 'Signed-off-by' from subsystem maintainer. I didn't agree applying this patch on mainline tree.

Please see my other mail.

Sorry for the sake of clarity, we are backing out the patch and I should send a fresh one?

Thanks,
Charles

#19 lore raw
Quoted 12 lines · Charles Keepax
Quoted 11 lines · Lee Jones
Quoted 11 lines
Quoted 11 lines
Quoted 6 lines
Quoted 2 lines

I'm inclined to agree with you though, so if you want to send a patch based on v3.14-rc1 I'd be happy to accept it.

Apologies for causing confusion here I checked your tree for the patch and didn't see it, so I assumed you had decided not to apply it. I must have missed it some how.

So I am partly to blame here. My public repos sometimes aren't as up-to-date and my private ones, but if I've replied to a patch and said I've applied it, I inevitably have.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

But this patch has only the dependency of extcon subsystem.
At least, you have to get 'Acked-by' or 'Signed-off-by' from subsystem maintainer. I didn't agree applying this patch on mainline tree.

Please see my other mail.

Sorry for the sake of clarity, we are backing out the patch and I should send a fresh one?

I don't think there is a requirement to resend, but Chanwoo is right, I can't take this patch. It's up to him.

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
Acked-by on v1 1/4
#20 lore raw
In reply to Charles Keepax
Quoted 8 lines · Charles Keepax

Improve readability by creating a define for each microphone detection level.

---
 drivers/extcon/extcon-arizona.c       |   21 ++++++++++++++++-----
 include/linux/mfd/arizona/registers.h |    9 +++++++++
 2 files changed, 25 insertions(+), 5 deletions(-)

For the MFD parts:

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog