All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/7] Add basic microphone detection bindings
@ 2015-06-19 10:24 Charles Keepax
  2015-06-19 10:24 ` [PATCH v3 1/7] extcon: arizona: Factor out initial GPIO state Charles Keepax
                   ` (7 more replies)
  0 siblings, 8 replies; 18+ messages in thread
From: Charles Keepax @ 2015-06-19 10:24 UTC (permalink / raw)
  To: cw00.choi; +Cc: myungjoo.ham, linux-kernel, patches

This series adds basic microphone detection DT/ACPI bindings
using the device properties API.

The MFD parts and the extcon parts can go seperately through
there respective trees, but I sent them together so everyone
can see what is going on. There is no build dependency
although the MFD patch will fix a couple of Sparse warnings
that you get if using -Wsparse-all.

Changes since v1:
 - Removed double include of property.h

Changes since v2:
 - Removed check for CONFIG_OF to call
   arizona_extcon_device_get_pdata.
 - Add some defines for the pdata values of micd-dbtime.
 - Factor out the initial gpio level for the micd-pol-gpio.
 - Don't check if null before calling gpiod_set_value_cansleep.
 - Added a comment to explain why we can't use devm for gpiod.
 - Added patch to make some small corrections to the jack
   detection into this series to keep them all together for
   easy of applying.

Thanks,
Charles

Charles Keepax (7):
  extcon: arizona: Factor out initial GPIO state
  extcon: arizona: Update to use the new device properties API
  extcon: arizona: Add basic microphone detection DT/ACPI bindings
  extcon: arizona: Convert to gpiod
  extcon: arizona: Ensure variables are set for headphone detection
  mfd: arizona: Update DT doc for new mic detection bindings
  mfd: arizona: Update several pdata members to unsigned

 Documentation/devicetree/bindings/mfd/arizona.txt |   16 ++++
 drivers/extcon/extcon-arizona.c                   |   97 +++++++++++++++++----
 include/linux/mfd/arizona/pdata.h                 |   15 ++--
 3 files changed, 106 insertions(+), 22 deletions(-)

-- 
1.7.2.5


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v3 1/7] extcon: arizona: Factor out initial GPIO state
  2015-06-19 10:24 [PATCH v3 0/7] Add basic microphone detection bindings Charles Keepax
@ 2015-06-19 10:24 ` Charles Keepax
  2015-06-19 12:29   ` Chanwoo Choi
  2015-06-19 10:24 ` [PATCH v3 2/7] extcon: arizona: Update to use the new device properties API Charles Keepax
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 18+ messages in thread
From: Charles Keepax @ 2015-06-19 10:24 UTC (permalink / raw)
  To: cw00.choi; +Cc: myungjoo.ham, linux-kernel, patches

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
 drivers/extcon/extcon-arizona.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index 9262b45..e31613a 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -1135,6 +1135,7 @@ static int arizona_extcon_probe(struct platform_device *pdev)
 	struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
 	struct arizona_pdata *pdata = &arizona->pdata;
 	struct arizona_extcon_info *info;
+	int gpio_initial_level;
 	unsigned int val;
 	unsigned int clamp_mode;
 	int jack_irq_fall, jack_irq_rise;
@@ -1226,8 +1227,9 @@ static int arizona_extcon_probe(struct platform_device *pdev)
 		info->micd_num_modes = ARRAY_SIZE(micd_default_modes);
 	}
 
+	gpio_initial_level = info->micd_modes[0].gpio;
 	if (arizona->pdata.micd_pol_gpio > 0) {
-		if (info->micd_modes[0].gpio)
+		if (gpio_initial_level)
 			mode = GPIOF_OUT_INIT_HIGH;
 		else
 			mode = GPIOF_OUT_INIT_LOW;
-- 
1.7.2.5


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 2/7] extcon: arizona: Update to use the new device properties API
  2015-06-19 10:24 [PATCH v3 0/7] Add basic microphone detection bindings Charles Keepax
  2015-06-19 10:24 ` [PATCH v3 1/7] extcon: arizona: Factor out initial GPIO state Charles Keepax
@ 2015-06-19 10:24 ` Charles Keepax
  2015-06-19 10:24 ` [PATCH v3 3/7] extcon: arizona: Add basic microphone detection DT/ACPI bindings Charles Keepax
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 18+ messages in thread
From: Charles Keepax @ 2015-06-19 10:24 UTC (permalink / raw)
  To: cw00.choi; +Cc: myungjoo.ham, linux-kernel, patches

The device properties API will load data from both device tree and ACPI,
update the binding to use this API instead of the OF API.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
 drivers/extcon/extcon-arizona.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index e31613a..d990495 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -24,6 +24,7 @@
 #include <linux/input.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
+#include <linux/property.h>
 #include <linux/regulator/consumer.h>
 #include <linux/extcon.h>
 
@@ -1110,12 +1111,12 @@ static void arizona_micd_set_level(struct arizona *arizona, int index,
 	regmap_update_bits(arizona->regmap, reg, mask, level);
 }
 
-static int arizona_extcon_of_get_pdata(struct arizona *arizona)
+static int arizona_extcon_device_get_pdata(struct arizona *arizona)
 {
 	struct arizona_pdata *pdata = &arizona->pdata;
 	unsigned int val = ARIZONA_ACCDET_MODE_HPL;
 
-	of_property_read_u32(arizona->dev->of_node, "wlf,hpdet-channel", &val);
+	device_property_read_u32(arizona->dev, "wlf,hpdet-channel", &val);
 	switch (val) {
 	case ARIZONA_ACCDET_MODE_HPL:
 	case ARIZONA_ACCDET_MODE_HPR:
@@ -1148,10 +1149,8 @@ static int arizona_extcon_probe(struct platform_device *pdev)
 	if (!info)
 		return -ENOMEM;
 
-	if (IS_ENABLED(CONFIG_OF)) {
-		if (!dev_get_platdata(arizona->dev))
-			arizona_extcon_of_get_pdata(arizona);
-	}
+	if (!dev_get_platdata(arizona->dev))
+		arizona_extcon_device_get_pdata(arizona);
 
 	info->micvdd = devm_regulator_get(&pdev->dev, "MICVDD");
 	if (IS_ERR(info->micvdd)) {
-- 
1.7.2.5


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 3/7] extcon: arizona: Add basic microphone detection DT/ACPI bindings
  2015-06-19 10:24 [PATCH v3 0/7] Add basic microphone detection bindings Charles Keepax
  2015-06-19 10:24 ` [PATCH v3 1/7] extcon: arizona: Factor out initial GPIO state Charles Keepax
  2015-06-19 10:24 ` [PATCH v3 2/7] extcon: arizona: Update to use the new device properties API Charles Keepax
@ 2015-06-19 10:24 ` Charles Keepax
  2015-06-19 10:24 ` [PATCH v3 4/7] extcon: arizona: Convert to gpiod Charles Keepax
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 18+ messages in thread
From: Charles Keepax @ 2015-06-19 10:24 UTC (permalink / raw)
  To: cw00.choi; +Cc: myungjoo.ham, linux-kernel, patches

This patch adds bindings for the basic microphone detection platform
data.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
 drivers/extcon/extcon-arizona.c   |   30 ++++++++++++++++++++++++++++++
 include/linux/mfd/arizona/pdata.h |    3 +++
 2 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index d990495..6826d99 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -1115,6 +1115,7 @@ static int arizona_extcon_device_get_pdata(struct arizona *arizona)
 {
 	struct arizona_pdata *pdata = &arizona->pdata;
 	unsigned int val = ARIZONA_ACCDET_MODE_HPL;
+	unsigned int num_debounces;
 
 	device_property_read_u32(arizona->dev, "wlf,hpdet-channel", &val);
 	switch (val) {
@@ -1128,6 +1129,35 @@ static int arizona_extcon_device_get_pdata(struct arizona *arizona)
 		pdata->hpdet_channel = ARIZONA_ACCDET_MODE_HPL;
 	}
 
+	device_property_read_u32(arizona->dev, "wlf,micd-detect-debounce",
+				 &pdata->micd_detect_debounce);
+
+	device_property_read_u32(arizona->dev, "wlf,micd-bias-start-time",
+				 &pdata->micd_bias_start_time);
+
+	device_property_read_u32(arizona->dev, "wlf,micd-rate",
+				 &pdata->micd_rate);
+
+	num_debounces = 0;
+	device_property_read_u32(arizona->dev, "wlf,micd-dbtime",
+				 &num_debounces);
+	switch (num_debounces) {
+	case 2:
+		pdata->micd_dbtime = ARIZONA_MICD_DBTIME_TWO_DEBOUNCES;
+		break;
+	case 4:
+		pdata->micd_dbtime = ARIZONA_MICD_DBTIME_FOUR_DEBOUNCES;
+		break;
+	default:
+		break;
+	}
+
+	device_property_read_u32(arizona->dev, "wlf,micd-timeout",
+				 &pdata->micd_timeout);
+
+	pdata->micd_force_micbias = device_property_read_bool(arizona->dev,
+						"wlf,micd-force-micbias");
+
 	return 0;
 }
 
diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h
index aa5c48b..af44081 100644
--- a/include/linux/mfd/arizona/pdata.h
+++ b/include/linux/mfd/arizona/pdata.h
@@ -53,6 +53,9 @@
 
 #define ARIZONA_MAX_PDM_SPK 2
 
+#define ARIZONA_MICD_DBTIME_TWO_DEBOUNCES 0x10000
+#define ARIZONA_MICD_DBTIME_FOUR_DEBOUNCES 0x0001
+
 struct regulator_init_data;
 
 struct arizona_micbias {
-- 
1.7.2.5


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 4/7] extcon: arizona: Convert to gpiod
  2015-06-19 10:24 [PATCH v3 0/7] Add basic microphone detection bindings Charles Keepax
                   ` (2 preceding siblings ...)
  2015-06-19 10:24 ` [PATCH v3 3/7] extcon: arizona: Add basic microphone detection DT/ACPI bindings Charles Keepax
@ 2015-06-19 10:24 ` Charles Keepax
  2015-06-19 10:24 ` [PATCH v3 5/7] extcon: arizona: Ensure variables are set for headphone detection Charles Keepax
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 18+ messages in thread
From: Charles Keepax @ 2015-06-19 10:24 UTC (permalink / raw)
  To: cw00.choi; +Cc: myungjoo.ham, linux-kernel, patches

Convert to using the newer gpiod interface for the micd_pol_gpio.
Although we still carry support for the old gpio interface from pdata.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
 drivers/extcon/extcon-arizona.c |   41 ++++++++++++++++++++++++++++++++++----
 1 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index 6826d99..eb8cf74 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -20,6 +20,7 @@
 #include <linux/slab.h>
 #include <linux/interrupt.h>
 #include <linux/err.h>
+#include <linux/gpio/consumer.h>
 #include <linux/gpio.h>
 #include <linux/input.h>
 #include <linux/platform_device.h>
@@ -95,6 +96,8 @@ struct arizona_extcon_info {
 	int hpdet_ip_version;
 
 	struct extcon_dev *edev;
+
+	struct gpio_desc *micd_pol_gpio;
 };
 
 static const struct arizona_micd_config micd_default_modes[] = {
@@ -205,6 +208,10 @@ static void arizona_extcon_set_mode(struct arizona_extcon_info *info, int mode)
 	if (arizona->pdata.micd_pol_gpio > 0)
 		gpio_set_value_cansleep(arizona->pdata.micd_pol_gpio,
 					info->micd_modes[mode].gpio);
+	else
+		gpiod_set_value_cansleep(info->micd_pol_gpio,
+					 info->micd_modes[mode].gpio);
+
 	regmap_update_bits(arizona->regmap, ARIZONA_MIC_DETECT_1,
 			   ARIZONA_MICD_BIAS_SRC_MASK,
 			   info->micd_modes[mode].bias <<
@@ -1272,6 +1279,27 @@ static int arizona_extcon_probe(struct platform_device *pdev)
 				arizona->pdata.micd_pol_gpio, ret);
 			goto err_register;
 		}
+	} else {
+		if (gpio_initial_level)
+			mode = GPIOD_OUT_HIGH;
+		else
+			mode = GPIOD_OUT_LOW;
+
+		/* We can't use devm here because we need to do the get
+		 * against the MFD device, as that is where the of_node
+		 * will reside, but if we devm against that the GPIO
+		 * will not be freed if the extcon driver is unloaded.
+		 */
+		info->micd_pol_gpio = gpiod_get_optional(arizona->dev,
+							 "wlf,micd-pol",
+							 GPIOD_OUT_LOW);
+		if (IS_ERR(info->micd_pol_gpio)) {
+			ret = PTR_ERR(info->micd_pol_gpio);
+			dev_err(arizona->dev,
+				"Failed to get microphone polarity GPIO: %d\n",
+				ret);
+			goto err_register;
+		}
 	}
 
 	if (arizona->pdata.hpdet_id_gpio > 0) {
@@ -1282,7 +1310,7 @@ static int arizona_extcon_probe(struct platform_device *pdev)
 		if (ret != 0) {
 			dev_err(arizona->dev, "Failed to request GPIO%d: %d\n",
 				arizona->pdata.hpdet_id_gpio, ret);
-			goto err_register;
+			goto err_gpio;
 		}
 	}
 
@@ -1326,7 +1354,7 @@ static int arizona_extcon_probe(struct platform_device *pdev)
 				dev_err(arizona->dev,
 					"MICD ranges must be sorted\n");
 				ret = -EINVAL;
-				goto err_input;
+				goto err_gpio;
 			}
 		}
 	}
@@ -1345,7 +1373,7 @@ static int arizona_extcon_probe(struct platform_device *pdev)
 			dev_err(arizona->dev, "Unsupported MICD level %d\n",
 				info->micd_ranges[i].max);
 			ret = -EINVAL;
-			goto err_input;
+			goto err_gpio;
 		}
 
 		dev_dbg(arizona->dev, "%d ohms for MICD threshold %d\n",
@@ -1418,7 +1446,7 @@ static int arizona_extcon_probe(struct platform_device *pdev)
 	if (ret != 0) {
 		dev_err(&pdev->dev, "Failed to get JACKDET rise IRQ: %d\n",
 			ret);
-		goto err_input;
+		goto err_gpio;
 	}
 
 	ret = arizona_set_irq_wake(arizona, jack_irq_rise, 1);
@@ -1489,7 +1517,8 @@ err_rise_wake:
 	arizona_set_irq_wake(arizona, jack_irq_rise, 0);
 err_rise:
 	arizona_free_irq(arizona, jack_irq_rise, info);
-err_input:
+err_gpio:
+	gpiod_put(info->micd_pol_gpio);
 err_register:
 	pm_runtime_disable(&pdev->dev);
 	return ret;
@@ -1501,6 +1530,8 @@ static int arizona_extcon_remove(struct platform_device *pdev)
 	struct arizona *arizona = info->arizona;
 	int jack_irq_rise, jack_irq_fall;
 
+	gpiod_put(info->micd_pol_gpio);
+
 	pm_runtime_disable(&pdev->dev);
 
 	regmap_update_bits(arizona->regmap,
-- 
1.7.2.5


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 5/7] extcon: arizona: Ensure variables are set for headphone detection
  2015-06-19 10:24 [PATCH v3 0/7] Add basic microphone detection bindings Charles Keepax
                   ` (3 preceding siblings ...)
  2015-06-19 10:24 ` [PATCH v3 4/7] extcon: arizona: Convert to gpiod Charles Keepax
@ 2015-06-19 10:24 ` Charles Keepax
  2015-06-19 10:24 ` [PATCH v3 6/7] mfd: arizona: Update DT doc for new mic detection bindings Charles Keepax
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 18+ messages in thread
From: Charles Keepax @ 2015-06-19 10:24 UTC (permalink / raw)
  To: cw00.choi; +Cc: myungjoo.ham, linux-kernel, patches

The detecting flag really refers to the microphone detection stage and
as such should be cleared before arizona_identify_headphones is called.
Also the mic flag should be set before identify headphones is called as
well.

Otherwise the microphone detection will not be disabled during the
headphone detection and we can get false button reports caused by the
clamping that is part of the headphone detection.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
 drivers/extcon/extcon-arizona.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index eb8cf74..8a87ecd 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -765,10 +765,11 @@ static void arizona_micd_timeout_work(struct work_struct *work)
 	mutex_lock(&info->lock);
 
 	dev_dbg(info->arizona->dev, "MICD timed out, reporting HP\n");
-	arizona_identify_headphone(info);
 
 	info->detecting = false;
 
+	arizona_identify_headphone(info);
+
 	arizona_stop_mic(info);
 
 	mutex_unlock(&info->lock);
@@ -834,6 +835,9 @@ 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 & ARIZONA_MICD_LVL_8)) {
+		info->mic = true;
+		info->detecting = false;
+
 		arizona_identify_headphone(info);
 
 		ret = extcon_set_cable_state_(info->edev,
@@ -849,8 +853,6 @@ static void arizona_micd_detect(struct work_struct *work)
 				ret);
 		}
 
-		info->mic = true;
-		info->detecting = false;
 		goto handled;
 	}
 
@@ -863,10 +865,11 @@ static void arizona_micd_detect(struct work_struct *work)
 	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);
 
 			info->detecting = false;
 
+			arizona_identify_headphone(info);
+
 			arizona_stop_mic(info);
 		} else {
 			info->micd_mode++;
-- 
1.7.2.5


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 6/7] mfd: arizona: Update DT doc for new mic detection bindings
  2015-06-19 10:24 [PATCH v3 0/7] Add basic microphone detection bindings Charles Keepax
                   ` (4 preceding siblings ...)
  2015-06-19 10:24 ` [PATCH v3 5/7] extcon: arizona: Ensure variables are set for headphone detection Charles Keepax
@ 2015-06-19 10:24 ` Charles Keepax
  2015-06-24 14:15   ` Lee Jones
  2015-06-19 10:24 ` [PATCH v3 7/7] mfd: arizona: Update several pdata members to unsigned Charles Keepax
  2015-06-19 10:46 ` [PATCH v3 0/7] Add basic microphone detection bindings Charles Keepax
  7 siblings, 1 reply; 18+ messages in thread
From: Charles Keepax @ 2015-06-19 10:24 UTC (permalink / raw)
  To: cw00.choi; +Cc: myungjoo.ham, linux-kernel, patches

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
 Documentation/devicetree/bindings/mfd/arizona.txt |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt b/Documentation/devicetree/bindings/mfd/arizona.txt
index 32a71b7..8d92c92 100644
--- a/Documentation/devicetree/bindings/mfd/arizona.txt
+++ b/Documentation/devicetree/bindings/mfd/arizona.txt
@@ -68,6 +68,22 @@ Optional properties:
     If this node is not mentioned or if the value is unknown, then
     headphone detection mode is set to HPDETL.
 
+  - 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.
+
   - 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
-- 
1.7.2.5


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 7/7] mfd: arizona: Update several pdata members to unsigned
  2015-06-19 10:24 [PATCH v3 0/7] Add basic microphone detection bindings Charles Keepax
                   ` (5 preceding siblings ...)
  2015-06-19 10:24 ` [PATCH v3 6/7] mfd: arizona: Update DT doc for new mic detection bindings Charles Keepax
@ 2015-06-19 10:24 ` Charles Keepax
  2015-06-24 14:16   ` Lee Jones
  2015-06-19 10:46 ` [PATCH v3 0/7] Add basic microphone detection bindings Charles Keepax
  7 siblings, 1 reply; 18+ messages in thread
From: Charles Keepax @ 2015-06-19 10:24 UTC (permalink / raw)
  To: cw00.choi; +Cc: myungjoo.ham, linux-kernel, patches

Device tree and ACPI primarily deal with unsigned ints, many of the
pdata members in the Arizona driver are signed ints but are only ever
assigned positive values. Changing these pdata fields to unsigned ints
avoids us having to choose between overly verbose code and Sparse
warnings.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
 include/linux/mfd/arizona/pdata.h |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h
index af44081..f2c8381 100644
--- a/include/linux/mfd/arizona/pdata.h
+++ b/include/linux/mfd/arizona/pdata.h
@@ -104,7 +104,7 @@ struct arizona_pdata {
 	 * useful for systems where and I2S bus with multiple data
 	 * lines is mastered.
 	 */
-	int max_channels_clocked[ARIZONA_MAX_AIF];
+	unsigned int max_channels_clocked[ARIZONA_MAX_AIF];
 
 	/** GPIO5 is used for jack detection */
 	bool jd_gpio5;
@@ -128,22 +128,22 @@ struct arizona_pdata {
 	unsigned int hpdet_channel;
 
 	/** Extra debounce timeout used during initial mic detection (ms) */
-	int micd_detect_debounce;
+	unsigned int micd_detect_debounce;
 
 	/** GPIO for mic detection polarity */
 	int micd_pol_gpio;
 
 	/** Mic detect ramp rate */
-	int micd_bias_start_time;
+	unsigned int micd_bias_start_time;
 
 	/** Mic detect sample rate */
-	int micd_rate;
+	unsigned int micd_rate;
 
 	/** Mic detect debounce level */
-	int micd_dbtime;
+	unsigned int micd_dbtime;
 
 	/** Mic detect timeout (ms) */
-	int micd_timeout;
+	unsigned int micd_timeout;
 
 	/** Force MICBIAS on for mic detect */
 	bool micd_force_micbias;
-- 
1.7.2.5


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 0/7] Add basic microphone detection bindings
@ 2015-06-19 10:33 ` Charles Keepax
  0 siblings, 0 replies; 18+ messages in thread
From: Charles Keepax @ 2015-06-19 10:33 UTC (permalink / raw)
  To: lee.jones, cw00.choi
  Cc: myungjoo.ham, sameo, devicetree, linux-kernel, patches

This series adds basic microphone detection DT/ACPI bindings
using the device properties API.

The MFD parts and the extcon parts can go seperately through
there respective trees, but I sent them together so everyone
can see what is going on. There is no build dependency
although the MFD patch will fix a couple of Sparse warnings
that you get if using -Wsparse-all.

Changes since v1:
 - Removed double include of property.h

Changes since v2:
 - Removed check for CONFIG_OF to call
   arizona_extcon_device_get_pdata.
 - Add some defines for the pdata values of micd-dbtime.
 - Factor out the initial gpio level for the micd-pol-gpio.
 - Don't check if null before calling gpiod_set_value_cansleep.
 - Added a comment to explain why we can't use devm for gpiod.
 - Added patch to make some small corrections to the jack
   detection into this series to keep them all together for
   easy of applying.

Thanks,
Charles

Charles Keepax (7):
  extcon: arizona: Factor out initial GPIO state
  extcon: arizona: Update to use the new device properties API
  extcon: arizona: Add basic microphone detection DT/ACPI bindings
  extcon: arizona: Convert to gpiod
  extcon: arizona: Ensure variables are set for headphone detection
  mfd: arizona: Update DT doc for new mic detection bindings
  mfd: arizona: Update several pdata members to unsigned

 Documentation/devicetree/bindings/mfd/arizona.txt |   16 ++++
 drivers/extcon/extcon-arizona.c                   |   97 +++++++++++++++++----
 include/linux/mfd/arizona/pdata.h                 |   15 ++--
 3 files changed, 106 insertions(+), 22 deletions(-)

-- 
1.7.2.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v3 0/7] Add basic microphone detection bindings
@ 2015-06-19 10:33 ` Charles Keepax
  0 siblings, 0 replies; 18+ messages in thread
From: Charles Keepax @ 2015-06-19 10:33 UTC (permalink / raw)
  To: lee.jones, cw00.choi
  Cc: myungjoo.ham, sameo, devicetree, linux-kernel, patches

This series adds basic microphone detection DT/ACPI bindings
using the device properties API.

The MFD parts and the extcon parts can go seperately through
there respective trees, but I sent them together so everyone
can see what is going on. There is no build dependency
although the MFD patch will fix a couple of Sparse warnings
that you get if using -Wsparse-all.

Changes since v1:
 - Removed double include of property.h

Changes since v2:
 - Removed check for CONFIG_OF to call
   arizona_extcon_device_get_pdata.
 - Add some defines for the pdata values of micd-dbtime.
 - Factor out the initial gpio level for the micd-pol-gpio.
 - Don't check if null before calling gpiod_set_value_cansleep.
 - Added a comment to explain why we can't use devm for gpiod.
 - Added patch to make some small corrections to the jack
   detection into this series to keep them all together for
   easy of applying.

Thanks,
Charles

Charles Keepax (7):
  extcon: arizona: Factor out initial GPIO state
  extcon: arizona: Update to use the new device properties API
  extcon: arizona: Add basic microphone detection DT/ACPI bindings
  extcon: arizona: Convert to gpiod
  extcon: arizona: Ensure variables are set for headphone detection
  mfd: arizona: Update DT doc for new mic detection bindings
  mfd: arizona: Update several pdata members to unsigned

 Documentation/devicetree/bindings/mfd/arizona.txt |   16 ++++
 drivers/extcon/extcon-arizona.c                   |   97 +++++++++++++++++----
 include/linux/mfd/arizona/pdata.h                 |   15 ++--
 3 files changed, 106 insertions(+), 22 deletions(-)

-- 
1.7.2.5

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 0/7] Add basic microphone detection bindings
  2015-06-19 10:24 [PATCH v3 0/7] Add basic microphone detection bindings Charles Keepax
                   ` (6 preceding siblings ...)
  2015-06-19 10:24 ` [PATCH v3 7/7] mfd: arizona: Update several pdata members to unsigned Charles Keepax
@ 2015-06-19 10:46 ` Charles Keepax
  7 siblings, 0 replies; 18+ messages in thread
From: Charles Keepax @ 2015-06-19 10:46 UTC (permalink / raw)
  To: cw00.choi; +Cc: myungjoo.ham, linux-kernel, patches

On Fri, Jun 19, 2015 at 11:24:20AM +0100, Charles Keepax wrote:
> This series adds basic microphone detection DT/ACPI bindings
> using the device properties API.
> 
> The MFD parts and the extcon parts can go seperately through
> there respective trees, but I sent them together so everyone
> can see what is going on. There is no build dependency
> although the MFD patch will fix a couple of Sparse warnings
> that you get if using -Wsparse-all.
> 
> Changes since v1:
>  - Removed double include of property.h
> 
> Changes since v2:
>  - Removed check for CONFIG_OF to call
>    arizona_extcon_device_get_pdata.
>  - Add some defines for the pdata values of micd-dbtime.
>  - Factor out the initial gpio level for the micd-pol-gpio.
>  - Don't check if null before calling gpiod_set_value_cansleep.
>  - Added a comment to explain why we can't use devm for gpiod.
>  - Added patch to make some small corrections to the jack
>    detection into this series to keep them all together for
>    easy of applying.
> 
> Thanks,
> Charles

Ah sorry I totally forgot to CC the MFD guys on this going to
resend.

Thanks,
Charles
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 1/7] extcon: arizona: Factor out initial GPIO state
  2015-06-19 10:24 ` [PATCH v3 1/7] extcon: arizona: Factor out initial GPIO state Charles Keepax
@ 2015-06-19 12:29   ` Chanwoo Choi
  2015-06-19 12:54     ` Charles Keepax
  0 siblings, 1 reply; 18+ messages in thread
From: Chanwoo Choi @ 2015-06-19 12:29 UTC (permalink / raw)
  To: Charles Keepax; +Cc: myungjoo.ham@samsung.com, linux-kernel, patches

Hi Charles,

I'm sorry about lack of my commet on previous patch.
I just want to know the what is meaning of zero(0) index of
"info->micd_modes[0] array"
instead of separate variable (gpio_initial_level).

So, I'd like you to drop this patch on next your patch-set.

Thanks,
Chanwoo Choi

On Fri, Jun 19, 2015 at 7:24 PM, Charles Keepax
<ckeepax@opensource.wolfsonmicro.com> wrote:
> Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
> ---
>  drivers/extcon/extcon-arizona.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
> index 9262b45..e31613a 100644
> --- a/drivers/extcon/extcon-arizona.c
> +++ b/drivers/extcon/extcon-arizona.c
> @@ -1135,6 +1135,7 @@ static int arizona_extcon_probe(struct platform_device *pdev)
>         struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
>         struct arizona_pdata *pdata = &arizona->pdata;
>         struct arizona_extcon_info *info;
> +       int gpio_initial_level;
>         unsigned int val;
>         unsigned int clamp_mode;
>         int jack_irq_fall, jack_irq_rise;
> @@ -1226,8 +1227,9 @@ static int arizona_extcon_probe(struct platform_device *pdev)
>                 info->micd_num_modes = ARRAY_SIZE(micd_default_modes);
>         }
>
> +       gpio_initial_level = info->micd_modes[0].gpio;
>         if (arizona->pdata.micd_pol_gpio > 0) {
> -               if (info->micd_modes[0].gpio)
> +               if (gpio_initial_level)
>                         mode = GPIOF_OUT_INIT_HIGH;
>                 else
>                         mode = GPIOF_OUT_INIT_LOW;
> --
> 1.7.2.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 1/7] extcon: arizona: Factor out initial GPIO state
  2015-06-19 12:29   ` Chanwoo Choi
@ 2015-06-19 12:54     ` Charles Keepax
  0 siblings, 0 replies; 18+ messages in thread
From: Charles Keepax @ 2015-06-19 12:54 UTC (permalink / raw)
  To: cw00.choi; +Cc: myungjoo.ham@samsung.com, linux-kernel, patches

On Fri, Jun 19, 2015 at 09:29:34PM +0900, Chanwoo Choi wrote:
> Hi Charles,
> 
> I'm sorry about lack of my commet on previous patch.
> I just want to know the what is meaning of zero(0) index of
> "info->micd_modes[0] array"
> instead of separate variable (gpio_initial_level).
> 
> So, I'd like you to drop this patch on next your patch-set.
> 
> Thanks,
> Chanwoo Choi
> 

:-) And I just spotted this after sending the next version. I
will send another version.

Thanks,
Charles
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 6/7] mfd: arizona: Update DT doc for new mic detection bindings
  2015-06-19 10:24 ` [PATCH v3 6/7] mfd: arizona: Update DT doc for new mic detection bindings Charles Keepax
@ 2015-06-24 14:15   ` Lee Jones
  2015-06-24 15:41     ` Charles Keepax
  0 siblings, 1 reply; 18+ messages in thread
From: Lee Jones @ 2015-06-24 14:15 UTC (permalink / raw)
  To: Charles Keepax; +Cc: cw00.choi, myungjoo.ham, linux-kernel, patches, devicetree

This requires a DT Ack.

[... which would be pretty difficult, as you didn't Cc them]

> Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
> ---
>  Documentation/devicetree/bindings/mfd/arizona.txt |   16 ++++++++++++++++
>  1 files changed, 16 insertions(+), 0 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt b/Documentation/devicetree/bindings/mfd/arizona.txt
> index 32a71b7..8d92c92 100644
> --- a/Documentation/devicetree/bindings/mfd/arizona.txt
> +++ b/Documentation/devicetree/bindings/mfd/arizona.txt
> @@ -68,6 +68,22 @@ Optional properties:
>      If this node is not mentioned or if the value is unknown, then
>      headphone detection mode is set to HPDETL.
>  
> +  - 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.
> +
>    - 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

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 7/7] mfd: arizona: Update several pdata members to unsigned
  2015-06-19 10:24 ` [PATCH v3 7/7] mfd: arizona: Update several pdata members to unsigned Charles Keepax
@ 2015-06-24 14:16   ` Lee Jones
  0 siblings, 0 replies; 18+ messages in thread
From: Lee Jones @ 2015-06-24 14:16 UTC (permalink / raw)
  To: Charles Keepax; +Cc: cw00.choi, myungjoo.ham, linux-kernel, patches

On Fri, 19 Jun 2015, Charles Keepax wrote:

> Device tree and ACPI primarily deal with unsigned ints, many of the
> pdata members in the Arizona driver are signed ints but are only ever
> assigned positive values. Changing these pdata fields to unsigned ints
> avoids us having to choose between overly verbose code and Sparse
> warnings.
> 
> Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
> ---
>  include/linux/mfd/arizona/pdata.h |   12 ++++++------
>  1 files changed, 6 insertions(+), 6 deletions(-)

Applied for v4.3, thanks.

> diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h
> index af44081..f2c8381 100644
> --- a/include/linux/mfd/arizona/pdata.h
> +++ b/include/linux/mfd/arizona/pdata.h
> @@ -104,7 +104,7 @@ struct arizona_pdata {
>  	 * useful for systems where and I2S bus with multiple data
>  	 * lines is mastered.
>  	 */
> -	int max_channels_clocked[ARIZONA_MAX_AIF];
> +	unsigned int max_channels_clocked[ARIZONA_MAX_AIF];
>  
>  	/** GPIO5 is used for jack detection */
>  	bool jd_gpio5;
> @@ -128,22 +128,22 @@ struct arizona_pdata {
>  	unsigned int hpdet_channel;
>  
>  	/** Extra debounce timeout used during initial mic detection (ms) */
> -	int micd_detect_debounce;
> +	unsigned int micd_detect_debounce;
>  
>  	/** GPIO for mic detection polarity */
>  	int micd_pol_gpio;
>  
>  	/** Mic detect ramp rate */
> -	int micd_bias_start_time;
> +	unsigned int micd_bias_start_time;
>  
>  	/** Mic detect sample rate */
> -	int micd_rate;
> +	unsigned int micd_rate;
>  
>  	/** Mic detect debounce level */
> -	int micd_dbtime;
> +	unsigned int micd_dbtime;
>  
>  	/** Mic detect timeout (ms) */
> -	int micd_timeout;
> +	unsigned int micd_timeout;
>  
>  	/** Force MICBIAS on for mic detect */
>  	bool micd_force_micbias;

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 6/7] mfd: arizona: Update DT doc for new mic detection bindings
  2015-06-24 14:15   ` Lee Jones
@ 2015-06-24 15:41     ` Charles Keepax
  2015-06-25  8:53         ` Lee Jones
  0 siblings, 1 reply; 18+ messages in thread
From: Charles Keepax @ 2015-06-24 15:41 UTC (permalink / raw)
  To: Lee Jones; +Cc: cw00.choi, myungjoo.ham, linux-kernel, patches, devicetree

On Wed, Jun 24, 2015 at 03:15:34PM +0100, Lee Jones wrote:
> This requires a DT Ack.
> 
> [... which would be pretty difficult, as you didn't Cc them]
> 

I was under the impression that for fairly non-controversial
bindings (which I really feel these are) that CCing the DT
mailing list was considered sufficient. But I am more than happy
to resend with more people on the CC if you prefer.

Thanks,
Charles


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 6/7] mfd: arizona: Update DT doc for new mic detection bindings
@ 2015-06-25  8:53         ` Lee Jones
  0 siblings, 0 replies; 18+ messages in thread
From: Lee Jones @ 2015-06-25  8:53 UTC (permalink / raw)
  To: Charles Keepax; +Cc: cw00.choi, myungjoo.ham, linux-kernel, patches, devicetree

On Wed, 24 Jun 2015, Charles Keepax wrote:

> On Wed, Jun 24, 2015 at 03:15:34PM +0100, Lee Jones wrote:
> > This requires a DT Ack.
> > 
> > [... which would be pretty difficult, as you didn't Cc them]
> > 
> 
> I was under the impression that for fairly non-controversial
> bindings (which I really feel these are) that CCing the DT
> mailing list was considered sufficient. But I am more than happy
> to resend with more people on the CC if you prefer.

I never Cc the Maintainers personally, as there are a lot of them.
AFAIU Cc'ing the list is fine.

However ... you didn't do that either.

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 6/7] mfd: arizona: Update DT doc for new mic detection bindings
@ 2015-06-25  8:53         ` Lee Jones
  0 siblings, 0 replies; 18+ messages in thread
From: Lee Jones @ 2015-06-25  8:53 UTC (permalink / raw)
  To: Charles Keepax
  Cc: cw00.choi-Sze3O3UU22JBDgjK7y7TUQ,
	myungjoo.ham-Sze3O3UU22JBDgjK7y7TUQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	patches-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E,
	devicetree-u79uwXL29TY76Z2rM5mHXA

On Wed, 24 Jun 2015, Charles Keepax wrote:

> On Wed, Jun 24, 2015 at 03:15:34PM +0100, Lee Jones wrote:
> > This requires a DT Ack.
> > 
> > [... which would be pretty difficult, as you didn't Cc them]
> > 
> 
> I was under the impression that for fairly non-controversial
> bindings (which I really feel these are) that CCing the DT
> mailing list was considered sufficient. But I am more than happy
> to resend with more people on the CC if you prefer.

I never Cc the Maintainers personally, as there are a lot of them.
AFAIU Cc'ing the list is fine.

However ... you didn't do that either.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2015-06-25  8:53 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-19 10:24 [PATCH v3 0/7] Add basic microphone detection bindings Charles Keepax
2015-06-19 10:24 ` [PATCH v3 1/7] extcon: arizona: Factor out initial GPIO state Charles Keepax
2015-06-19 12:29   ` Chanwoo Choi
2015-06-19 12:54     ` Charles Keepax
2015-06-19 10:24 ` [PATCH v3 2/7] extcon: arizona: Update to use the new device properties API Charles Keepax
2015-06-19 10:24 ` [PATCH v3 3/7] extcon: arizona: Add basic microphone detection DT/ACPI bindings Charles Keepax
2015-06-19 10:24 ` [PATCH v3 4/7] extcon: arizona: Convert to gpiod Charles Keepax
2015-06-19 10:24 ` [PATCH v3 5/7] extcon: arizona: Ensure variables are set for headphone detection Charles Keepax
2015-06-19 10:24 ` [PATCH v3 6/7] mfd: arizona: Update DT doc for new mic detection bindings Charles Keepax
2015-06-24 14:15   ` Lee Jones
2015-06-24 15:41     ` Charles Keepax
2015-06-25  8:53       ` Lee Jones
2015-06-25  8:53         ` Lee Jones
2015-06-19 10:24 ` [PATCH v3 7/7] mfd: arizona: Update several pdata members to unsigned Charles Keepax
2015-06-24 14:16   ` Lee Jones
2015-06-19 10:46 ` [PATCH v3 0/7] Add basic microphone detection bindings Charles Keepax
  -- strict thread matches above, loose matches on Subject: below --
2015-06-19 10:33 Charles Keepax
2015-06-19 10:33 ` Charles Keepax

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.