Skip to contentSkip to conversation

Arizona Extcon Update Device Bindings

PATCH Superseded Charles Keepax 4 participants 14 messages Sep 16, 2015 – Sep 27, 2015

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover Arizona Extcon Update Device Bindings

Hi,

This patch chain adds device bindings for the jack and microphone detection system specific settings.

Some of the bindings in this chain depend on features that are being added in the following chain of patches:

https://lkml.org/lkml/2015/9/16/244

Thanks,
Charles

Charles Keepax (6):
extcon: arizona: Add device binding to enable ADC mode micdet
extcon: arizona: Add device binding for the general purpose switch
extcon: arizona: Add device binding for jack detect polarity
inversion
extcon: arizona: Add device binding for second jack detect pin on
GPIO5
mfd: arizona: Update DT binding documentation for mic detection
mfd: arizona: Update DT binding documentation for jack detection

 Documentation/devicetree/bindings/mfd/arizona.txt |   27 +++++++++++++++++++++
 drivers/extcon/extcon-arizona.c                   |   13 ++++++++++
 include/dt-bindings/mfd/arizona.h                 |    5 ++++
 3 files changed, 45 insertions(+), 0 deletions(-)
Signature · 1 line
1.7.2.5
#1 lore raw

PATCH 1/6 extcon: arizona: Add device binding to enable ADC mode micdet

Add a simple boolean binding to turn on and off the use of ADC microphone detection mode to determine 3/4 pole jack.

---
 drivers/extcon/extcon-arizona.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/extcon/extcon-arizona.c +3 -0
index 4479781..869a920 100644
@@ -1227,6 +1227,9 @@ static int arizona_extcon_device_get_pdata(struct arizona *arizona)
 	pdata->micd_force_micbias = device_property_read_bool(arizona->dev,
 						"wlf,micd-force-micbias");
 
+	pdata->micd_software_compare = device_property_read_bool(arizona->dev,
+						"wlf,micd-software-compare");
+
 	return 0;
 }
 
Signature · 6 lines
1.7.2.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer Acked-by on v1 1/6
#2 lore raw

Re: [PATCH 1/6] extcon: arizona: Add device binding to enable ADC mode micdet

Hi Charles,

Quoted 14 lines · Charles Keepax

Add a simple boolean binding to turn on and off the use of ADC microphone detection mode to determine 3/4 pole jack.

---
 drivers/extcon/extcon-arizona.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/extcon/extcon-arizona.c +0 -0
index 4479781..869a920 100644

drivers/extcon/extcon-arizona.c static int arizona_extcon_device_get_pdata(struct arizona *arizona) · line 1235

Quoted 9 lines
drivers/extcon/extcon-arizona.c +3 -0
@@ -1227,6 +1227,9 @@ static int arizona_extcon_device_get_pdata(struct arizona *arizona)
 	pdata->micd_force_micbias = device_property_read_bool(arizona->dev,
 						"wlf,micd-force-micbias");
 
+	pdata->micd_software_compare = device_property_read_bool(arizona->dev,
+						"wlf,micd-software-compare");
+
 	return 0;
 }
 

Thanks,
Chanwoo Choi

#3 lore raw

PATCH 2/6 extcon: arizona: Add device binding for the general purpose switch

In reply to Charles Keepax

The switch is generally used in conjunction with the MICDET clamp to suppress pops and clicks associated with jack insertion. This patch adds a binding that allows the user to select the mode of operation for this switch.

---
 drivers/extcon/extcon-arizona.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/extcon/extcon-arizona.c +2 -0
index 869a920..5b4bc2f 100644
@@ -1230,6 +1230,8 @@ static int arizona_extcon_device_get_pdata(struct arizona *arizona)
 	pdata->micd_software_compare = device_property_read_bool(arizona->dev,
 						"wlf,micd-software-compare");
 
+	device_property_read_u32(arizona->dev, "wlf,gpsw", &pdata->gpsw);
+
 	return 0;
 }
 
Signature · 1 line
1.7.2.5
maintainer Acked-by on v1 2/6
#4 lore raw

Re: [PATCH 2/6] extcon: arizona: Add device binding for the general purpose switch

Hi Charles,

Quoted 16 lines · Charles Keepax

The switch is generally used in conjunction with the MICDET clamp to suppress pops and clicks associated with jack insertion. This patch adds a binding that allows the user to select the mode of operation for this switch.

---
 drivers/extcon/extcon-arizona.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/extcon/extcon-arizona.c +0 -0
index 869a920..5b4bc2f 100644

drivers/extcon/extcon-arizona.c static int arizona_extcon_device_get_pdata(struct arizona *arizona) · line 1237

Quoted 8 lines
drivers/extcon/extcon-arizona.c +2 -0
@@ -1230,6 +1230,8 @@ static int arizona_extcon_device_get_pdata(struct arizona *arizona)
 	pdata->micd_software_compare = device_property_read_bool(arizona->dev,
 						"wlf,micd-software-compare");
 
+	device_property_read_u32(arizona->dev, "wlf,gpsw", &pdata->gpsw);
+
 	return 0;
 }
 

Thanks,
Chanwoo Choi

#5 lore raw

PATCH 3/6 extcon: arizona: Add device binding for jack detect polarity inversion

In reply to Charles Keepax

By default the driver expects the jackdet pin to be pulled low when a jack is inserted. This patch adds a device binding that allows the user to specify that the jackdet pin will be pulled high when a jack is inserted.

---
 drivers/extcon/extcon-arizona.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/extcon/extcon-arizona.c +3 -0
index 5b4bc2f..dc1910d 100644
@@ -1230,6 +1230,9 @@ static int arizona_extcon_device_get_pdata(struct arizona *arizona)
 	pdata->micd_software_compare = device_property_read_bool(arizona->dev,
 						"wlf,micd-software-compare");
 
+	pdata->jd_invert = device_property_read_bool(arizona->dev,
+						     "wlf,jd-invert");
+
 	device_property_read_u32(arizona->dev, "wlf,gpsw", &pdata->gpsw);
 
 	return 0;
Signature · 1 line
1.7.2.5
#6 lore raw

PATCH 4/6 extcon: arizona: Add device binding for second jack detect pin on GPIO5

In reply to Charles Keepax

Some Arizona devices have the option to use the GPIO5 pin as a second jack detection pin. This patch adds device bindings to specify to the driver that it should use this pin. Note that the second jack detection pin is hard wired in the chip so can only be enabled through the binding, rather than a pin being specified.

---
 drivers/extcon/extcon-arizona.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/extcon/extcon-arizona.c +5 -0
index dc1910d..992f80e 100644
@@ -1235,6 +1235,11 @@ static int arizona_extcon_device_get_pdata(struct arizona *arizona)
 
 	device_property_read_u32(arizona->dev, "wlf,gpsw", &pdata->gpsw);
 
+	pdata->jd_gpio5 = device_property_read_bool(arizona->dev,
+						    "wlf,use-jd-gpio");
+	pdata->jd_gpio5_nopull = device_property_read_bool(arizona->dev,
+						"wlf,use-jd-gpio-nopull");
+
 	return 0;
 }
 
Signature · 1 line
1.7.2.5
maintainer
#7 lore raw

Re: [PATCH 4/6] extcon: arizona: Add device binding for second jack detect pin on GPIO5

Hi Charles,

I have one comment.
I think current extcon-arizona.c has the many platform data so, extcon-arizona.c use the too much if statement to support each feature for different wolfsonmicro codec. I think it cause the complicated code.

For example,
You may use 'struct of_device_id' as following. You used already this method on drivers/mfd/arizona-core.c. If you separate the function of each wmXXXX arizona, it makes improved readability for extcon-arizona.c and some user will use extcon-arizora more easily.

struct arizona_extcon_data {
	void (*init)(...);
	void (*irq_handler)(...);
	...	
};
struct arizona_extcon_data wm8994_data {
	.init = wm8994_extcon_init,
	.irq_handler = wm8994_extcon_irq_handler;
	...
};
static const struct of_device_id arizona_extcon_dt_match[] = {
	{
		.compatible = "wm8994-arizona-extcon",
		.data = (void *)wm8994_data;
	}, {
		.compatible = "wmXXXX-arizona-extcon",
		.data = (void *)wmXXXX_data;
	}, 
};

I expect that you will revise the arizona-extcon.c driver on next time.

Thanks,
Chanwoo Choi

Quoted 19 lines · Charles Keepax

Some Arizona devices have the option to use the GPIO5 pin as a second jack detection pin. This patch adds device bindings to specify to the driver that it should use this pin. Note that the second jack detection pin is hard wired in the chip so can only be enabled through the binding, rather than a pin being specified.

---
 drivers/extcon/extcon-arizona.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/extcon/extcon-arizona.c +0 -0
index dc1910d..992f80e 100644
@@ -1235,6 +1235,11 @@ static int arizona_extcon_device_get_pdata(struct arizona *arizona)
 

drivers/extcon/extcon-arizona.c static int arizona_extcon_device_get_pdata(struct arizona *arizona) · line 1245

Quoted 10 lines
drivers/extcon/extcon-arizona.c +5 -0
 	device_property_read_u32(arizona->dev, "wlf,gpsw", &pdata->gpsw);
 
+	pdata->jd_gpio5 = device_property_read_bool(arizona->dev,
+						    "wlf,use-jd-gpio");
+	pdata->jd_gpio5_nopull = device_property_read_bool(arizona->dev,
+						"wlf,use-jd-gpio-nopull");
+
 	return 0;
 }
 

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#8 lore raw

Re: [PATCH 4/6] extcon: arizona: Add device binding for second jack detect pin on GPIO5

Quoted 35 lines · Chanwoo Choi

Hi Charles,

I have one comment.
I think current extcon-arizona.c has the many platform data so, extcon-arizona.c use the too much if statement to support each feature for different wolfsonmicro codec. I think it cause the complicated code.

For example,
You may use 'struct of_device_id' as following. You used already this method on drivers/mfd/arizona-core.c. If you separate the function of each wmXXXX arizona, it makes improved readability for extcon-arizona.c and some user will use extcon-arizora more easily.

struct arizona_extcon_data {
	void (*init)(...);
	void (*irq_handler)(...);
	...	
};
struct arizona_extcon_data wm8994_data {
	.init = wm8994_extcon_init,
	.irq_handler = wm8994_extcon_irq_handler;
	...
};
static const struct of_device_id arizona_extcon_dt_match[] = {
	{
		.compatible = "wm8994-arizona-extcon",
		.data = (void *)wm8994_data;
	}, {
		.compatible = "wmXXXX-arizona-extcon",
		.data = (void *)wmXXXX_data;
	}, 
};
Quoted 1 line

I expect that you will revise the arizona-extcon.c driver on next time.

I will have an investigation to see what ideas I can come up with here and send through some patches.

But I am slightly worried you think the gains will be better than they actually will be. Most of the platform data is just that platform data, and needs to be configured based on the system not based on the CODEC.

Thanks,
Charles
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#9 lore raw

Re: [PATCH 4/6] extcon: arizona: Add device binding for second jack detect pin on GPIO5

Quoted 38 lines · Charles Keepax
Quoted 35 lines · Chanwoo Choi

Hi Charles,

I have one comment.
I think current extcon-arizona.c has the many platform data so, extcon-arizona.c use the too much if statement to support each feature for different wolfsonmicro codec. I think it cause the complicated code.

For example,
You may use 'struct of_device_id' as following. You used already this method on drivers/mfd/arizona-core.c. If you separate the function of each wmXXXX arizona, it makes improved readability for extcon-arizona.c and some user will use extcon-arizora more easily.

struct arizona_extcon_data {
      void (*init)(...);
      void (*irq_handler)(...);
      ...
};
struct arizona_extcon_data wm8994_data {
      .init = wm8994_extcon_init,
      .irq_handler = wm8994_extcon_irq_handler;
      ...
};
static const struct of_device_id arizona_extcon_dt_match[] = {
      {
              .compatible = "wm8994-arizona-extcon",
              .data = (void *)wm8994_data;
      }, {
              .compatible = "wmXXXX-arizona-extcon",
              .data = (void *)wmXXXX_data;
      },
};
Quoted 1 line

I expect that you will revise the arizona-extcon.c driver on next time.

Quoted 7 lines

I will have an investigation to see what ideas I can come up with here and send through some patches.

But I am slightly worried you think the gains will be better than they actually will be. Most of the platform data is just that platform data, and needs to be configured based on the system not based on the CODEC.

I agree. As you mentioned, platform data will be configured based on the system. But, I mean that there are many platform datas for extcon-arizona in "struct arizona_pdata" (in include/linux/mfd/arizona/pdata.h).

There are four sound code using the extcon-arizona driver as
following: I check the following list
in drivers/mfd/arizona-core.c.
- wm5102
- wm5110
- wm8997
- wm8998

If upper four sound codec include the same headset detection IP (extcon-arizona.c)
without any difference about detection IP in sound codec, you don't need to revise
the extcon-arizona.c driver.

But, If some field of "struct arizona_pdata" (in include/linux/mfd/arizona/pdata.h)
are used for only specific sound codec (wmXXX series), I think we need to revise it.

I'm positive about your patches of extcon-arizona. Just I think that you can make it
more easier and improved readability.

Thanks,
Chanwoo Choi

#10 lore raw

PATCH 5/6 mfd: arizona: Update DT binding documentation for mic detection

In reply to Charles Keepax

Add additional bindings to allow configuration of the system specific microphone detection settings.

---
 Documentation/devicetree/bindings/mfd/arizona.txt |   21 +++++++++++++++++++++
 include/dt-bindings/mfd/arizona.h                 |    5 +++++
 2 files changed, 26 insertions(+), 0 deletions(-)
Documentation/devicetree/bindings/mfd/arizona.txt +21 -0
index a8fee60..b98a11b 100644
@@ -73,6 +73,27 @@ Optional properties:
     If this node is not mentioned or if the value is unknown, then
     headphone detection mode is set to HPDETL.
 
+  - wlf,micd-software-compare : Use a software comparison to determine mic
+    presence
+  - wlf,micd-detect-debounce : Additional software microphone detection
+    debounce specified in milliseconds.
+  - wlf,micd-pol-gpio : GPIO specifier for the GPIO controlling the headset
+    polarity if one exists.
+  - wlf,micd-bias-start-time : Time allowed for MICBIAS to startup prior to
+    performing microphone detection, specified as per the ARIZONA_MICD_TIME_XXX
+    defines.
+  - wlf,micd-rate : Delay between successive microphone detection measurements,
+    specified as per the ARIZONA_MICD_TIME_XXX defines.
+  - wlf,micd-dbtime : Microphone detection hardware debounces specified as the
+    number of measurements to take, valid values being 2 and 4.
+  - wlf,micd-timeout : Timeout for microphone detection, specified in
+    milliseconds.
+  - wlf,micd-force-micbias : Force MICBIAS continuously on during microphone
+    detection.
+
+  - wlf,gpsw : Settings for the general purpose switch, set as one of the
+    ARIZONA_GPSW_XXX defines.
+
   - DCVDD-supply, MICVDD-supply : Power supplies, only need to be specified if
     they are being externally supplied. As covered in
     Documentation/devicetree/bindings/regulator/regulator.txt
include/dt-bindings/mfd/arizona.h +5 -0
index c40f665..dedf46f 100644
@@ -110,4 +110,9 @@
 #define ARIZONA_ACCDET_MODE_HPM 4
 #define ARIZONA_ACCDET_MODE_ADC 7
 
+#define ARIZONA_GPSW_OPEN           0
+#define ARIZONA_GPSW_CLOSED         1
+#define ARIZONA_GPSW_CLAMP_ENABLED  2
+#define ARIZONA_GPSW_CLAMP_DISABLED 3
+
 #endif
Signature · 1 line
1.7.2.5
#11 lore raw

Re: [PATCH 5/6] mfd: arizona: Update DT binding documentation for mic detection

Quoted 27 lines · Charles Keepax

Add additional bindings to allow configuration of the system specific microphone detection settings.

---
 Documentation/devicetree/bindings/mfd/arizona.txt |   21 +++++++++++++++++++++
 include/dt-bindings/mfd/arizona.h                 |    5 +++++
 2 files changed, 26 insertions(+), 0 deletions(-)
Documentation/devicetree/bindings/mfd/arizona.txt +10 -0
index a8fee60..b98a11b 100644
@@ -73,6 +73,27 @@ Optional properties:
     If this node is not mentioned or if the value is unknown, then
     headphone detection mode is set to HPDETL.
 
+  - wlf,micd-software-compare : Use a software comparison to determine mic
+    presence
+  - wlf,micd-detect-debounce : Additional software microphone detection
+    debounce specified in milliseconds.
+  - wlf,micd-pol-gpio : GPIO specifier for the GPIO controlling the headset
+    polarity if one exists.
+  - wlf,micd-bias-start-time : Time allowed for MICBIAS to startup prior to
+    performing microphone detection, specified as per the ARIZONA_MICD_TIME_XXX
+    defines.
+  - wlf,micd-rate : Delay between successive microphone detection measurements,

Documentation/devicetree/bindings/mfd/arizona.txt Optional properties: · line 95

Quoted 10 lines
Documentation/devicetree/bindings/mfd/arizona.txt +10 -0
+    specified as per the ARIZONA_MICD_TIME_XXX defines.
+  - wlf,micd-dbtime : Microphone detection hardware debounces specified as the
+    number of measurements to take, valid values being 2 and 4.
+  - wlf,micd-timeout : Timeout for microphone detection, specified in
+    milliseconds.
+  - wlf,micd-force-micbias : Force MICBIAS continuously on during microphone
+    detection.
+
+  - wlf,gpsw : Settings for the general purpose switch, set as one of the
+    ARIZONA_GPSW_XXX defines.

I either need an Ack from the DT folks, or at least someone who knows about this stuff. Mark perhaps.

Quoted 17 lines
Documentation/devicetree/bindings/mfd/arizona.txt +0 -0
   - DCVDD-supply, MICVDD-supply : Power supplies, only need to be specified if
     they are being externally supplied. As covered in
     Documentation/devicetree/bindings/regulator/regulator.txt
include/dt-bindings/mfd/arizona.h +5 -0
index c40f665..dedf46f 100644
@@ -110,4 +110,9 @@
 #define ARIZONA_ACCDET_MODE_HPM 4
 #define ARIZONA_ACCDET_MODE_ADC 7
 
+#define ARIZONA_GPSW_OPEN           0
+#define ARIZONA_GPSW_CLOSED         1
+#define ARIZONA_GPSW_CLAMP_ENABLED  2
+#define ARIZONA_GPSW_CLAMP_DISABLED 3
+
 #endif
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#12 lore raw

PATCH 6/6 mfd: arizona: Update DT binding documentation for jack detection

In reply to Charles Keepax

Add additional bindings for both inverting the polarity of the jack detection pins and allowing the use of a second jack detection pin. Note that the second jack detection pin is hard wired in the chip so can only be enabled through the binding, rather than a pin being specified.

---
 Documentation/devicetree/bindings/mfd/arizona.txt |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
Documentation/devicetree/bindings/mfd/arizona.txt +6 -0
index b98a11b..cb3a652 100644
@@ -73,6 +73,12 @@ Optional properties:
     If this node is not mentioned or if the value is unknown, then
     headphone detection mode is set to HPDETL.
 
+  - wlf,use-jd-gpio : Use GPIO input along with JD1 for dual pin jack
+    detection.
+  - wlf,use-jd-gpio-nopull : Internal pull on GPIO is disabled when used for
+    jack detection.
+  - wlf,jd-invert : Invert the polarity of the jack detection switch
+
   - wlf,micd-software-compare : Use a software comparison to determine mic
     presence
   - wlf,micd-detect-debounce : Additional software microphone detection
Signature · 6 lines
1.7.2.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#13 lore raw

Re: [PATCH 6/6] mfd: arizona: Update DT binding documentation for jack detection

Quoted 16 lines · Charles Keepax

Add additional bindings for both inverting the polarity of the jack detection pins and allowing the use of a second jack detection pin. Note that the second jack detection pin is hard wired in the chip so can only be enabled through the binding, rather than a pin being specified.

---
 Documentation/devicetree/bindings/mfd/arizona.txt |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
Documentation/devicetree/bindings/mfd/arizona.txt +0 -0
index b98a11b..cb3a652 100644

Documentation/devicetree/bindings/mfd/arizona.txt Optional properties: · line 80

Quoted 8 lines
Documentation/devicetree/bindings/mfd/arizona.txt +5 -0
@@ -73,6 +73,12 @@ Optional properties:
     If this node is not mentioned or if the value is unknown, then
     headphone detection mode is set to HPDETL.
 
+  - wlf,use-jd-gpio : Use GPIO input along with JD1 for dual pin jack
+    detection.
+  - wlf,use-jd-gpio-nopull : Internal pull on GPIO is disabled when used for
+    jack detection.
+  - wlf,jd-invert : Invert the polarity of the jack detection switch

As before, I need an Ack from one of the DT guys, or perhaps Linus W.

Quoted 3 lines
Documentation/devicetree/bindings/mfd/arizona.txt +0 -0
   - wlf,micd-software-compare : Use a software comparison to determine mic
     presence
   - wlf,micd-detect-debounce : Additional software microphone detection
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog