Re: [PATCH 3/4] mfd: arizona: Switch to using clock driver for 32k clock

2016-01-06 Thread Charles Keepax
On Wed, Jan 06, 2016 at 12:19:56AM +0800, kbuild test robot wrote:
> Hi Charles,
> 
> [auto build test WARNING on clk/clk-next]
> [also build test WARNING on v4.4-rc8 next-20160105]
> [if your patch is applied to the wrong git tree, please drop us a note to 
> help improving the system]
> 
> url:
> https://github.com/0day-ci/linux/commits/Charles-Keepax/extcon-arizona-Remove-enable-disable-of-32k-clock/20160105-234658
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next
> config: x86_64-randconfig-x013-01041832 (attached as .config)
> reproduce:
> # save the attached .config to linux build tree
> make ARCH=x86_64 
> 
> All warnings (new ones prefixed by >>):
> 
> warning: (MFD_ARIZONA) selects COMMON_CLK_ARIZONA which has unmet direct 
> dependencies (COMMON_CLK && MFD_ARIZONA)

Apologies this is caused by the select I put in the MFD Kconfig,
since it doesn't really make much sense to build the MFD without
the clock driver.

But I think probably the simplest solution is just to drop that,
otherwise we start kicking off all sorts of exciting circular
dependencies that Kconfig doesn't like. Its not necessarily a
sensible config to use but at least it will all build fine.

I will send a version 2 with the other small comment fixed up
as well.

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


[PATCH v2 1/4] extcon: arizona: Remove enable/disable of 32k clock

2016-01-06 Thread Charles Keepax
The 32k clock is unconditionally enabled by the MFD core so there is no
need to control it from the extcon device, so this patch removes the
control of the 32k clock.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
---

No changes since v1.

Thanks,
Charles

 drivers/extcon/extcon-arizona.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index e4890dd..52d041f 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -1571,7 +1571,6 @@ static int arizona_extcon_probe(struct platform_device 
*pdev)
goto err_micdet;
}
 
-   arizona_clk32k_enable(arizona);
regmap_update_bits(arizona->regmap, ARIZONA_JACK_DETECT_DEBOUNCE,
   ARIZONA_JD1_DB, ARIZONA_JD1_DB);
regmap_update_bits(arizona->regmap, ARIZONA_JACK_DETECT_ANALOGUE,
@@ -1642,7 +1641,6 @@ static int arizona_extcon_remove(struct platform_device 
*pdev)
cancel_delayed_work_sync(>hpdet_work);
regmap_update_bits(arizona->regmap, ARIZONA_JACK_DETECT_ANALOGUE,
   ARIZONA_JD1_ENA, 0);
-   arizona_clk32k_disable(arizona);
 
return 0;
 }
-- 
2.1.4

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


[PATCH v2 3/4] mfd: arizona: Switch to using clock driver for 32k clock

2016-01-06 Thread Charles Keepax
Now we have a clock driver that can control the 32k clock use this
rather than directly controlling the 32k clock from the MFD device.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
---

Changes since v1:
 - No long select COMMON_CLK_ARIZONA from the MFD, this can lead
   to a situation where we are building COMMON_CLK_ARIZONA but
   not COMMON_CLK which leads to many build errors. Furthermore
   most other routes to resolve the issue result in a circular
   dependency. Simplest solution is just to not do the select.

Thanks,
Charles

 drivers/mfd/arizona-core.c   | 104 +--
 include/linux/mfd/arizona/core.h |   7 +--
 2 files changed, 25 insertions(+), 86 deletions(-)

diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c
index d474732..5a55dd6 100644
--- a/drivers/mfd/arizona-core.c
+++ b/drivers/mfd/arizona-core.c
@@ -36,63 +36,6 @@ static const char * const wm5102_core_supplies[] = {
"DBVDD1",
 };
 
-int arizona_clk32k_enable(struct arizona *arizona)
-{
-   int ret = 0;
-
-   mutex_lock(>clk_lock);
-
-   arizona->clk32k_ref++;
-
-   if (arizona->clk32k_ref == 1) {
-   switch (arizona->pdata.clk32k_src) {
-   case ARIZONA_32KZ_MCLK1:
-   ret = pm_runtime_get_sync(arizona->dev);
-   if (ret != 0)
-   goto out;
-   break;
-   }
-
-   ret = regmap_update_bits(arizona->regmap, ARIZONA_CLOCK_32K_1,
-ARIZONA_CLK_32K_ENA,
-ARIZONA_CLK_32K_ENA);
-   }
-
-out:
-   if (ret != 0)
-   arizona->clk32k_ref--;
-
-   mutex_unlock(>clk_lock);
-
-   return ret;
-}
-EXPORT_SYMBOL_GPL(arizona_clk32k_enable);
-
-int arizona_clk32k_disable(struct arizona *arizona)
-{
-   mutex_lock(>clk_lock);
-
-   BUG_ON(arizona->clk32k_ref <= 0);
-
-   arizona->clk32k_ref--;
-
-   if (arizona->clk32k_ref == 0) {
-   regmap_update_bits(arizona->regmap, ARIZONA_CLOCK_32K_1,
-  ARIZONA_CLK_32K_ENA, 0);
-
-   switch (arizona->pdata.clk32k_src) {
-   case ARIZONA_32KZ_MCLK1:
-   pm_runtime_put_sync(arizona->dev);
-   break;
-   }
-   }
-
-   mutex_unlock(>clk_lock);
-
-   return 0;
-}
-EXPORT_SYMBOL_GPL(arizona_clk32k_disable);
-
 static irqreturn_t arizona_clkgen_err(int irq, void *data)
 {
struct arizona *arizona = data;
@@ -874,6 +817,7 @@ static inline int arizona_of_get_core_pdata(struct arizona 
*arizona)
 
 static const struct mfd_cell early_devs[] = {
{ .name = "arizona-ldo1" },
+   { .name = "arizona-clk" },
 };
 
 static const char * const wm5102_supplies[] = {
@@ -970,7 +914,6 @@ int arizona_dev_init(struct arizona *arizona)
int n_subdevs, ret, i;
 
dev_set_drvdata(arizona->dev, arizona);
-   mutex_init(>clk_lock);
 
if (dev_get_platdata(arizona->dev))
memcpy(>pdata, dev_get_platdata(arizona->dev),
@@ -1261,28 +1204,6 @@ int arizona_dev_init(struct arizona *arizona)
}
 
/* Chip default */
-   if (!arizona->pdata.clk32k_src)
-   arizona->pdata.clk32k_src = ARIZONA_32KZ_MCLK2;
-
-   switch (arizona->pdata.clk32k_src) {
-   case ARIZONA_32KZ_MCLK1:
-   case ARIZONA_32KZ_MCLK2:
-   regmap_update_bits(arizona->regmap, ARIZONA_CLOCK_32K_1,
-  ARIZONA_CLK_32K_SRC_MASK,
-  arizona->pdata.clk32k_src - 1);
-   arizona_clk32k_enable(arizona);
-   break;
-   case ARIZONA_32KZ_NONE:
-   regmap_update_bits(arizona->regmap, ARIZONA_CLOCK_32K_1,
-  ARIZONA_CLK_32K_SRC_MASK, 2);
-   break;
-   default:
-   dev_err(arizona->dev, "Invalid 32kHz clock source: %d\n",
-   arizona->pdata.clk32k_src);
-   ret = -EINVAL;
-   goto err_reset;
-   }
-
for (i = 0; i < ARIZONA_MAX_MICBIAS; i++) {
if (!arizona->pdata.micbias[i].mV &&
!arizona->pdata.micbias[i].bypass)
@@ -1387,10 +1308,25 @@ int arizona_dev_init(struct arizona *arizona)
pm_runtime_set_active(arizona->dev);
pm_runtime_enable(arizona->dev);
 
+   arizona->clk32k = devm_clk_get(arizona->dev, "arizona-32k");
+   if (IS_ERR(arizona->clk32k)) {
+   ret = PTR_ERR(arizona->clk32k);
+   if (ret == -ENOENT)
+   ret = -EPROBE_DEFER;
+   dev_err(arizona->dev, "Failed to get 32k clock: %d\n

[PATCH v2 4/4] mfd: arizona: Add device tree binding documentation for new clock driver

2016-01-06 Thread Charles Keepax
Specify the device tree binding for the input clocks to Arizona devices.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
---

No changes since v1.

Thanks,
Charles

 Documentation/devicetree/bindings/mfd/arizona.txt | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt 
b/Documentation/devicetree/bindings/mfd/arizona.txt
index 18be0cb..39f76f8 100644
--- a/Documentation/devicetree/bindings/mfd/arizona.txt
+++ b/Documentation/devicetree/bindings/mfd/arizona.txt
@@ -45,6 +45,13 @@ Optional properties:
 
   - wlf,reset : GPIO specifier for the GPIO controlling /RESET
 
+  - clocks: Should reference the clocks supplied on MCLK1 and MCLK2
+  - clock-names: Should contains two strings:
+  "mclk1" for the clock supplied on MCLK1, recommended to be a high
+  quality audio reference clock
+  "mclk2" for the clock supplied on MCLK2, recommended to be an always on
+  32k clock
+
   - wlf,gpio-defaults : A list of GPIO configuration register values. Defines
 for the appropriate values can found in . If
 absent, no configuration of these registers is performed. If any entry has
-- 
2.1.4

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


[PATCH v2 2/4] clk: arizona: Add clock driver for the Arizona devices

2016-01-06 Thread Charles Keepax
Add an initial clock driver for the Arizona series audio CODECs.
Currently this driver only provides support for parsing the two input
clocks (mclk1, mclk2) and providing the internally consumed 32k clock.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
---

Changes since v1:
 - Change in if (ret != 0) to an if (ret)

Thanks,
Charles

 MAINTAINERS   |   1 +
 drivers/clk/Kconfig   |   6 ++
 drivers/clk/Makefile  |   1 +
 drivers/clk/clk-arizona.c | 192 ++
 include/linux/mfd/arizona/pdata.h |   3 +
 5 files changed, 203 insertions(+)
 create mode 100644 drivers/clk/clk-arizona.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 233f834..29e161a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11681,6 +11681,7 @@ F:  
Documentation/devicetree/bindings/regulator/arizona-regulator.txt
 F: Documentation/devicetree/bindings/mfd/arizona.txt
 F: arch/arm/mach-s3c64xx/mach-crag6410*
 F: drivers/clk/clk-wm83*.c
+F: drivers/clk/clk-arizona.c
 F: drivers/extcon/extcon-arizona.c
 F: drivers/leds/leds-wm83*.c
 F: drivers/gpio/gpio-*wm*.c
diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
index c3e3a02..becd743 100644
--- a/drivers/clk/Kconfig
+++ b/drivers/clk/Kconfig
@@ -25,6 +25,12 @@ config COMMON_CLK
 menu "Common Clock Framework"
depends on COMMON_CLK
 
+config COMMON_CLK_ARIZONA
+   tristate "Clock driver for Arizona devices"
+   depends on MFD_ARIZONA
+   ---help---
+ This driver supports the clocking on the Arizona devices.
+
 config COMMON_CLK_WM831X
tristate "Clock driver for WM831x/2x PMICs"
depends on MFD_WM831X
diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
index 820714c..11e3aaa 100644
--- a/drivers/clk/Makefile
+++ b/drivers/clk/Makefile
@@ -17,6 +17,7 @@ endif
 
 # hardware specific clock types
 # please keep this section sorted lexicographically by file/directory path name
+obj-$(CONFIG_COMMON_CLK_ARIZONA)   += clk-arizona.o
 obj-$(CONFIG_MACH_ASM9260) += clk-asm9260.o
 obj-$(CONFIG_COMMON_CLK_AXI_CLKGEN)+= clk-axi-clkgen.o
 obj-$(CONFIG_ARCH_AXXIA)   += clk-axm5516.o
diff --git a/drivers/clk/clk-arizona.c b/drivers/clk/clk-arizona.c
new file mode 100644
index 000..00452a0
--- /dev/null
+++ b/drivers/clk/clk-arizona.c
@@ -0,0 +1,192 @@
+/*
+ * Arizona clock control
+ *
+ * Copyright 2016 Cirrus Logic, Inc.
+ *
+ * Author: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
+ *
+ *  This program is free software; you can redistribute  it and/or modify it
+ *  under  the terms of  the GNU General  Public License as published by the
+ *  Free Software Foundation;  either version 2 of the  License, or (at your
+ *  option) any later version.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#define CLK32K_RATE 32768
+
+struct arizona_clk {
+   struct arizona *arizona;
+
+   struct clk_hw clk32k_hw;
+   struct clk *clk32k;
+};
+
+static inline struct arizona_clk *clk32k_to_arizona_clk(struct clk_hw *hw)
+{
+   return container_of(hw, struct arizona_clk, clk32k_hw);
+}
+
+static int arizona_32k_enable(struct clk_hw *hw)
+{
+   struct arizona_clk *clkdata = clk32k_to_arizona_clk(hw);
+   struct arizona *arizona = clkdata->arizona;
+   int ret;
+
+   switch (arizona->pdata.clk32k_src) {
+   case ARIZONA_32KZ_MCLK1:
+   ret = pm_runtime_get_sync(arizona->dev);
+   if (ret)
+   goto out;
+   break;
+   }
+
+   ret = regmap_update_bits_async(arizona->regmap, ARIZONA_CLOCK_32K_1,
+  ARIZONA_CLK_32K_ENA,
+  ARIZONA_CLK_32K_ENA);
+
+out:
+   return ret;
+}
+
+static void arizona_32k_disable(struct clk_hw *hw)
+{
+   struct arizona_clk *clkdata = clk32k_to_arizona_clk(hw);
+   struct arizona *arizona = clkdata->arizona;
+
+   regmap_update_bits_async(arizona->regmap, ARIZONA_CLOCK_32K_1,
+ARIZONA_CLK_32K_ENA, 0);
+
+   switch (arizona->pdata.clk32k_src) {
+   case ARIZONA_32KZ_MCLK1:
+   pm_runtime_put_sync(arizona->dev);
+   break;
+   }
+}
+
+static const struct clk_ops arizona_32k_ops = {
+   .prepare = arizona_32k_enable,
+   .unprepare = arizona_32k_disable,
+};
+
+static int arizona_clk_of_get_pdata(struct arizona *arizona)
+{
+   const char * const pins[] = { "mclk1", "mclk2" };
+   struct clk *mclk;
+   int i;
+
+   if (!of_property_read_bool(arizona->dev->of_node, "clocks"))
+   return 0;
+
+   for (i = 0; i < ARRAY_SIZE(pins); ++i) {
+   mclk = of_clk_get_by_name(arizona->dev->of_node, pins[i]);
+  

[PATCH 4/4] mfd: arizona: Add device tree binding documentation for new clock driver

2016-01-05 Thread Charles Keepax
Specify the device tree binding for the input clocks to Arizona devices.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
---
 Documentation/devicetree/bindings/mfd/arizona.txt | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt 
b/Documentation/devicetree/bindings/mfd/arizona.txt
index 18be0cb..39f76f8 100644
--- a/Documentation/devicetree/bindings/mfd/arizona.txt
+++ b/Documentation/devicetree/bindings/mfd/arizona.txt
@@ -45,6 +45,13 @@ Optional properties:
 
   - wlf,reset : GPIO specifier for the GPIO controlling /RESET
 
+  - clocks: Should reference the clocks supplied on MCLK1 and MCLK2
+  - clock-names: Should contains two strings:
+  "mclk1" for the clock supplied on MCLK1, recommended to be a high
+  quality audio reference clock
+  "mclk2" for the clock supplied on MCLK2, recommended to be an always on
+  32k clock
+
   - wlf,gpio-defaults : A list of GPIO configuration register values. Defines
 for the appropriate values can found in . If
 absent, no configuration of these registers is performed. If any entry has
-- 
2.1.4

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


[PATCH 2/4] clk: arizona: Add clock driver for the Arizona devices

2016-01-05 Thread Charles Keepax
Add an initial clock driver for the Arizona series audio CODECs.
Currently this driver only provides support for parsing the two input
clocks (mclk1, mclk2) and providing the internally consumed 32k clock.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
---
 MAINTAINERS   |   1 +
 drivers/clk/Kconfig   |   6 ++
 drivers/clk/Makefile  |   1 +
 drivers/clk/clk-arizona.c | 192 ++
 include/linux/mfd/arizona/pdata.h |   3 +
 5 files changed, 203 insertions(+)
 create mode 100644 drivers/clk/clk-arizona.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 233f834..29e161a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11681,6 +11681,7 @@ F:  
Documentation/devicetree/bindings/regulator/arizona-regulator.txt
 F: Documentation/devicetree/bindings/mfd/arizona.txt
 F: arch/arm/mach-s3c64xx/mach-crag6410*
 F: drivers/clk/clk-wm83*.c
+F: drivers/clk/clk-arizona.c
 F: drivers/extcon/extcon-arizona.c
 F: drivers/leds/leds-wm83*.c
 F: drivers/gpio/gpio-*wm*.c
diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
index c3e3a02..becd743 100644
--- a/drivers/clk/Kconfig
+++ b/drivers/clk/Kconfig
@@ -25,6 +25,12 @@ config COMMON_CLK
 menu "Common Clock Framework"
depends on COMMON_CLK
 
+config COMMON_CLK_ARIZONA
+   tristate "Clock driver for Arizona devices"
+   depends on MFD_ARIZONA
+   ---help---
+ This driver supports the clocking on the Arizona devices.
+
 config COMMON_CLK_WM831X
tristate "Clock driver for WM831x/2x PMICs"
depends on MFD_WM831X
diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
index 820714c..11e3aaa 100644
--- a/drivers/clk/Makefile
+++ b/drivers/clk/Makefile
@@ -17,6 +17,7 @@ endif
 
 # hardware specific clock types
 # please keep this section sorted lexicographically by file/directory path name
+obj-$(CONFIG_COMMON_CLK_ARIZONA)   += clk-arizona.o
 obj-$(CONFIG_MACH_ASM9260) += clk-asm9260.o
 obj-$(CONFIG_COMMON_CLK_AXI_CLKGEN)+= clk-axi-clkgen.o
 obj-$(CONFIG_ARCH_AXXIA)   += clk-axm5516.o
diff --git a/drivers/clk/clk-arizona.c b/drivers/clk/clk-arizona.c
new file mode 100644
index 000..1ab69ee
--- /dev/null
+++ b/drivers/clk/clk-arizona.c
@@ -0,0 +1,192 @@
+/*
+ * Arizona clock control
+ *
+ * Copyright 2016 Cirrus Logic, Inc.
+ *
+ * Author: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
+ *
+ *  This program is free software; you can redistribute  it and/or modify it
+ *  under  the terms of  the GNU General  Public License as published by the
+ *  Free Software Foundation;  either version 2 of the  License, or (at your
+ *  option) any later version.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#define CLK32K_RATE 32768
+
+struct arizona_clk {
+   struct arizona *arizona;
+
+   struct clk_hw clk32k_hw;
+   struct clk *clk32k;
+};
+
+static inline struct arizona_clk *clk32k_to_arizona_clk(struct clk_hw *hw)
+{
+   return container_of(hw, struct arizona_clk, clk32k_hw);
+}
+
+static int arizona_32k_enable(struct clk_hw *hw)
+{
+   struct arizona_clk *clkdata = clk32k_to_arizona_clk(hw);
+   struct arizona *arizona = clkdata->arizona;
+   int ret;
+
+   switch (arizona->pdata.clk32k_src) {
+   case ARIZONA_32KZ_MCLK1:
+   ret = pm_runtime_get_sync(arizona->dev);
+   if (ret != 0)
+   goto out;
+   break;
+   }
+
+   ret = regmap_update_bits_async(arizona->regmap, ARIZONA_CLOCK_32K_1,
+  ARIZONA_CLK_32K_ENA,
+  ARIZONA_CLK_32K_ENA);
+
+out:
+   return ret;
+}
+
+static void arizona_32k_disable(struct clk_hw *hw)
+{
+   struct arizona_clk *clkdata = clk32k_to_arizona_clk(hw);
+   struct arizona *arizona = clkdata->arizona;
+
+   regmap_update_bits_async(arizona->regmap, ARIZONA_CLOCK_32K_1,
+ARIZONA_CLK_32K_ENA, 0);
+
+   switch (arizona->pdata.clk32k_src) {
+   case ARIZONA_32KZ_MCLK1:
+   pm_runtime_put_sync(arizona->dev);
+   break;
+   }
+}
+
+static const struct clk_ops arizona_32k_ops = {
+   .prepare = arizona_32k_enable,
+   .unprepare = arizona_32k_disable,
+};
+
+static int arizona_clk_of_get_pdata(struct arizona *arizona)
+{
+   const char * const pins[] = { "mclk1", "mclk2" };
+   struct clk *mclk;
+   int i;
+
+   if (!of_property_read_bool(arizona->dev->of_node, "clocks"))
+   return 0;
+
+   for (i = 0; i < ARRAY_SIZE(pins); ++i) {
+   mclk = of_clk_get_by_name(arizona->dev->of_node, pins[i]);
+   if (IS_ERR(mclk))
+   return PTR_ERR(mclk

[PATCH 3/4] mfd: arizona: Switch to using clock driver for 32k clock

2016-01-05 Thread Charles Keepax
Now we have a clock driver that can control the 32k clock use this
rather than directly controlling the 32k clock from the MFD device.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
---
 drivers/mfd/Kconfig  |   1 +
 drivers/mfd/arizona-core.c   | 104 +--
 include/linux/mfd/arizona/core.h |   7 +--
 3 files changed, 26 insertions(+), 86 deletions(-)

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 4d92df6..85aa33e 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1367,6 +1367,7 @@ config MFD_ARIZONA
select REGMAP
select REGMAP_IRQ
select MFD_CORE
+   select COMMON_CLK_ARIZONA
bool
 
 config MFD_ARIZONA_I2C
diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c
index d474732..5a55dd6 100644
--- a/drivers/mfd/arizona-core.c
+++ b/drivers/mfd/arizona-core.c
@@ -36,63 +36,6 @@ static const char * const wm5102_core_supplies[] = {
"DBVDD1",
 };
 
-int arizona_clk32k_enable(struct arizona *arizona)
-{
-   int ret = 0;
-
-   mutex_lock(>clk_lock);
-
-   arizona->clk32k_ref++;
-
-   if (arizona->clk32k_ref == 1) {
-   switch (arizona->pdata.clk32k_src) {
-   case ARIZONA_32KZ_MCLK1:
-   ret = pm_runtime_get_sync(arizona->dev);
-   if (ret != 0)
-   goto out;
-   break;
-   }
-
-   ret = regmap_update_bits(arizona->regmap, ARIZONA_CLOCK_32K_1,
-ARIZONA_CLK_32K_ENA,
-ARIZONA_CLK_32K_ENA);
-   }
-
-out:
-   if (ret != 0)
-   arizona->clk32k_ref--;
-
-   mutex_unlock(>clk_lock);
-
-   return ret;
-}
-EXPORT_SYMBOL_GPL(arizona_clk32k_enable);
-
-int arizona_clk32k_disable(struct arizona *arizona)
-{
-   mutex_lock(>clk_lock);
-
-   BUG_ON(arizona->clk32k_ref <= 0);
-
-   arizona->clk32k_ref--;
-
-   if (arizona->clk32k_ref == 0) {
-   regmap_update_bits(arizona->regmap, ARIZONA_CLOCK_32K_1,
-  ARIZONA_CLK_32K_ENA, 0);
-
-   switch (arizona->pdata.clk32k_src) {
-   case ARIZONA_32KZ_MCLK1:
-   pm_runtime_put_sync(arizona->dev);
-   break;
-   }
-   }
-
-   mutex_unlock(>clk_lock);
-
-   return 0;
-}
-EXPORT_SYMBOL_GPL(arizona_clk32k_disable);
-
 static irqreturn_t arizona_clkgen_err(int irq, void *data)
 {
struct arizona *arizona = data;
@@ -874,6 +817,7 @@ static inline int arizona_of_get_core_pdata(struct arizona 
*arizona)
 
 static const struct mfd_cell early_devs[] = {
{ .name = "arizona-ldo1" },
+   { .name = "arizona-clk" },
 };
 
 static const char * const wm5102_supplies[] = {
@@ -970,7 +914,6 @@ int arizona_dev_init(struct arizona *arizona)
int n_subdevs, ret, i;
 
dev_set_drvdata(arizona->dev, arizona);
-   mutex_init(>clk_lock);
 
if (dev_get_platdata(arizona->dev))
memcpy(>pdata, dev_get_platdata(arizona->dev),
@@ -1261,28 +1204,6 @@ int arizona_dev_init(struct arizona *arizona)
}
 
/* Chip default */
-   if (!arizona->pdata.clk32k_src)
-   arizona->pdata.clk32k_src = ARIZONA_32KZ_MCLK2;
-
-   switch (arizona->pdata.clk32k_src) {
-   case ARIZONA_32KZ_MCLK1:
-   case ARIZONA_32KZ_MCLK2:
-   regmap_update_bits(arizona->regmap, ARIZONA_CLOCK_32K_1,
-  ARIZONA_CLK_32K_SRC_MASK,
-  arizona->pdata.clk32k_src - 1);
-   arizona_clk32k_enable(arizona);
-   break;
-   case ARIZONA_32KZ_NONE:
-   regmap_update_bits(arizona->regmap, ARIZONA_CLOCK_32K_1,
-  ARIZONA_CLK_32K_SRC_MASK, 2);
-   break;
-   default:
-   dev_err(arizona->dev, "Invalid 32kHz clock source: %d\n",
-   arizona->pdata.clk32k_src);
-   ret = -EINVAL;
-   goto err_reset;
-   }
-
for (i = 0; i < ARIZONA_MAX_MICBIAS; i++) {
if (!arizona->pdata.micbias[i].mV &&
!arizona->pdata.micbias[i].bypass)
@@ -1387,10 +1308,25 @@ int arizona_dev_init(struct arizona *arizona)
pm_runtime_set_active(arizona->dev);
pm_runtime_enable(arizona->dev);
 
+   arizona->clk32k = devm_clk_get(arizona->dev, "arizona-32k");
+   if (IS_ERR(arizona->clk32k)) {
+   ret = PTR_ERR(arizona->clk32k);
+   if (ret == -ENOENT)
+   ret = -EPROBE_DEFER;
+   dev_err(arizona->dev, "Failed to get 32k c

[PATCH 1/4] extcon: arizona: Remove enable/disable of 32k clock

2016-01-05 Thread Charles Keepax
The 32k clock is unconditionally enabled by the MFD core so there is no
need to control it from the extcon device, so this patch removes the
control of the 32k clock.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
---
 drivers/extcon/extcon-arizona.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index e4890dd..52d041f 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -1571,7 +1571,6 @@ static int arizona_extcon_probe(struct platform_device 
*pdev)
goto err_micdet;
}
 
-   arizona_clk32k_enable(arizona);
regmap_update_bits(arizona->regmap, ARIZONA_JACK_DETECT_DEBOUNCE,
   ARIZONA_JD1_DB, ARIZONA_JD1_DB);
regmap_update_bits(arizona->regmap, ARIZONA_JACK_DETECT_ANALOGUE,
@@ -1642,7 +1641,6 @@ static int arizona_extcon_remove(struct platform_device 
*pdev)
cancel_delayed_work_sync(>hpdet_work);
regmap_update_bits(arizona->regmap, ARIZONA_JACK_DETECT_ANALOGUE,
   ARIZONA_JD1_ENA, 0);
-   arizona_clk32k_disable(arizona);
 
return 0;
 }
-- 
2.1.4

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


Re: [PATCH 2/2] mfd: arizona: Update binding docs for selecting mono/stereo outputs

2015-12-14 Thread Charles Keepax
On Fri, Dec 11, 2015 at 11:33:53AM -0600, Rob Herring wrote:
> On Fri, Dec 11, 2015 at 10:28:23AM +0000, Charles Keepax wrote:
> > Update the device tree binding documentation to include the wlf,out-mono
> > property that is used to specify whether each output is a mono or stereo
> > output.
> 
> You just added this binding and updating it already? While we may like 
> kernel changes incremental, we don't like bindings evolving any more 
> than necessary.

The binding has been around for ages I have been working through
updating it to actually include more of the functionality of the
driver. The last set of changes where some initial work on the
jack detection, this is a fairly self contained update that
doesn't really relate to the jack detection.

Its a fairly complex part so there is going to be quite a lot to
the binding. I have basically been upstreaming them as much as
possible in groups of similar functionality, as I have time to
work on them.  I could try save the changes up out of tree and
collect together into much larger chains, if you felt strongly
about it? But I am not really clear that helps much. As I have to
hang on to much more out of tree code, people using the part have
to wait longer to have access to useful bindings in mainline and
it makes the CC lists much longer so everyone needs to look at
more email than they need to.

>  
> > Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
> > ---
> >  Documentation/devicetree/bindings/mfd/arizona.txt | 4 
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt 
> > b/Documentation/devicetree/bindings/mfd/arizona.txt
> > index 2b6ccdb..489dd07 100644
> > --- a/Documentation/devicetree/bindings/mfd/arizona.txt
> > +++ b/Documentation/devicetree/bindings/mfd/arizona.txt
> > @@ -65,6 +65,10 @@ Optional properties:
> >  that have not been specified are set to 0 by default. Entries are:
> >  <IN1, IN2, IN3, IN4> (wm5102, wm5110, wm8280, wm8997)
> >  <IN1A, IN2A, IN1B, IN2B> (wm8998, wm1814)
> > +  - wlf,out-mono : A boolean indicating whether each output is mono or 
> > stereo.
> > +A non-zero value indicates a mono output. If present, the number of 
> > values
> > +should be less than or equal to the number of outputs, if less values 
> > are
> > +supplied the additional outputs will be treated as stereo.
> 
> How do you know which outputs are which with a variable number? 

Position in the array (ie. first entry is the first output, and
so on). I will respin to update the comment to make this more
clear.

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


[PATCH v2 2/3] extcon: arizona: Update device tree binding for mic detect configurations

2015-12-14 Thread Charles Keepax
Update the device tree binding documentation to include documentation for
the wlf,micd-configs property that is used to specify the configurations
for headset polarity detection (CTIA / OTMP).

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
Acked-by: Rob Herring <r...@kernel.org>
---

No changes since v1.

Thanks,
Charles

 Documentation/devicetree/bindings/extcon/extcon-arizona.txt | 8 
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/extcon/extcon-arizona.txt 
b/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
index 238e10e..fd9b898 100644
--- a/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
+++ b/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
@@ -37,5 +37,13 @@ Optional properties:
 milliseconds.
   - wlf,micd-force-micbias : Force MICBIAS continuously on during microphone
 detection.
+  - wlf,micd-configs : Headset polarity configurations (generally used for
+detection of CTIA / OMTP headsets), the field can be of variable length
+but should always be a multiple of 3 cells long, each three cell group
+represents one polarity configuration.
+The first cell defines the accessory detection pin, zero will use MICDET1
+and all other values will use MICDET2.
+The second cell represents the MICBIAS to be used.
+The third cell represents the value of the micd-pol-gpio pin.
 
   - wlf,gpsw : Settings for the general purpose switch
-- 
2.1.4

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


[PATCH v2 1/3] extcon: arizona: Add device bindings for the micd configurations

2015-12-14 Thread Charles Keepax
Add device bindings to support configuring the jack detection
configurations. Each configuration needs to specify the connection of
the mic det pins, which micbias should be used and the value of the
micd polarity GPIO required to activate that configuration.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
Acked-by: Chanwoo Choi <cw00.c...@samsung.com>
---

Changes since v1:
 - Report error from arizona_extcon_get_micd_configs

Thanks,
Charles

 drivers/extcon/extcon-arizona.c | 56 +++--
 1 file changed, 54 insertions(+), 2 deletions(-)

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index 8647533..c121d01 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -1201,10 +1201,58 @@ static void arizona_micd_set_level(struct arizona 
*arizona, int index,
regmap_update_bits(arizona->regmap, reg, mask, level);
 }
 
-static int arizona_extcon_device_get_pdata(struct arizona *arizona)
+static int arizona_extcon_get_micd_configs(struct device *dev,
+  struct arizona *arizona)
+{
+   const char * const prop = "wlf,micd-configs";
+   const int entries_per_config = 3;
+   struct arizona_micd_config *micd_configs;
+   int nconfs, ret;
+   int i, j;
+   u32 *vals;
+
+   nconfs = device_property_read_u32_array(arizona->dev, prop, NULL, 0);
+   if (nconfs <= 0)
+   return 0;
+
+   vals = kcalloc(nconfs, sizeof(u32), GFP_KERNEL);
+   if (!vals)
+   return -ENOMEM;
+
+   ret = device_property_read_u32_array(arizona->dev, prop, vals, nconfs);
+   if (ret < 0)
+   goto out;
+
+   nconfs /= entries_per_config;
+
+   micd_configs = devm_kzalloc(dev,
+   nconfs * sizeof(struct arizona_micd_range),
+   GFP_KERNEL);
+   if (!micd_configs) {
+   ret = -ENOMEM;
+   goto out;
+   }
+
+   for (i = 0, j = 0; i < nconfs; ++i) {
+   micd_configs[i].src = vals[j++] ? ARIZONA_ACCDET_SRC : 0;
+   micd_configs[i].bias = vals[j++];
+   micd_configs[i].gpio = vals[j++];
+   }
+
+   arizona->pdata.micd_configs = micd_configs;
+   arizona->pdata.num_micd_configs = nconfs;
+
+out:
+   kfree(vals);
+   return ret;
+}
+
+static int arizona_extcon_device_get_pdata(struct device *dev,
+  struct arizona *arizona)
 {
struct arizona_pdata *pdata = >pdata;
unsigned int val = ARIZONA_ACCDET_MODE_HPL;
+   int ret;
 
device_property_read_u32(arizona->dev, "wlf,hpdet-channel", );
switch (val) {
@@ -1249,6 +1297,10 @@ static int arizona_extcon_device_get_pdata(struct 
arizona *arizona)
pdata->jd_gpio5_nopull = device_property_read_bool(arizona->dev,
"wlf,use-jd2-nopull");
 
+   ret = arizona_extcon_get_micd_configs(dev, arizona);
+   if (ret < 0)
+   dev_err(arizona->dev, "Failed to read micd configs: %d\n", ret);
+
return 0;
 }
 
@@ -1270,7 +1322,7 @@ static int arizona_extcon_probe(struct platform_device 
*pdev)
return -ENOMEM;
 
if (!dev_get_platdata(arizona->dev))
-   arizona_extcon_device_get_pdata(arizona);
+   arizona_extcon_device_get_pdata(>dev, arizona);
 
info->micvdd = devm_regulator_get(>dev, "MICVDD");
if (IS_ERR(info->micvdd)) {
-- 
2.1.4

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


[PATCH 3/3] extcon: arizona: Add DT binding examples

2015-12-14 Thread Charles Keepax
Add an example for all elements of the Arizona extcon device tree
binding.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
---
 .../devicetree/bindings/extcon/extcon-arizona.txt  | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/Documentation/devicetree/bindings/extcon/extcon-arizona.txt 
b/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
index fd9b898..e27341f 100644
--- a/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
+++ b/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
@@ -47,3 +47,29 @@ Optional properties:
 The third cell represents the value of the micd-pol-gpio pin.
 
   - wlf,gpsw : Settings for the general purpose switch
+
+Example:
+
+codec: wm8280@0 {
+   compatible = "wlf,wm8280";
+   reg = <0>;
+   ...
+
+   wlf,use-jd2;
+   wlf,use-jd2-nopull;
+   wlf,jd-invert;
+
+   wlf,micd-software-compare;
+   wlf,micd-detect-debounce = <0>;
+   wlf,micd-pol-gpio = < 2 0>;
+   wlf,micd-rate = ;
+   wlf,micd-dbtime = <4>;
+   wlf,micd-timeout-ms = <100>;
+   wlf,micd-force-micbias;
+   wlf,micd-configs = <
+   0 1 0 /* MICDET1 MICBIAS1 GPIO=low */
+   1 2 1 /* MICDET2 MICBIAS2 GPIO=high */
+   >;
+
+   wlf,gpsw = <0>;
+};
-- 
2.1.4

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


[PATCH v2 1/2] mfd: arizona: Add device tree binding to specify mono outputs

2015-12-14 Thread Charles Keepax
Add device tree bindings to support specifying outputs from the chip as
mono outputs. Whilst we are doing it change the out_mono pdata from a
bool to an int, because Sparse gets upset about using ARRAY_SIZE on
bools.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
---

No changes since v1.

Thanks,
Charles

 drivers/mfd/arizona-core.c| 10 ++
 include/linux/mfd/arizona/pdata.h |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c
index b9489a0..4bb4866 100644
--- a/drivers/mfd/arizona-core.c
+++ b/drivers/mfd/arizona-core.c
@@ -861,6 +861,16 @@ static int arizona_of_get_core_pdata(struct arizona 
*arizona)
count++;
}
 
+   count = 0;
+   of_property_for_each_u32(arizona->dev->of_node, "wlf,out-mono", prop,
+cur, val) {
+   if (count == ARRAY_SIZE(pdata->out_mono))
+   break;
+
+   pdata->out_mono[count] = !!val;
+   count++;
+   }
+
return 0;
 }
 
diff --git a/include/linux/mfd/arizona/pdata.h 
b/include/linux/mfd/arizona/pdata.h
index 57b45ca..64faeef 100644
--- a/include/linux/mfd/arizona/pdata.h
+++ b/include/linux/mfd/arizona/pdata.h
@@ -171,7 +171,7 @@ struct arizona_pdata {
int inmode[ARIZONA_MAX_INPUT];
 
/** Mode for outputs */
-   bool out_mono[ARIZONA_MAX_OUTPUT];
+   int out_mono[ARIZONA_MAX_OUTPUT];
 
/** PDM speaker mute setting */
unsigned int spk_mute[ARIZONA_MAX_PDM_SPK];
-- 
2.1.4

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


Re: [PATCH 2/2] extcon: arizona: Update device tree binding for mic detect configurations

2015-12-14 Thread Charles Keepax
On Mon, Dec 14, 2015 at 11:03:58AM +0900, Chanwoo Choi wrote:
> Hi Charles,
> 
> On 2015년 12월 11일 02:08, Charles Keepax wrote:
> > Update the device tree binding documentation to include documentation for
> > the wlf,micd-configs property that is used to specify the configurations
> > for headset polarity detection (CTIA / OTMP).
> > 
> > Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
> > ---
> >  Documentation/devicetree/bindings/extcon/extcon-arizona.txt | 8 
> >  1 file changed, 8 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/extcon/extcon-arizona.txt 
> > b/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
> > index 238e10e..fd9b898 100644
> > --- a/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
> > +++ b/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
> > @@ -37,5 +37,13 @@ Optional properties:
> >  milliseconds.
> >- wlf,micd-force-micbias : Force MICBIAS continuously on during 
> > microphone
> >  detection.
> > +  - wlf,micd-configs : Headset polarity configurations (generally used for
> > +detection of CTIA / OMTP headsets), the field can be of variable length
> > +but should always be a multiple of 3 cells long, each three cell group
> > +represents one polarity configuration.
> > +The first cell defines the accessory detection pin, zero will use 
> > MICDET1
> > +and all other values will use MICDET2.
> > +The second cell represents the MICBIAS to be used.
> > +The third cell represents the value of the micd-pol-gpio pin.
> 
> I think that you better to add the example using the 'wlf,micd-configs'
> to improve the understanding of using this property.
> because the number of 'wlf,micd-configs' value is not fixed.
> 
> Also,
> How about do you add the real example for all arizona properties on separate 
> patch?

Yeah that seems sensible I will do a patch to add an example to
this file.

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


[PATCH v2 2/2] mfd: arizona: Update binding docs for selecting mono/stereo outputs

2015-12-14 Thread Charles Keepax
Update the device tree binding documentation to include the wlf,out-mono
property that is used to specify whether each output is a mono or stereo
output.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
---

Changes since v1:
 - Clarify which outputs correspond to which entry in the out-mono list.

Thanks,
Charles

 Documentation/devicetree/bindings/mfd/arizona.txt | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt 
b/Documentation/devicetree/bindings/mfd/arizona.txt
index 2b6ccdb..069e31d 100644
--- a/Documentation/devicetree/bindings/mfd/arizona.txt
+++ b/Documentation/devicetree/bindings/mfd/arizona.txt
@@ -65,6 +65,12 @@ Optional properties:
 that have not been specified are set to 0 by default. Entries are:
 <IN1, IN2, IN3, IN4> (wm5102, wm5110, wm8280, wm8997)
 <IN1A, IN2A, IN1B, IN2B> (wm8998, wm1814)
+  - wlf,out-mono : A list of boolean values indicating whether each output is
+mono or stereo. Position within the list indicates the output affected
+(eg. First entry in the list corresponds to output 1). A non-zero value
+indicates a mono output. If present, the number of values should be less
+than or equal to the number of outputs, if less values are supplied the
+additional outputs will be treated as stereo.
 
   - wlf,dmic-ref : DMIC reference voltage source for each input, can be
 selected from either MICVDD or one of the MICBIAS's, defines
-- 
2.1.4

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


[PATCH 1/2] mfd: arizona: Add device tree binding to specify mono outputs

2015-12-11 Thread Charles Keepax
Add device tree bindings to support specifying outputs from the chip as
mono outputs. Whilst we are doing it change the out_mono pdata from a
bool to an int, because Sparse gets upset about using ARRAY_SIZE on
bools.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
---
 drivers/mfd/arizona-core.c| 10 ++
 include/linux/mfd/arizona/pdata.h |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c
index b9489a0..4bb4866 100644
--- a/drivers/mfd/arizona-core.c
+++ b/drivers/mfd/arizona-core.c
@@ -861,6 +861,16 @@ static int arizona_of_get_core_pdata(struct arizona 
*arizona)
count++;
}
 
+   count = 0;
+   of_property_for_each_u32(arizona->dev->of_node, "wlf,out-mono", prop,
+cur, val) {
+   if (count == ARRAY_SIZE(pdata->out_mono))
+   break;
+
+   pdata->out_mono[count] = !!val;
+   count++;
+   }
+
return 0;
 }
 
diff --git a/include/linux/mfd/arizona/pdata.h 
b/include/linux/mfd/arizona/pdata.h
index 57b45ca..64faeef 100644
--- a/include/linux/mfd/arizona/pdata.h
+++ b/include/linux/mfd/arizona/pdata.h
@@ -171,7 +171,7 @@ struct arizona_pdata {
int inmode[ARIZONA_MAX_INPUT];
 
/** Mode for outputs */
-   bool out_mono[ARIZONA_MAX_OUTPUT];
+   int out_mono[ARIZONA_MAX_OUTPUT];
 
/** PDM speaker mute setting */
unsigned int spk_mute[ARIZONA_MAX_PDM_SPK];
-- 
2.1.4

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


[PATCH 2/2] mfd: arizona: Update binding docs for selecting mono/stereo outputs

2015-12-11 Thread Charles Keepax
Update the device tree binding documentation to include the wlf,out-mono
property that is used to specify whether each output is a mono or stereo
output.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
---
 Documentation/devicetree/bindings/mfd/arizona.txt | 4 
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt 
b/Documentation/devicetree/bindings/mfd/arizona.txt
index 2b6ccdb..489dd07 100644
--- a/Documentation/devicetree/bindings/mfd/arizona.txt
+++ b/Documentation/devicetree/bindings/mfd/arizona.txt
@@ -65,6 +65,10 @@ Optional properties:
 that have not been specified are set to 0 by default. Entries are:
 <IN1, IN2, IN3, IN4> (wm5102, wm5110, wm8280, wm8997)
 <IN1A, IN2A, IN1B, IN2B> (wm8998, wm1814)
+  - wlf,out-mono : A boolean indicating whether each output is mono or stereo.
+A non-zero value indicates a mono output. If present, the number of values
+should be less than or equal to the number of outputs, if less values are
+supplied the additional outputs will be treated as stereo.
 
   - wlf,dmic-ref : DMIC reference voltage source for each input, can be
 selected from either MICVDD or one of the MICBIAS's, defines
-- 
2.1.4

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


[PATCH 2/2] extcon: arizona: Update device tree binding for mic detect configurations

2015-12-10 Thread Charles Keepax
Update the device tree binding documentation to include documentation for
the wlf,micd-configs property that is used to specify the configurations
for headset polarity detection (CTIA / OTMP).

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
---
 Documentation/devicetree/bindings/extcon/extcon-arizona.txt | 8 
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/extcon/extcon-arizona.txt 
b/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
index 238e10e..fd9b898 100644
--- a/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
+++ b/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
@@ -37,5 +37,13 @@ Optional properties:
 milliseconds.
   - wlf,micd-force-micbias : Force MICBIAS continuously on during microphone
 detection.
+  - wlf,micd-configs : Headset polarity configurations (generally used for
+detection of CTIA / OMTP headsets), the field can be of variable length
+but should always be a multiple of 3 cells long, each three cell group
+represents one polarity configuration.
+The first cell defines the accessory detection pin, zero will use MICDET1
+and all other values will use MICDET2.
+The second cell represents the MICBIAS to be used.
+The third cell represents the value of the micd-pol-gpio pin.
 
   - wlf,gpsw : Settings for the general purpose switch
-- 
2.1.4

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


[PATCH 1/2] extcon: arizona: Add device bindings for the micd configurations

2015-12-10 Thread Charles Keepax
Add device bindings to support configuring the jack detection
configurations. Each configuration needs to specify the connection of
the mic det pins, which micbias should be used and the value of the
micd polarity GPIO required to activate that configuration.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
---
 drivers/extcon/extcon-arizona.c | 53 +++--
 1 file changed, 51 insertions(+), 2 deletions(-)

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index 8647533..edbf2e1 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -1201,7 +1201,54 @@ static void arizona_micd_set_level(struct arizona 
*arizona, int index,
regmap_update_bits(arizona->regmap, reg, mask, level);
 }
 
-static int arizona_extcon_device_get_pdata(struct arizona *arizona)
+static int arizona_extcon_get_micd_configs(struct device *dev,
+  struct arizona *arizona)
+{
+   const char * const prop = "wlf,micd-configs";
+   const int entries_per_config = 3;
+   struct arizona_micd_config *micd_configs;
+   int nconfs, ret;
+   int i, j;
+   u32 *vals;
+
+   nconfs = device_property_read_u32_array(arizona->dev, prop, NULL, 0);
+   if (nconfs <= 0)
+   return 0;
+
+   vals = kcalloc(nconfs, sizeof(u32), GFP_KERNEL);
+   if (!vals)
+   return -ENOMEM;
+
+   ret = device_property_read_u32_array(arizona->dev, prop, vals, nconfs);
+   if (ret < 0)
+   goto out;
+
+   nconfs /= entries_per_config;
+
+   micd_configs = devm_kzalloc(dev,
+   nconfs * sizeof(struct arizona_micd_range),
+   GFP_KERNEL);
+   if (!micd_configs) {
+   ret = -ENOMEM;
+   goto out;
+   }
+
+   for (i = 0, j = 0; i < nconfs; ++i) {
+   micd_configs[i].src = vals[j++] ? ARIZONA_ACCDET_SRC : 0;
+   micd_configs[i].bias = vals[j++];
+   micd_configs[i].gpio = vals[j++];
+   }
+
+   arizona->pdata.micd_configs = micd_configs;
+   arizona->pdata.num_micd_configs = nconfs;
+
+out:
+   kfree(vals);
+   return ret;
+}
+
+static int arizona_extcon_device_get_pdata(struct device *dev,
+  struct arizona *arizona)
 {
struct arizona_pdata *pdata = >pdata;
unsigned int val = ARIZONA_ACCDET_MODE_HPL;
@@ -1249,6 +1296,8 @@ static int arizona_extcon_device_get_pdata(struct arizona 
*arizona)
pdata->jd_gpio5_nopull = device_property_read_bool(arizona->dev,
"wlf,use-jd2-nopull");
 
+   arizona_extcon_get_micd_configs(dev, arizona);
+
return 0;
 }
 
@@ -1270,7 +1319,7 @@ static int arizona_extcon_probe(struct platform_device 
*pdev)
return -ENOMEM;
 
if (!dev_get_platdata(arizona->dev))
-   arizona_extcon_device_get_pdata(arizona);
+   arizona_extcon_device_get_pdata(>dev, arizona);
 
info->micvdd = devm_regulator_get(>dev, "MICVDD");
if (IS_ERR(info->micvdd)) {
-- 
2.1.4

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


[PATCH] extcon: arizona: Update naming for micd-timeout DT to include units

2015-11-23 Thread Charles Keepax
Add time units of -ms (milliseconds) to wlf,micd-timeout.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
---
 .../devicetree/bindings/extcon/extcon-arizona.txt  |2 +-
 drivers/extcon/extcon-arizona.c|2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/extcon/extcon-arizona.txt 
b/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
index da9813b..05d85ac 100644
--- a/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
+++ b/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
@@ -33,7 +33,7 @@ Optional properties:
 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
+  - wlf,micd-timeout-ms : Timeout for microphone detection, specified in
 milliseconds.
   - wlf,micd-force-micbias : Force MICBIAS continuously on during microphone
 detection.
diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index c377030..8647533 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -1230,7 +1230,7 @@ static int arizona_extcon_device_get_pdata(struct arizona 
*arizona)
device_property_read_u32(arizona->dev, "wlf,micd-dbtime",
 >micd_dbtime);
 
-   device_property_read_u32(arizona->dev, "wlf,micd-timeout",
+   device_property_read_u32(arizona->dev, "wlf,micd-timeout-ms",
 >micd_timeout);
 
pdata->micd_force_micbias = device_property_read_bool(arizona->dev,
-- 
1.7.2.5

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


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

2015-11-20 Thread Charles Keepax
On Fri, Nov 20, 2015 at 09:58:33AM -0600, Rob Herring wrote:
> On Thu, Nov 19, 2015 at 03:45:39PM +0000, Charles Keepax wrote:
> > Add additional bindings to allow configuration of the system specific
> > microphone detection settings.
> > 
> > Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
> > ---
> >  .../devicetree/bindings/extcon/extcon-arizona.txt  |   20 
> > 
> >  1 files changed, 20 insertions(+), 0 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/extcon/extcon-arizona.txt 
> > b/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
> > index e1705fa..d661811 100644
> > --- a/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
> > +++ b/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
> > @@ -13,3 +13,23 @@ Optional properties:
> >  ARIZONA_ACCDET_MODE_HPR or 2 - Headphone detect mode is set to HPDETR
> >  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.
> 
> Please add unit suffix (-ms).

Yeah can do will ping out a small patch to update this as well.

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


[PATCH] extcon: arizona: Update naming for second jack detection DT binding

2015-11-20 Thread Charles Keepax
Update the name for the second jack detection pin binding to be a little
less confusing.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
---
 .../devicetree/bindings/extcon/extcon-arizona.txt  |4 ++--
 drivers/extcon/extcon-arizona.c|4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/extcon/extcon-arizona.txt 
b/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
index 03fa7b7..da9813b 100644
--- a/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
+++ b/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
@@ -14,9 +14,9 @@ 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
+  - wlf,use-jd2 : Use the additional JD input along with JD1 for dual pin jack
 detection.
-  - wlf,use-jd-gpio-nopull : Internal pull on GPIO is disabled when used for
+  - wlf,use-jd2-nopull : Internal pull on JD2 is disabled when used for
 jack detection.
   - wlf,jd-invert : Invert the polarity of the jack detection switch
 
diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index 7c9598d..c377030 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -1245,9 +1245,9 @@ static int arizona_extcon_device_get_pdata(struct arizona 
*arizona)
device_property_read_u32(arizona->dev, "wlf,gpsw", >gpsw);
 
pdata->jd_gpio5 = device_property_read_bool(arizona->dev,
-   "wlf,use-jd-gpio");
+   "wlf,use-jd2");
pdata->jd_gpio5_nopull = device_property_read_bool(arizona->dev,
-   "wlf,use-jd-gpio-nopull");
+   "wlf,use-jd2-nopull");
 
return 0;
 }
-- 
1.7.2.5

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


[PATCH v3 0/6] Arizona Extcon Update Device Bindings

2015-11-19 Thread Charles Keepax
This patch chain adds device bindings for the jack and
microphone detection system specific settings.

Changes since v2:
 - Now moved things over to the new extcon binding document

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
  extcon: arizona: Update DT binding documentation for mic detection
  extcon: arizona: Update DT binding documentation for jack detection

 .../devicetree/bindings/extcon/extcon-arizona.txt  |   26 
 drivers/extcon/extcon-arizona.c|   13 ++
 2 files changed, 39 insertions(+), 0 deletions(-)

-- 
1.7.2.5

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


[PATCH v3 5/6] extcon: arizona: Update DT binding documentation for mic detection

2015-11-19 Thread Charles Keepax
Add additional bindings to allow configuration of the system specific
microphone detection settings.

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

diff --git a/Documentation/devicetree/bindings/extcon/extcon-arizona.txt 
b/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
index e1705fa..d661811 100644
--- a/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
+++ b/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
@@ -13,3 +13,23 @@ Optional properties:
 ARIZONA_ACCDET_MODE_HPR or 2 - Headphone detect mode is set to HPDETR
 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
-- 
1.7.2.5

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


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

2015-11-19 Thread 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.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
Acked-by: Chanwoo Choi <cw00.c...@samsung.com>
---
 drivers/extcon/extcon-arizona.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index e4890dd..af3afee 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -1236,6 +1236,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;
 }
 
-- 
1.7.2.5

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


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

2015-11-19 Thread 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.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
Acked-by: Chanwoo Choi <cw00.c...@samsung.com>
---
 drivers/extcon/extcon-arizona.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index 493da5b..27ddf9c 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -1239,6 +1239,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", >gpsw);
 
return 0;
-- 
1.7.2.5

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


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

2015-11-19 Thread 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.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
Acked-by: Chanwoo Choi <cw00.c...@samsung.com>
---
 drivers/extcon/extcon-arizona.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index 27ddf9c..7c9598d 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -1244,6 +1244,11 @@ static int arizona_extcon_device_get_pdata(struct 
arizona *arizona)
 
device_property_read_u32(arizona->dev, "wlf,gpsw", >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;
 }
 
-- 
1.7.2.5

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


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

2015-11-19 Thread 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.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
Acked-by: Chanwoo Choi <cw00.c...@samsung.com>
---
 drivers/extcon/extcon-arizona.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index af3afee..493da5b 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -1239,6 +1239,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", >gpsw);
+
return 0;
 }
 
-- 
1.7.2.5

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


[PATCH v3 6/6] extcon: arizona: Update DT binding documentation for jack detection

2015-11-19 Thread 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.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
Reviewed-by: Chanwoo Choi <cw00.c...@samsung.com>
---
 .../devicetree/bindings/extcon/extcon-arizona.txt  |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/extcon/extcon-arizona.txt 
b/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
index d661811..7640a35 100644
--- a/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
+++ b/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
@@ -14,6 +14,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
-- 
1.7.2.5

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


Re: [PATCH v2] mfd: arizona: Add DT binding for irq-gpios property

2015-11-03 Thread Charles Keepax
On Tue, Nov 03, 2015 at 03:04:50PM +, Mark Brown wrote:
> On Tue, Nov 03, 2015 at 03:10:06PM +0100, Sebastien Jan wrote:
> 
> > +  - irq-gpios : GPIO specifier for the GPIO connected to /IRQ
> 
> The platform data this is providing is essentially a workaround for the
> lack of an irq_to_gpio() function and the use of it is a workaround for
> the lack of level triggered IRQ emulation in genirq...  do we really
> want this in the ABI (especially as a generic thing)?

Personally I would rather not add this to the DT unless we really
had to.

Also are you sure this is necessary on your system? Specifically
you only need this entry if the CODEC is connected to an IRQ line
that only supports edge triggered IRQs.

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


[PATCH v3 4/4] MAINTAINERS: Add binding docs for Cirrus Logic/Wolfson Arizona devices

2015-10-27 Thread Charles Keepax
Add device tree binding documentation for the Arizona drivers
to the MAINTAINERS file.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
---

Changes since v2:
 - Moved all the maintainer updates into this patch

Thanks,
Charles

 MAINTAINERS |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 0658fec..4dc45de 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11392,6 +11392,9 @@ T:  git 
https://github.com/CirrusLogic/linux-drivers.git
 W: https://github.com/CirrusLogic/linux-drivers/wiki
 S: Supported
 F: Documentation/hwmon/wm83??
+F: Documentation/devicetree/bindings/extcon/extcon-arizona.txt
+F: Documentation/devicetree/bindings/regulator/arizona-regulator.txt
+F: Documentation/devicetree/bindings/mfd/arizona.txt
 F: arch/arm/mach-s3c64xx/mach-crag6410*
 F: drivers/clk/clk-wm83*.c
 F: drivers/extcon/extcon-arizona.c
-- 
1.7.2.5

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


[PATCH v3 3/4] mfd: arizona: Remove bindings covered in new subsystem specific docs

2015-10-27 Thread Charles Keepax
Binding documentation has been added in new subsystem specific binding
documents. This patch removes the now duplicate documentation from the
MFD documentation.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
---

Changes since v2:
 - No longer moving the core regulators into the regulator binding document,
   as they are properties of the device as a whole not just the regulators
 - Moved the maintainer updates into a seperate patch

Lee, I have removed your ack because the patch has changed a fair amount.
Apologies if this would not have been your preference.

Thanks,
Charles

 Documentation/devicetree/bindings/mfd/arizona.txt |   15 +++
 1 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt 
b/Documentation/devicetree/bindings/mfd/arizona.txt
index a8fee60..18be0cb 100644
--- a/Documentation/devicetree/bindings/mfd/arizona.txt
+++ b/Documentation/devicetree/bindings/mfd/arizona.txt
@@ -44,7 +44,6 @@ Required properties:
 Optional properties:
 
   - wlf,reset : GPIO specifier for the GPIO controlling /RESET
-  - wlf,ldoena : GPIO specifier for the GPIO controlling LDOENA
 
   - wlf,gpio-defaults : A list of GPIO configuration register values. Defines
 for the appropriate values can found in . If
@@ -67,21 +66,13 @@ Optional properties:
 present, the number of values should be less than or equal to the
 number of inputs, unspecified inputs will use the chip default.
 
-  - wlf,hpdet-channel : Headphone detection channel.
-ARIZONA_ACCDET_MODE_HPL or 1 - Headphone detect mode is set to HPDETL
-ARIZONA_ACCDET_MODE_HPR or 2 - Headphone detect mode is set to HPDETR
-If this node is not mentioned or if the value is unknown, then
-headphone detection mode is set to HPDETL.
-
   - 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
 
-Optional subnodes:
-  - ldo1 : Initial data for the LDO1 regulator, as covered in
-Documentation/devicetree/bindings/regulator/regulator.txt
-  - micvdd : Initial data for the MICVDD regulator, as covered in
-Documentation/devicetree/bindings/regulator/regulator.txt
+Also see child specific device properties:
+  Regulator - ../regulator/arizona-regulator.txt
+  Extcon- ../extcon/extcon-arizona.txt
 
 Example:
 
-- 
1.7.2.5

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


[PATCH v3 1/4] extcon: arizona: Add extcon specific device tree binding document

2015-10-27 Thread Charles Keepax
Subsystem specific bindings for the Arizona devices are being factored
out of the MFD binding document into separate documents for each
subsystem. This patch adds a binding document that covers the existing
extcon specific bindings.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
Acked-by: Chanwoo Choi <cw00.c...@samsung.com>
---

Changes since v2:
 - Moved the maintainer updates into a separate patch

Thanks,
Charles

 .../devicetree/bindings/extcon/extcon-arizona.txt  |   15 +++
 1 files changed, 15 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/extcon/extcon-arizona.txt

diff --git a/Documentation/devicetree/bindings/extcon/extcon-arizona.txt 
b/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
new file mode 100644
index 000..e1705fa
--- /dev/null
+++ b/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
@@ -0,0 +1,15 @@
+Cirrus Logic Arizona class audio SoCs
+
+These devices are audio SoCs with extensive digital capabilities and a range
+of analogue I/O.
+
+This document lists Extcon specific bindings, see the primary binding document:
+  ../mfd/arizona.txt
+
+Optional properties:
+
+  - wlf,hpdet-channel : Headphone detection channel.
+ARIZONA_ACCDET_MODE_HPL or 1 - Headphone detect mode is set to HPDETL
+ARIZONA_ACCDET_MODE_HPR or 2 - Headphone detect mode is set to HPDETR
+If this node is not mentioned or if the value is unknown, then
+headphone detection mode is set to HPDETL.
-- 
1.7.2.5

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


[PATCH v3 2/4] regulator: arizona: Add regulator specific device tree binding document

2015-10-27 Thread Charles Keepax
Subsystem specific bindings for the Arizona devices are being factored
out of the MFD binding document into separate documents for each
subsystem. This patch adds a binding document that covers the existing
regulator specific bindings.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
---

Changes since v2:
 - Moved the core regulators back into the MFD component
 - Moved the maintainer updates into a separate patch

Thanks,
Charles

 .../bindings/regulator/arizona-regulator.txt   |   17 +
 1 files changed, 17 insertions(+), 0 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/regulator/arizona-regulator.txt

diff --git a/Documentation/devicetree/bindings/regulator/arizona-regulator.txt 
b/Documentation/devicetree/bindings/regulator/arizona-regulator.txt
new file mode 100644
index 000..443564d
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/arizona-regulator.txt
@@ -0,0 +1,17 @@
+Cirrus Logic Arizona class audio SoCs
+
+These devices are audio SoCs with extensive digital capabilities and a range
+of analogue I/O.
+
+This document lists regulator specific bindings, see the primary binding
+document:
+  ../mfd/arizona.txt
+
+Optional properties:
+  - wlf,ldoena : GPIO specifier for the GPIO controlling LDOENA
+
+Optional subnodes:
+  - ldo1 : Initial data for the LDO1 regulator, as covered in
+Documentation/devicetree/bindings/regulator/regulator.txt
+  - micvdd : Initial data for the MICVDD regulator, as covered in
+Documentation/devicetree/bindings/regulator/regulator.txt
-- 
1.7.2.5

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


Re: [PATCH v2 2/3] regulator: arizona: Add regulator specific device tree binding document

2015-10-26 Thread Charles Keepax
On Thu, Oct 22, 2015 at 01:44:49PM +0100, Mark Brown wrote:
> On Thu, Oct 15, 2015 at 02:47:07PM +0100, Charles Keepax wrote:
> 
> > +This document lists regulator specific bindings, see the primary binding
> > +document:
> > +  ../mfd/arizona.txt
> > +
> > +Required properties:
> > +
> > +  - AVDD-supply, DBVDD1-supply, CPVDD-supply : Power supplies for the 
> > device,
> > +as covered in regulator.txt
> > +
> > +  - DBVDD2-supply, DBVDD3-supply : Additional databus power supplies 
> > (wm5102,
> > +wm5110, wm8280, wm8998, wm1814)
> > +
> > +  - SPKVDDL-supply, SPKVDDR-supply : Speaker driver power supplies (wm5102,
> > +wm5110, wm8280, wm8998, wm1814)
> > +
> > +  - SPKVDD-supply : Speaker driver power supply (wm8997)
> > +
> 
> I'd expect these to be on the MFD since they're (with the exception of
> AVDD which supplies the regulators IIRC) not part of the regulator
> component of the device and are core for bringing it online.

Yeah, fair enough I will move those back into the MFD part.

> 
> > +Optional properties:
> > +  - wlf,ldoena : GPIO specifier for the GPIO controlling LDOENA
> > +
> > +Optional subnodes:
> > +  - ldo1 : Initial data for the LDO1 regulator, as covered in
> > +Documentation/devicetree/bindings/regulator/regulator.txt
> > +  - micvdd : Initial data for the MICVDD regulator, as covered in
> > +Documentation/devicetree/bindings/regulator/regulator.txt
> 
> These are the properties for the regulator itself.
> 
> > +++ b/MAINTAINERS
> > @@ -11381,6 +11381,7 @@ W:  
> > http://opensource.wolfsonmicro.com/content/linux-drivers-wolfson-devices
> >  S: Supported
> >  F: Documentation/hwmon/wm83??
> >  F: Documentation/devicetree/bindings/extcon/extcon-arizona.txt
> > +F: Documentation/devicetree/bindings/regulator/arizona-regulator.txt
> >  F: arch/arm/mach-s3c64xx/mach-crag6410*
> >  F: drivers/clk/clk-wm83*.c
> >  F: drivers/extcon/extcon-arizona.c
> 
> I'd suggest moving this to a separate patch which adds all the new files
> together to make it easier to merge things.

Yeah no problem with making that a seperate patch.

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


[PATCH v2 1/3] extcon: arizona: Add extcon specific device tree binding document

2015-10-15 Thread Charles Keepax
Subystem specific bindings for the Arizona devices are being factored
out of the MFD binding document into seperate documents for each
subsystem. This patch adds a binding document that covers the existing
extcon specific bindings.

Acked-by: Chanwoo Choi <cw00.c...@samsung.com>
Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
---

Changes since v1:
 - Added more commit message

Thanks,
Charles

 .../devicetree/bindings/extcon/extcon-arizona.txt  |   15 +++
 MAINTAINERS|1 +
 2 files changed, 16 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/extcon/extcon-arizona.txt

diff --git a/Documentation/devicetree/bindings/extcon/extcon-arizona.txt 
b/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
new file mode 100644
index 000..e1705fa
--- /dev/null
+++ b/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
@@ -0,0 +1,15 @@
+Cirrus Logic Arizona class audio SoCs
+
+These devices are audio SoCs with extensive digital capabilities and a range
+of analogue I/O.
+
+This document lists Extcon specific bindings, see the primary binding document:
+  ../mfd/arizona.txt
+
+Optional properties:
+
+  - wlf,hpdet-channel : Headphone detection channel.
+ARIZONA_ACCDET_MODE_HPL or 1 - Headphone detect mode is set to HPDETL
+ARIZONA_ACCDET_MODE_HPR or 2 - Headphone detect mode is set to HPDETR
+If this node is not mentioned or if the value is unknown, then
+headphone detection mode is set to HPDETL.
diff --git a/MAINTAINERS b/MAINTAINERS
index fb2ba3d..915f9ec 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11380,6 +11380,7 @@ T:  git 
git://opensource.wolfsonmicro.com/linux-2.6-audioplus
 W: http://opensource.wolfsonmicro.com/content/linux-drivers-wolfson-devices
 S: Supported
 F: Documentation/hwmon/wm83??
+F: Documentation/devicetree/bindings/extcon/extcon-arizona.txt
 F: arch/arm/mach-s3c64xx/mach-crag6410*
 F: drivers/clk/clk-wm83*.c
 F: drivers/extcon/extcon-arizona.c
-- 
1.7.2.5

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


[PATCH v2 3/3] mfd: arizona: Remove bindings covered in new subsystem specific docs

2015-10-15 Thread Charles Keepax
Binding documentation has been added in new subsystem specific binding
documents. This patch removes the now duplicate documentation from the
MFD documentation. Also whilst we are at it add a missing maintainers
entry for the MFD binding document.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
Acked-by: Lee Jones <lee.jo...@linaro.org>
---

No change since v1.

Thanks,
Charles

 Documentation/devicetree/bindings/mfd/arizona.txt |   30 ++--
 MAINTAINERS   |1 +
 2 files changed, 4 insertions(+), 27 deletions(-)

diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt 
b/Documentation/devicetree/bindings/mfd/arizona.txt
index a8fee60..077c4fe 100644
--- a/Documentation/devicetree/bindings/mfd/arizona.txt
+++ b/Documentation/devicetree/bindings/mfd/arizona.txt
@@ -30,21 +30,9 @@ Required properties:
   - #gpio-cells : Must be 2. The first cell is the pin number and the
 second cell is used to specify optional parameters (currently unused).
 
-  - AVDD-supply, DBVDD1-supply, CPVDD-supply : Power supplies for the device,
-as covered in Documentation/devicetree/bindings/regulator/regulator.txt
-
-  - DBVDD2-supply, DBVDD3-supply : Additional databus power supplies (wm5102,
-wm5110, wm8280, wm8998, wm1814)
-
-  - SPKVDDL-supply, SPKVDDR-supply : Speaker driver power supplies (wm5102,
-wm5110, wm8280, wm8998, wm1814)
-
-  - SPKVDD-supply : Speaker driver power supply (wm8997)
-
 Optional properties:
 
   - wlf,reset : GPIO specifier for the GPIO controlling /RESET
-  - wlf,ldoena : GPIO specifier for the GPIO controlling LDOENA
 
   - wlf,gpio-defaults : A list of GPIO configuration register values. Defines
 for the appropriate values can found in . If
@@ -67,21 +55,9 @@ Optional properties:
 present, the number of values should be less than or equal to the
 number of inputs, unspecified inputs will use the chip default.
 
-  - wlf,hpdet-channel : Headphone detection channel.
-ARIZONA_ACCDET_MODE_HPL or 1 - Headphone detect mode is set to HPDETL
-ARIZONA_ACCDET_MODE_HPR or 2 - Headphone detect mode is set to HPDETR
-If this node is not mentioned or if the value is unknown, then
-headphone detection mode is set to HPDETL.
-
-  - 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
-
-Optional subnodes:
-  - ldo1 : Initial data for the LDO1 regulator, as covered in
-Documentation/devicetree/bindings/regulator/regulator.txt
-  - micvdd : Initial data for the MICVDD regulator, as covered in
-Documentation/devicetree/bindings/regulator/regulator.txt
+Also see child specific device properties:
+  Regulator - ../regulator/arizona-regulator.txt
+  Extcon- ../extcon/extcon-arizona.txt
 
 Example:
 
diff --git a/MAINTAINERS b/MAINTAINERS
index 0e0889b..047f5d8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11382,6 +11382,7 @@ S:  Supported
 F: Documentation/hwmon/wm83??
 F: Documentation/devicetree/bindings/extcon/extcon-arizona.txt
 F: Documentation/devicetree/bindings/regulator/arizona-regulator.txt
+F: Documentation/devicetree/bindings/mfd/arizona.txt
 F: arch/arm/mach-s3c64xx/mach-crag6410*
 F: drivers/clk/clk-wm83*.c
 F: drivers/extcon/extcon-arizona.c
-- 
1.7.2.5

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


[PATCH v2 2/3] regulator: arizona: Add regulator specific device tree binding document

2015-10-15 Thread Charles Keepax
Subystem specific bindings for the Arizona devices are being factored
out of the MFD binding document into seperate documents for each
subsystem. This patch adds a binding document that covers the existing
regulator specific bindings.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
---

Changes since v1:
 - Added more commit message

Thanks,
Charles

 .../bindings/regulator/arizona-regulator.txt   |   34 
 MAINTAINERS|1 +
 2 files changed, 35 insertions(+), 0 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/regulator/arizona-regulator.txt

diff --git a/Documentation/devicetree/bindings/regulator/arizona-regulator.txt 
b/Documentation/devicetree/bindings/regulator/arizona-regulator.txt
new file mode 100644
index 000..25bb7f3
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/arizona-regulator.txt
@@ -0,0 +1,34 @@
+Cirrus Logic Arizona class audio SoCs
+
+These devices are audio SoCs with extensive digital capabilities and a range
+of analogue I/O.
+
+This document lists regulator specific bindings, see the primary binding
+document:
+  ../mfd/arizona.txt
+
+Required properties:
+
+  - AVDD-supply, DBVDD1-supply, CPVDD-supply : Power supplies for the device,
+as covered in regulator.txt
+
+  - DBVDD2-supply, DBVDD3-supply : Additional databus power supplies (wm5102,
+wm5110, wm8280, wm8998, wm1814)
+
+  - SPKVDDL-supply, SPKVDDR-supply : Speaker driver power supplies (wm5102,
+wm5110, wm8280, wm8998, wm1814)
+
+  - SPKVDD-supply : Speaker driver power supply (wm8997)
+
+Optional properties:
+  - wlf,ldoena : GPIO specifier for the GPIO controlling LDOENA
+
+  - 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
+
+Optional subnodes:
+  - ldo1 : Initial data for the LDO1 regulator, as covered in
+Documentation/devicetree/bindings/regulator/regulator.txt
+  - micvdd : Initial data for the MICVDD regulator, as covered in
+Documentation/devicetree/bindings/regulator/regulator.txt
diff --git a/MAINTAINERS b/MAINTAINERS
index 915f9ec..0e0889b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11381,6 +11381,7 @@ W:  
http://opensource.wolfsonmicro.com/content/linux-drivers-wolfson-devices
 S: Supported
 F: Documentation/hwmon/wm83??
 F: Documentation/devicetree/bindings/extcon/extcon-arizona.txt
+F: Documentation/devicetree/bindings/regulator/arizona-regulator.txt
 F: arch/arm/mach-s3c64xx/mach-crag6410*
 F: drivers/clk/clk-wm83*.c
 F: drivers/extcon/extcon-arizona.c
-- 
1.7.2.5

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


[PATCH 1/3] extcon: arizona: Add extcon specific device tree binding document

2015-10-14 Thread Charles Keepax
Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
---
 .../devicetree/bindings/extcon/extcon-arizona.txt  |   15 +++
 MAINTAINERS|1 +
 2 files changed, 16 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/extcon/extcon-arizona.txt

diff --git a/Documentation/devicetree/bindings/extcon/extcon-arizona.txt 
b/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
new file mode 100644
index 000..e1705fa
--- /dev/null
+++ b/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
@@ -0,0 +1,15 @@
+Cirrus Logic Arizona class audio SoCs
+
+These devices are audio SoCs with extensive digital capabilities and a range
+of analogue I/O.
+
+This document lists Extcon specific bindings, see the primary binding document:
+  ../mfd/arizona.txt
+
+Optional properties:
+
+  - wlf,hpdet-channel : Headphone detection channel.
+ARIZONA_ACCDET_MODE_HPL or 1 - Headphone detect mode is set to HPDETL
+ARIZONA_ACCDET_MODE_HPR or 2 - Headphone detect mode is set to HPDETR
+If this node is not mentioned or if the value is unknown, then
+headphone detection mode is set to HPDETL.
diff --git a/MAINTAINERS b/MAINTAINERS
index 9f6685f..08c804a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11393,6 +11393,7 @@ T:  git 
https://github.com/CirrusLogic/linux-drivers.git
 W: https://github.com/CirrusLogic/linux-drivers/wiki
 S: Supported
 F: Documentation/hwmon/wm83??
+F: Documentation/devicetree/bindings/extcon/extcon-arizona.txt
 F: arch/arm/mach-s3c64xx/mach-crag6410*
 F: drivers/clk/clk-wm83*.c
 F: drivers/extcon/extcon-arizona.c
-- 
1.7.2.5

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


[PATCH 2/3] regulator: arizona: Add regulator specific device tree binding document

2015-10-14 Thread Charles Keepax
Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
---
 .../bindings/regulator/arizona-regulator.txt   |   34 
 MAINTAINERS|1 +
 2 files changed, 35 insertions(+), 0 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/regulator/arizona-regulator.txt

diff --git a/Documentation/devicetree/bindings/regulator/arizona-regulator.txt 
b/Documentation/devicetree/bindings/regulator/arizona-regulator.txt
new file mode 100644
index 000..25bb7f3
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/arizona-regulator.txt
@@ -0,0 +1,34 @@
+Cirrus Logic Arizona class audio SoCs
+
+These devices are audio SoCs with extensive digital capabilities and a range
+of analogue I/O.
+
+This document lists regulator specific bindings, see the primary binding
+document:
+  ../mfd/arizona.txt
+
+Required properties:
+
+  - AVDD-supply, DBVDD1-supply, CPVDD-supply : Power supplies for the device,
+as covered in regulator.txt
+
+  - DBVDD2-supply, DBVDD3-supply : Additional databus power supplies (wm5102,
+wm5110, wm8280, wm8998, wm1814)
+
+  - SPKVDDL-supply, SPKVDDR-supply : Speaker driver power supplies (wm5102,
+wm5110, wm8280, wm8998, wm1814)
+
+  - SPKVDD-supply : Speaker driver power supply (wm8997)
+
+Optional properties:
+  - wlf,ldoena : GPIO specifier for the GPIO controlling LDOENA
+
+  - 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
+
+Optional subnodes:
+  - ldo1 : Initial data for the LDO1 regulator, as covered in
+Documentation/devicetree/bindings/regulator/regulator.txt
+  - micvdd : Initial data for the MICVDD regulator, as covered in
+Documentation/devicetree/bindings/regulator/regulator.txt
diff --git a/MAINTAINERS b/MAINTAINERS
index 08c804a..f353491 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11394,6 +11394,7 @@ W:  
https://github.com/CirrusLogic/linux-drivers/wiki
 S: Supported
 F: Documentation/hwmon/wm83??
 F: Documentation/devicetree/bindings/extcon/extcon-arizona.txt
+F: Documentation/devicetree/bindings/regulator/arizona-regulator.txt
 F: arch/arm/mach-s3c64xx/mach-crag6410*
 F: drivers/clk/clk-wm83*.c
 F: drivers/extcon/extcon-arizona.c
-- 
1.7.2.5

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


[PATCH 3/3] mfd: arizona: Remove bindings covered in new subsystem specific docs

2015-10-14 Thread Charles Keepax
Binding documentation has been added in new subsystem specific binding
documents. This patch removes the now duplicate documentation from the
MFD documentation. Also whilst we are at it add a missing maintainers
entry for the MFD binding document.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
---
 Documentation/devicetree/bindings/mfd/arizona.txt |   30 ++--
 MAINTAINERS   |1 +
 2 files changed, 4 insertions(+), 27 deletions(-)

diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt 
b/Documentation/devicetree/bindings/mfd/arizona.txt
index a8fee60..077c4fe 100644
--- a/Documentation/devicetree/bindings/mfd/arizona.txt
+++ b/Documentation/devicetree/bindings/mfd/arizona.txt
@@ -30,21 +30,9 @@ Required properties:
   - #gpio-cells : Must be 2. The first cell is the pin number and the
 second cell is used to specify optional parameters (currently unused).
 
-  - AVDD-supply, DBVDD1-supply, CPVDD-supply : Power supplies for the device,
-as covered in Documentation/devicetree/bindings/regulator/regulator.txt
-
-  - DBVDD2-supply, DBVDD3-supply : Additional databus power supplies (wm5102,
-wm5110, wm8280, wm8998, wm1814)
-
-  - SPKVDDL-supply, SPKVDDR-supply : Speaker driver power supplies (wm5102,
-wm5110, wm8280, wm8998, wm1814)
-
-  - SPKVDD-supply : Speaker driver power supply (wm8997)
-
 Optional properties:
 
   - wlf,reset : GPIO specifier for the GPIO controlling /RESET
-  - wlf,ldoena : GPIO specifier for the GPIO controlling LDOENA
 
   - wlf,gpio-defaults : A list of GPIO configuration register values. Defines
 for the appropriate values can found in . If
@@ -67,21 +55,9 @@ Optional properties:
 present, the number of values should be less than or equal to the
 number of inputs, unspecified inputs will use the chip default.
 
-  - wlf,hpdet-channel : Headphone detection channel.
-ARIZONA_ACCDET_MODE_HPL or 1 - Headphone detect mode is set to HPDETL
-ARIZONA_ACCDET_MODE_HPR or 2 - Headphone detect mode is set to HPDETR
-If this node is not mentioned or if the value is unknown, then
-headphone detection mode is set to HPDETL.
-
-  - 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
-
-Optional subnodes:
-  - ldo1 : Initial data for the LDO1 regulator, as covered in
-Documentation/devicetree/bindings/regulator/regulator.txt
-  - micvdd : Initial data for the MICVDD regulator, as covered in
-Documentation/devicetree/bindings/regulator/regulator.txt
+Also see child specific device properties:
+  Regulator - ../regulator/arizona-regulator.txt
+  Extcon- ../extcon/extcon-arizona.txt
 
 Example:
 
diff --git a/MAINTAINERS b/MAINTAINERS
index f353491..544c747 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11395,6 +11395,7 @@ S:  Supported
 F: Documentation/hwmon/wm83??
 F: Documentation/devicetree/bindings/extcon/extcon-arizona.txt
 F: Documentation/devicetree/bindings/regulator/arizona-regulator.txt
+F: Documentation/devicetree/bindings/mfd/arizona.txt
 F: arch/arm/mach-s3c64xx/mach-crag6410*
 F: drivers/clk/clk-wm83*.c
 F: drivers/extcon/extcon-arizona.c
-- 
1.7.2.5

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


[PATCH 0/3] Split Arizona DT bindings between subsystems

2015-10-14 Thread Charles Keepax
As discussed the Arizona device tree bindings documentation
will be split up into a seperate document holding properties
specific to each subsystem.

This series factors out the regulator and extcon
bindings. It will probably make sense to split out a GPIO
binding document as well but at the moment the only property
here is the gpio-defaults which are still handled in the MFD
driver and probably require significantly more thought to
split out.

Thanks,
Charles

Charles Keepax (3):
  extcon: arizona: Add extcon specific device tree binding document
  regulator: arizona: Add regulator specific device tree binding
document
  mfd: arizona: Remove bindings covered in new subsystem specific docs

 .../devicetree/bindings/extcon/extcon-arizona.txt  |   15 +
 Documentation/devicetree/bindings/mfd/arizona.txt  |   30 ++---
 .../bindings/regulator/arizona-regulator.txt   |   34 
 MAINTAINERS|3 ++
 4 files changed, 55 insertions(+), 27 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/extcon/extcon-arizona.txt
 create mode 100644 
Documentation/devicetree/bindings/regulator/arizona-regulator.txt

-- 
1.7.2.5

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


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

2015-10-13 Thread Charles Keepax
On Tue, Oct 13, 2015 at 09:02:18AM +0100, Lee Jones wrote:
> On Mon, 12 Oct 2015, Mark Brown wrote:
> 
> > On Mon, Oct 12, 2015 at 09:45:54AM +0100, Charles Keepax wrote:
> > > On Wed, Oct 07, 2015 at 01:26:42PM +0100, Lee Jones wrote:
> > > > On Wed, 07 Oct 2015, Mark Brown wrote:
> > 
> > > > > This all seems pretty much fine to me - the things it is controlling 
> > > > > are
> > > > > fairly specific to the way the former Wolfson devices do, they only
> > > > > really make sense with a fairly particular algorithm which isn't 
> > > > > widely
> > > > > implemented.
> > 
> > > > Is that an Ack?
> > 
> > > I am guessing Mark is slightly hesitant to ack as he probably
> > > doesn't want to add reviewing all our jack detection bindings to
> > > his already fairly sizable work load and doing so here likely
> > > means it will be expected in the future. From talking to people at
> 
> Providing Acks should not (and has not to my knowledge) be a binding
> contract to continue providing Acks.  However, should more bindings be
> submitted which appear as though they are related to a particular
> maintainer, then sure, you'll be asked for your expert eye again.

Its not a binding contract to continue providing them but we are
making that a condition of merging any patches, which means I
will need to chase Mark for Acks, as it seems the DT maintainers
won't have any interest in reviewing/acking these.

> 
> > Pretty much (plus generally being busy at ELC-E last week) - if there's
> > specific questions that's one thing but if it's just general requests to
> > look at bindings then it seems like the relevant subsystem maintainers
> 
> This is exactly my point.  I am not the 'relevant subsystem
> maintainer' for these properties and subsequently know nothing of
> microphone detection, headsets, bias', etc.  These look like Audio
> related properties to me (the uninitiated), which is why you were
> asked.

It would be sensible I guess to define whether I should be
including audio people on jack detection patches even if they
don't touch audio subsystems. I was treating jack detection
as an extcon thing and thus assuming that the extcon maintainer
would be sufficient, but perhaps that is an incorrect assumption.

> 
> > should have the confidence to review straightfoward device properties
> > like this.
> 
> I don't think these bindings are particularly straightforward.  The
> contain many terms which I'm unfamiliar with, and again, to me (the
> uninitiated) this looks like way too many bindings just to see if an
> audio jack is plugged in or not.

I also wish our designers would make less complex hardware sigh.

Apologies I didn't mean to cause any offense here, I am just
getting a bit concerned about how I can get any DT support for
jack detection upstreamed. I am more than happy to fix up any
comments anyone has or answer any questions about what things
are or why they are required.

The jack detection on these chips is fairly complex and there are
going to be plenty more patches before we have full support for
it in DT. So I think it would be good for everyone if we can
agree some process for how to handle this type of patch.

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


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

2015-10-13 Thread Charles Keepax
On Tue, Oct 13, 2015 at 09:08:00AM +0100, Lee Jones wrote:
> On Fri, 02 Oct 2015, Charles Keepax wrote:
> 
> > Add additional bindings to allow configuration of the system specific
> > microphone detection settings.
> > 
> > Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
> > ---
> >  Documentation/devicetree/bindings/mfd/arizona.txt |   21 
> > +
> >  include/dt-bindings/mfd/arizona.h |5 +
> >  2 files changed, 26 insertions(+), 0 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt 
> > b/Documentation/devicetree/bindings/mfd/arizona.txt
> > index a8fee60..b98a11b 100644
> > --- a/Documentation/devicetree/bindings/mfd/arizona.txt
> > +++ b/Documentation/devicetree/bindings/mfd/arizona.txt
> > @@ -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.
> 
> Where are all of these bindings to be consumed?

In the extcon driver it handles all jack detection in the Arizona
devices.

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


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

2015-10-13 Thread Charles Keepax
On Tue, Oct 13, 2015 at 03:18:22PM +0100, Lee Jones wrote:
> On Tue, 13 Oct 2015, Chanwoo Choi wrote:
> > On 2015년 10월 13일 22:59, Chanwoo Choi wrote:
> > > On 2015년 10월 13일 22:50, Lee Jones wrote:
> > >> On Tue, 13 Oct 2015, Charles Keepax wrote:
> > >>
> > >>> On Tue, Oct 13, 2015 at 09:02:18AM +0100, Lee Jones wrote:
> > >>>> On Mon, 12 Oct 2015, Mark Brown wrote:
> > >>>>
> > >>>>> On Mon, Oct 12, 2015 at 09:45:54AM +0100, Charles Keepax wrote:
> > >>>>>> On Wed, Oct 07, 2015 at 01:26:42PM +0100, Lee Jones wrote:
> > >>>>>>> On Wed, 07 Oct 2015, Mark Brown wrote:
> > >> Now I know that jack detection is an Extcon thing and Extcon Ack will
> > >> do just nicely.  However, that begs the question; if they are an
> > >> Extcon thing, why aren't they in the Extcon binding document?
> > > 
> > > As I knew, the arizona-extcon is one device of the MFD devices 
> > > for WM series in the driver/mfd/arizona-core.c. So, If arizona-extcon
> > > driver needs the some property for dt support, some property should be
> > > included in MFD device tree node. There is no separate device tree node 
> > > for
> > > arizona-extcon driver.
> > 
> > If creating the separate extcon doc for extcon-arizona.c driver, it is 
> > possible
> > to make the child device tree node which is located at the below of arizona 
> > MFD
> > device tree node.
> > 
> > I agree about Lee's opinion to make the separate the Extcon doc for 
> > extcon-arizona.c.
> 
> This is how we normally document MFDs.  Extcon doesn't even need to
> have it's own child-node (it can if you want though -- it's however
> you want to represent it), you can just put something like this in the
> MFD binding doc:
> 
> Optional properties
> this  : Does this
> that  : Does that
> 
> Also any child device specific property:
>   GPIOSee: ../extcon/arizona.txt
>   Extcon  See: ../gpio/arizona.txt
> 
> Etc.  Or words to that effect.  See some other MFDs for examples.

More accident of history than anything else I will send a patch
to split the binding up into the seperate subsystems shortly.

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


Re: [PATCH v2 5/5] mfd: arizona: Update DT binding document for jack detection invert

2015-10-12 Thread Charles Keepax
On Mon, Oct 05, 2015 at 11:01:05AM +0100, Lee Jones wrote:
> On Fri, 02 Oct 2015, Charles Keepax wrote:
> 
> > Add additional binding for inverting the polarity of the detection on
> > the jack detection pins.
> > 
> > Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
> > ---
> >  Documentation/devicetree/bindings/mfd/arizona.txt |2 ++
> >  1 files changed, 2 insertions(+), 0 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt 
> > b/Documentation/devicetree/bindings/mfd/arizona.txt
> > index b98a11b..ef59696 100644
> > --- a/Documentation/devicetree/bindings/mfd/arizona.txt
> > +++ b/Documentation/devicetree/bindings/mfd/arizona.txt
> > @@ -73,6 +73,8 @@ Optional properties:
> >  If this node is not mentioned or if the value is unknown, then
> >  headphone detection mode is set to HPDETL.
> >  
> > +  - wlf,jd-invert : Invert the polarity of the jack detection switch
> > +
> 
> There are other jack detection properties in the bindings docs.
> 
> Please generify.

Apologies but not sure I follow what you want me to do here? Do
you just want me to drop the wlf, prefix on this one?

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


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

2015-10-12 Thread Charles Keepax
On Wed, Oct 07, 2015 at 01:26:42PM +0100, Lee Jones wrote:
> On Wed, 07 Oct 2015, Mark Brown wrote:
> 
> > On Fri, Oct 02, 2015 at 05:29:22PM +0100, Charles Keepax wrote:
> > > Add additional bindings to allow configuration of the system specific
> > > microphone detection settings.
> > 
> > This all seems pretty much fine to me - the things it is controlling are
> > fairly specific to the way the former Wolfson devices do, they only
> > really make sense with a fairly particular algorithm which isn't widely
> > implemented.
> 
> Is that an Ack?

I am guessing Mark is slightly hesitant to ack as he probably
doesn't want to add reviewing all our jack detection bindings to
his already fairly sizable work load and doing so here likely
means it will be expected in the future. From talking to people at
LinuxCon it looks like it is pretty unlikely the DT maintainers
will be acking individual bindings as well, basically they are
only really looking at major/framework things and leaving the
rest to subsystem maintainers.

Given that these patches only touch MFD/Extcon and extcon
is a subsystem designed to handle things like jack detection
isn't it really sufficient that you and Chanwoo have looked this
and are happy with it? Otherwise I really don't see anyway to
move this forward and would appreciate any suggestions?

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


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

2015-10-02 Thread 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.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
Acked-by: Chanwoo Choi <cw00.c...@samsung.com>
---
 drivers/extcon/extcon-arizona.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index a1ab0a5..6d2f5f3 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -1236,6 +1236,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;
 }
 
-- 
1.7.2.5

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


[PATCH v2 4/5] mfd: arizona: Update DT binding documentation for mic detection

2015-10-02 Thread Charles Keepax
Add additional bindings to allow configuration of the system specific
microphone detection settings.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
---
 Documentation/devicetree/bindings/mfd/arizona.txt |   21 +
 include/dt-bindings/mfd/arizona.h |5 +
 2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt 
b/Documentation/devicetree/bindings/mfd/arizona.txt
index a8fee60..b98a11b 100644
--- a/Documentation/devicetree/bindings/mfd/arizona.txt
+++ b/Documentation/devicetree/bindings/mfd/arizona.txt
@@ -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
diff --git a/include/dt-bindings/mfd/arizona.h 
b/include/dt-bindings/mfd/arizona.h
index c40f665..dedf46f 100644
--- a/include/dt-bindings/mfd/arizona.h
+++ b/include/dt-bindings/mfd/arizona.h
@@ -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
-- 
1.7.2.5

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


[PATCH v2 3/5] extcon: arizona: Add device binding for jack detect polarity inversion

2015-10-02 Thread 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.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
Acked-by: Chanwoo Choi <cw00.c...@samsung.com>
---
 drivers/extcon/extcon-arizona.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index e8dd19cb..58e4dc9 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -1239,6 +1239,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", >gpsw);
 
return 0;
-- 
1.7.2.5

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


[PATCH v2 5/5] mfd: arizona: Update DT binding document for jack detection invert

2015-10-02 Thread Charles Keepax
Add additional binding for inverting the polarity of the detection on
the jack detection pins.

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

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

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


[PATCH v2 0/5] Arizona Extcon Update Device Bindings

2015-10-02 Thread Charles Keepax
This patch chain adds device bindings for the jack and
microphone detection system specific settings.

Mark, I have added you on the chain as getting a DT ack is
proving challenging and Lee said he would appreciate your
opinion on these, hope that is ok. Note that some of the
changes backing the DT doc updates in the first of the two
MFD changes have already been merged hence why they are
not in this series.

Changes since v1:
 - I have removed the stuff for the second jack detect pin
   from the series. It seems that it will probably be better
   to get these bindings in first as I can't see anyway they
   could be contentious then we can deal with that and if it
   needs to be a pinmux/gpio thing later.

Thanks,
Charles

Charles Keepax (5):
  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
  mfd: arizona: Update DT binding documentation for mic detection
  mfd: arizona: Update DT binding document for jack detection invert

 Documentation/devicetree/bindings/mfd/arizona.txt |   23 +
 drivers/extcon/extcon-arizona.c   |8 +++
 include/dt-bindings/mfd/arizona.h |5 
 3 files changed, 36 insertions(+), 0 deletions(-)

-- 
1.7.2.5

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


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

2015-10-02 Thread 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.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
Acked-by: Chanwoo Choi <cw00.c...@samsung.com>
---
 drivers/extcon/extcon-arizona.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index 6d2f5f3..e8dd19cb 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -1239,6 +1239,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", >gpsw);
+
return 0;
 }
 
-- 
1.7.2.5

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


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

2015-09-25 Thread Charles Keepax
On Fri, Sep 25, 2015 at 09:54:26AM +0900, Chanwoo Choi wrote:
> 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 wm 
> 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 = "wm-arizona-extcon",
>   .data = (void *)wm_data;
>   }, 
> };
> 
> 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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2015-09-16 Thread 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.

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

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index 4479781..869a920 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -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;
 }
 
-- 
1.7.2.5

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


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

2015-09-16 Thread Charles Keepax
Add additional bindings to allow configuration of the system specific
microphone detection settings.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
---
 Documentation/devicetree/bindings/mfd/arizona.txt |   21 +
 include/dt-bindings/mfd/arizona.h |5 +
 2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt 
b/Documentation/devicetree/bindings/mfd/arizona.txt
index a8fee60..b98a11b 100644
--- a/Documentation/devicetree/bindings/mfd/arizona.txt
+++ b/Documentation/devicetree/bindings/mfd/arizona.txt
@@ -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
diff --git a/include/dt-bindings/mfd/arizona.h 
b/include/dt-bindings/mfd/arizona.h
index c40f665..dedf46f 100644
--- a/include/dt-bindings/mfd/arizona.h
+++ b/include/dt-bindings/mfd/arizona.h
@@ -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
-- 
1.7.2.5

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


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

2015-09-16 Thread 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.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
Reviewed-by: Chanwoo Choi <cw00.c...@samsung.com>
---
 Documentation/devicetree/bindings/mfd/arizona.txt |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt 
b/Documentation/devicetree/bindings/mfd/arizona.txt
index b98a11b..cb3a652 100644
--- a/Documentation/devicetree/bindings/mfd/arizona.txt
+++ b/Documentation/devicetree/bindings/mfd/arizona.txt
@@ -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
-- 
1.7.2.5

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


[PATCH 0/6] Arizona Extcon Update Device Bindings

2015-09-16 Thread Charles Keepax
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(-)

-- 
1.7.2.5

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


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

2015-09-16 Thread 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.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
Acked-by: Chanwoo Choi <cw00.c...@samsung.com>
---
 drivers/extcon/extcon-arizona.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index 5b4bc2f..dc1910d 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -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", >gpsw);
 
return 0;
-- 
1.7.2.5

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


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

2015-09-16 Thread 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.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
Acked-by: Chanwoo Choi <cw00.c...@samsung.com>
---
 drivers/extcon/extcon-arizona.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index dc1910d..992f80e 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -1235,6 +1235,11 @@ static int arizona_extcon_device_get_pdata(struct 
arizona *arizona)
 
device_property_read_u32(arizona->dev, "wlf,gpsw", >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;
 }
 
-- 
1.7.2.5

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


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

2015-09-16 Thread 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.

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

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index 869a920..5b4bc2f 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -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", >gpsw);
+
return 0;
 }
 
-- 
1.7.2.5

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


Re: [PATCH v3 1/6] mfd: arizona: Add TST_CAP bits for headphone detection

2015-09-15 Thread Charles Keepax
On Tue, Sep 15, 2015 at 01:05:07PM +0900, Chanwoo Choi wrote:
> Hi Charles,
> 
> Your following patch-set[1][2] receive the ack message about almost patches.
> But, a few patches[3][4][5] must need the ack message from each maintainer.
> [1] http://www.spinics.net/lists/devicetree/msg93383.html
> [2] https://lkml.org/lkml/2015/8/11/145
> [3] patch1 is included in patch-set[1]
> : [PATCH v3 1/6] mfd: arizona: Add TST_CAP bits for headphone detection
> [4] patch6 is included in patch-set[1]
> : [PATCH v2 6/6] mfd: arizona: Update DT binding documentation for jack 
> detection
> [5] patch5 is included in patch-set[2]
> [PATCH RESEND 5/5] mfd: arizona: Update DT doc for new mic detection bindings

:-) Getting a DT ack is not an easy thing, like gold dust those
are.

If we are going to make merging anything dependent on an ack from
the DT guys I will probably merge these two series of patches,
then resplit (and resend) them into changes that affect DT and
those that don't. That way at least we can get something in, as I
am starting to carry a fair backlog of changes on this one and it
reduces the amount of diff that the very busy DT guys will need
to look at.

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


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

2015-09-11 Thread 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.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
Acked-by: Chanwoo Choi <cw00.c...@samsung.com>
---

Changes since v1:
 - Added more description in the commit message

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

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index 34b5a3b..5fbe893 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -1233,6 +1233,11 @@ static int arizona_extcon_device_get_pdata(struct 
arizona *arizona)
 
device_property_read_u32(arizona->dev, "wlf,gpsw", >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;
 }
 
-- 
1.7.2.5

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


[PATCH v2 4/6] extcon: arizona: Add device binding for jack detect polarity inversion

2015-09-11 Thread 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.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
Acked-by: Chanwoo Choi <cw00.c...@samsung.com>
---

Changes since v1:
 - Added more description in the commit message

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

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index 6d030a0..34b5a3b 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -1228,6 +1228,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", >gpsw);
 
return 0;
-- 
1.7.2.5

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


[PATCH v2 3/6] extcon: arizona: Ignore jd_invert for MICD_CLAMP_STS

2015-09-11 Thread Charles Keepax
From: Nariman Poushin <nari...@opensource.wolfsonmicro.com>

The polarity of MICD_CLAMP_STS does not change when different clamp
modes are used, this patch corrects this issue.

Signed-off-by: Nariman Poushin <nari...@opensource.wolfsonmicro.com>
Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
Acked-by: Chanwoo Choi <cw00.c...@samsung.com>
---

No change since v1.

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

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index 7bfaacd..6d030a0 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -1059,10 +1059,7 @@ static irqreturn_t arizona_jackdet(int irq, void *data)
 
if (arizona->pdata.jd_gpio5) {
mask = ARIZONA_MICD_CLAMP_STS;
-   if (arizona->pdata.jd_invert)
-   present = ARIZONA_MICD_CLAMP_STS;
-   else
-   present = 0;
+   present = 0;
} else {
mask = ARIZONA_JD1_STS;
if (arizona->pdata.jd_invert)
-- 
1.7.2.5

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


Re: [PATCH v2 1/6] mfd: arizona: Add TST_CAP bits for headphone detection

2015-09-11 Thread Charles Keepax
On Fri, Sep 11, 2015 at 01:14:13PM +0100, Charles Keepax wrote:
> On Florida some additional settings are required to get accurate
> measurements at the top end of the headphone detection range. This patch
> adds the bits required for this.
> 
> Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
> Acked-by: Chanwoo Choi <cw00.c...@samsung.com>

Apologies Chanwoo's ack should not have been added to this patch.

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


[PATCH v2 2/6] extcon: arizona: Additional settings to improve accuracy of HP detect

2015-09-11 Thread Charles Keepax
If the TST_CAP_SEL bits aren't set correctly on wm5110/8280 there will
be a 100k load along side the headphones, which will affect the accurary
towards the very top of the detection range. This patch sets those bits.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
Acked-by: Chanwoo Choi <cw00.c...@samsung.com>
---

No change since v1.

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

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index b48fb29..7bfaacd 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -43,6 +43,9 @@
 #define ARIZONA_MICD_CLAMP_MODE_JDL_GP5H 0x9
 #define ARIZONA_MICD_CLAMP_MODE_JDH_GP5H 0xb
 
+#define ARIZONA_TST_CAP_DEFAULT 0x3
+#define ARIZONA_TST_CAP_CLAMP   0x1
+
 #define ARIZONA_HPDET_MAX 1
 
 #define HPDET_DEBOUNCE 500
@@ -147,6 +150,7 @@ static void arizona_extcon_hp_clamp(struct 
arizona_extcon_info *info,
 {
struct arizona *arizona = info->arizona;
unsigned int mask = 0, val = 0;
+   unsigned int cap_sel = 0;
int ret;
 
switch (arizona->type) {
@@ -154,10 +158,21 @@ static void arizona_extcon_hp_clamp(struct 
arizona_extcon_info *info,
case WM8280:
mask = ARIZONA_HP1L_SHRTO | ARIZONA_HP1L_FLWR |
   ARIZONA_HP1L_SHRTI;
-   if (clamp)
+   if (clamp) {
val = ARIZONA_HP1L_SHRTO;
-   else
+   cap_sel = ARIZONA_TST_CAP_CLAMP;
+   } else {
val = ARIZONA_HP1L_FLWR | ARIZONA_HP1L_SHRTI;
+   cap_sel = ARIZONA_TST_CAP_DEFAULT;
+   }
+
+   ret = regmap_update_bits(arizona->regmap,
+ARIZONA_HP_TEST_CTRL_1,
+ARIZONA_HP1_TST_CAP_SEL_MASK,
+cap_sel);
+   if (ret != 0)
+   dev_warn(arizona->dev,
+"Failed to set TST_CAP_SEL: %d\n", ret);
break;
default:
mask = ARIZONA_RMV_SHRT_HP1L;
-- 
1.7.2.5

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


[PATCH v2 1/6] mfd: arizona: Add TST_CAP bits for headphone detection

2015-09-11 Thread Charles Keepax
On Florida some additional settings are required to get accurate
measurements at the top end of the headphone detection range. This patch
adds the bits required for this.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
Acked-by: Chanwoo Choi <cw00.c...@samsung.com>
---

No change since v1.

 drivers/mfd/wm5110-tables.c   |2 ++
 include/linux/mfd/arizona/registers.h |8 
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/drivers/mfd/wm5110-tables.c b/drivers/mfd/wm5110-tables.c
index acb3bb2..78032e8 100644
--- a/drivers/mfd/wm5110-tables.c
+++ b/drivers/mfd/wm5110-tables.c
@@ -1908,6 +1908,7 @@ static bool wm5110_readable_register(struct device *dev, 
unsigned int reg)
case ARIZONA_HP1_SHORT_CIRCUIT_CTRL:
case ARIZONA_HP2_SHORT_CIRCUIT_CTRL:
case ARIZONA_HP3_SHORT_CIRCUIT_CTRL:
+   case ARIZONA_HP_TEST_CTRL_1:
case ARIZONA_AIF1_BCLK_CTRL:
case ARIZONA_AIF1_TX_PIN_CTRL:
case ARIZONA_AIF1_RX_PIN_CTRL:
@@ -2853,6 +2854,7 @@ static bool wm5110_volatile_register(struct device *dev, 
unsigned int reg)
case ARIZONA_INPUT_ENABLES_STATUS:
case ARIZONA_OUTPUT_STATUS_1:
case ARIZONA_RAW_OUTPUT_STATUS_1:
+   case ARIZONA_HP_TEST_CTRL_1:
case ARIZONA_SLIMBUS_RX_PORT_STATUS:
case ARIZONA_SLIMBUS_TX_PORT_STATUS:
case ARIZONA_INTERRUPT_STATUS_1:
diff --git a/include/linux/mfd/arizona/registers.h 
b/include/linux/mfd/arizona/registers.h
index e96644c..fe1b5d0 100644
--- a/include/linux/mfd/arizona/registers.h
+++ b/include/linux/mfd/arizona/registers.h
@@ -237,6 +237,7 @@
 #define ARIZONA_HP1_SHORT_CIRCUIT_CTRL   0x4A0
 #define ARIZONA_HP2_SHORT_CIRCUIT_CTRL   0x4A1
 #define ARIZONA_HP3_SHORT_CIRCUIT_CTRL   0x4A2
+#define ARIZONA_HP_TEST_CTRL_1   0x4A4
 #define ARIZONA_SPK_CTRL_2   0x4B5
 #define ARIZONA_SPK_CTRL_3   0x4B6
 #define ARIZONA_DAC_COMP_1   0x4DC
@@ -3548,6 +3549,13 @@
 #define ARIZONA_HP3_SC_ENA_WIDTH  1  /* HP3_SC_ENA */
 
 /*
+ * R1188 (0x4A4) HP Test Ctrl 1
+ */
+#define ARIZONA_HP1_TST_CAP_SEL_MASK 0x0003  /* HP1_TST_CAP_SEL - 
[1:0] */
+#define ARIZONA_HP1_TST_CAP_SEL_SHIFT 0  /* HP1_TST_CAP_SEL - 
[1:0] */
+#define ARIZONA_HP1_TST_CAP_SEL_WIDTH 2  /* HP1_TST_CAP_SEL - 
[1:0] */
+
+/*
  * R1244 (0x4DC) - DAC comp 1
  */
 #define ARIZONA_OUT_COMP_COEFF_MASK  0x  /* OUT_COMP_COEFF - 
[15:0] */
-- 
1.7.2.5

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


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

2015-09-11 Thread 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.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
Reviewed-by: Chanwoo Choi <cw00.c...@samsung.com>
---

Changes since v1:
 - Fixed minor typo

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

diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt 
b/Documentation/devicetree/bindings/mfd/arizona.txt
index b98a11b..cb3a652 100644
--- a/Documentation/devicetree/bindings/mfd/arizona.txt
+++ b/Documentation/devicetree/bindings/mfd/arizona.txt
@@ -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
-- 
1.7.2.5

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


[PATCH v3 1/6] mfd: arizona: Add TST_CAP bits for headphone detection

2015-09-11 Thread Charles Keepax
On Florida some additional settings are required to get accurate
measurements at the top end of the headphone detection range. This patch
adds the bits required for this.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
---

Changes since v2:
 - Removed accidental addition of Chanwoo's ack.

Thanks,
Charles

 drivers/mfd/wm5110-tables.c   |2 ++
 include/linux/mfd/arizona/registers.h |8 
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/drivers/mfd/wm5110-tables.c b/drivers/mfd/wm5110-tables.c
index acb3bb2..78032e8 100644
--- a/drivers/mfd/wm5110-tables.c
+++ b/drivers/mfd/wm5110-tables.c
@@ -1908,6 +1908,7 @@ static bool wm5110_readable_register(struct device *dev, 
unsigned int reg)
case ARIZONA_HP1_SHORT_CIRCUIT_CTRL:
case ARIZONA_HP2_SHORT_CIRCUIT_CTRL:
case ARIZONA_HP3_SHORT_CIRCUIT_CTRL:
+   case ARIZONA_HP_TEST_CTRL_1:
case ARIZONA_AIF1_BCLK_CTRL:
case ARIZONA_AIF1_TX_PIN_CTRL:
case ARIZONA_AIF1_RX_PIN_CTRL:
@@ -2853,6 +2854,7 @@ static bool wm5110_volatile_register(struct device *dev, 
unsigned int reg)
case ARIZONA_INPUT_ENABLES_STATUS:
case ARIZONA_OUTPUT_STATUS_1:
case ARIZONA_RAW_OUTPUT_STATUS_1:
+   case ARIZONA_HP_TEST_CTRL_1:
case ARIZONA_SLIMBUS_RX_PORT_STATUS:
case ARIZONA_SLIMBUS_TX_PORT_STATUS:
case ARIZONA_INTERRUPT_STATUS_1:
diff --git a/include/linux/mfd/arizona/registers.h 
b/include/linux/mfd/arizona/registers.h
index e96644c..fe1b5d0 100644
--- a/include/linux/mfd/arizona/registers.h
+++ b/include/linux/mfd/arizona/registers.h
@@ -237,6 +237,7 @@
 #define ARIZONA_HP1_SHORT_CIRCUIT_CTRL   0x4A0
 #define ARIZONA_HP2_SHORT_CIRCUIT_CTRL   0x4A1
 #define ARIZONA_HP3_SHORT_CIRCUIT_CTRL   0x4A2
+#define ARIZONA_HP_TEST_CTRL_1   0x4A4
 #define ARIZONA_SPK_CTRL_2   0x4B5
 #define ARIZONA_SPK_CTRL_3   0x4B6
 #define ARIZONA_DAC_COMP_1   0x4DC
@@ -3548,6 +3549,13 @@
 #define ARIZONA_HP3_SC_ENA_WIDTH  1  /* HP3_SC_ENA */
 
 /*
+ * R1188 (0x4A4) HP Test Ctrl 1
+ */
+#define ARIZONA_HP1_TST_CAP_SEL_MASK 0x0003  /* HP1_TST_CAP_SEL - 
[1:0] */
+#define ARIZONA_HP1_TST_CAP_SEL_SHIFT 0  /* HP1_TST_CAP_SEL - 
[1:0] */
+#define ARIZONA_HP1_TST_CAP_SEL_WIDTH 2  /* HP1_TST_CAP_SEL - 
[1:0] */
+
+/*
  * R1244 (0x4DC) - DAC comp 1
  */
 #define ARIZONA_OUT_COMP_COEFF_MASK  0x  /* OUT_COMP_COEFF - 
[15:0] */
-- 
1.7.2.5

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


[PATCH 2/6] extcon: arizona: Additional settings to improve accuracy of HP detect

2015-09-10 Thread Charles Keepax
If the TST_CAP_SEL bits aren't set correctly on wm5110/8280 there will
be a 100k load along side the headphones, which will affect the accurary
towards the very top of the detection range. This patch sets those bits.

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

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index b48fb29..7bfaacd 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -43,6 +43,9 @@
 #define ARIZONA_MICD_CLAMP_MODE_JDL_GP5H 0x9
 #define ARIZONA_MICD_CLAMP_MODE_JDH_GP5H 0xb
 
+#define ARIZONA_TST_CAP_DEFAULT 0x3
+#define ARIZONA_TST_CAP_CLAMP   0x1
+
 #define ARIZONA_HPDET_MAX 1
 
 #define HPDET_DEBOUNCE 500
@@ -147,6 +150,7 @@ static void arizona_extcon_hp_clamp(struct 
arizona_extcon_info *info,
 {
struct arizona *arizona = info->arizona;
unsigned int mask = 0, val = 0;
+   unsigned int cap_sel = 0;
int ret;
 
switch (arizona->type) {
@@ -154,10 +158,21 @@ static void arizona_extcon_hp_clamp(struct 
arizona_extcon_info *info,
case WM8280:
mask = ARIZONA_HP1L_SHRTO | ARIZONA_HP1L_FLWR |
   ARIZONA_HP1L_SHRTI;
-   if (clamp)
+   if (clamp) {
val = ARIZONA_HP1L_SHRTO;
-   else
+   cap_sel = ARIZONA_TST_CAP_CLAMP;
+   } else {
val = ARIZONA_HP1L_FLWR | ARIZONA_HP1L_SHRTI;
+   cap_sel = ARIZONA_TST_CAP_DEFAULT;
+   }
+
+   ret = regmap_update_bits(arizona->regmap,
+ARIZONA_HP_TEST_CTRL_1,
+ARIZONA_HP1_TST_CAP_SEL_MASK,
+cap_sel);
+   if (ret != 0)
+   dev_warn(arizona->dev,
+"Failed to set TST_CAP_SEL: %d\n", ret);
break;
default:
mask = ARIZONA_RMV_SHRT_HP1L;
-- 
1.7.2.5

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


[PATCH 4/6] extcon: arizona: Add device binding for jack detect polarity inversion

2015-09-10 Thread Charles Keepax
Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
---
 drivers/extcon/extcon-arizona.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index 6d030a0..34b5a3b 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -1228,6 +1228,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", >gpsw);
 
return 0;
-- 
1.7.2.5

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


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

2015-09-10 Thread Charles Keepax
Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
---
 drivers/extcon/extcon-arizona.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index 34b5a3b..5fbe893 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -1233,6 +1233,11 @@ static int arizona_extcon_device_get_pdata(struct 
arizona *arizona)
 
device_property_read_u32(arizona->dev, "wlf,gpsw", >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;
 }
 
-- 
1.7.2.5

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


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

2015-09-10 Thread 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.

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

diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt 
b/Documentation/devicetree/bindings/mfd/arizona.txt
index b98a11b..48bca6a 100644
--- a/Documentation/devicetree/bindings/mfd/arizona.txt
+++ b/Documentation/devicetree/bindings/mfd/arizona.txt
@@ -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 alongwith 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
-- 
1.7.2.5

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


[PATCH 1/6] mfd: arizona: Add TST_CAP bits for headphone detection

2015-09-10 Thread Charles Keepax
On Florida some additional settings are required to get accurate
measurements at the top end of the headphone detection range. This patch
adds the bits required for this.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
---
 drivers/mfd/wm5110-tables.c   |2 ++
 include/linux/mfd/arizona/registers.h |8 
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/drivers/mfd/wm5110-tables.c b/drivers/mfd/wm5110-tables.c
index acb3bb2..78032e8 100644
--- a/drivers/mfd/wm5110-tables.c
+++ b/drivers/mfd/wm5110-tables.c
@@ -1908,6 +1908,7 @@ static bool wm5110_readable_register(struct device *dev, 
unsigned int reg)
case ARIZONA_HP1_SHORT_CIRCUIT_CTRL:
case ARIZONA_HP2_SHORT_CIRCUIT_CTRL:
case ARIZONA_HP3_SHORT_CIRCUIT_CTRL:
+   case ARIZONA_HP_TEST_CTRL_1:
case ARIZONA_AIF1_BCLK_CTRL:
case ARIZONA_AIF1_TX_PIN_CTRL:
case ARIZONA_AIF1_RX_PIN_CTRL:
@@ -2853,6 +2854,7 @@ static bool wm5110_volatile_register(struct device *dev, 
unsigned int reg)
case ARIZONA_INPUT_ENABLES_STATUS:
case ARIZONA_OUTPUT_STATUS_1:
case ARIZONA_RAW_OUTPUT_STATUS_1:
+   case ARIZONA_HP_TEST_CTRL_1:
case ARIZONA_SLIMBUS_RX_PORT_STATUS:
case ARIZONA_SLIMBUS_TX_PORT_STATUS:
case ARIZONA_INTERRUPT_STATUS_1:
diff --git a/include/linux/mfd/arizona/registers.h 
b/include/linux/mfd/arizona/registers.h
index e96644c..fe1b5d0 100644
--- a/include/linux/mfd/arizona/registers.h
+++ b/include/linux/mfd/arizona/registers.h
@@ -237,6 +237,7 @@
 #define ARIZONA_HP1_SHORT_CIRCUIT_CTRL   0x4A0
 #define ARIZONA_HP2_SHORT_CIRCUIT_CTRL   0x4A1
 #define ARIZONA_HP3_SHORT_CIRCUIT_CTRL   0x4A2
+#define ARIZONA_HP_TEST_CTRL_1   0x4A4
 #define ARIZONA_SPK_CTRL_2   0x4B5
 #define ARIZONA_SPK_CTRL_3   0x4B6
 #define ARIZONA_DAC_COMP_1   0x4DC
@@ -3548,6 +3549,13 @@
 #define ARIZONA_HP3_SC_ENA_WIDTH  1  /* HP3_SC_ENA */
 
 /*
+ * R1188 (0x4A4) HP Test Ctrl 1
+ */
+#define ARIZONA_HP1_TST_CAP_SEL_MASK 0x0003  /* HP1_TST_CAP_SEL - 
[1:0] */
+#define ARIZONA_HP1_TST_CAP_SEL_SHIFT 0  /* HP1_TST_CAP_SEL - 
[1:0] */
+#define ARIZONA_HP1_TST_CAP_SEL_WIDTH 2  /* HP1_TST_CAP_SEL - 
[1:0] */
+
+/*
  * R1244 (0x4DC) - DAC comp 1
  */
 #define ARIZONA_OUT_COMP_COEFF_MASK  0x  /* OUT_COMP_COEFF - 
[15:0] */
-- 
1.7.2.5

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


[PATCH 3/6] extcon: arizona: Ignore jd_invert for MICD_CLAMP_STS

2015-09-10 Thread Charles Keepax
From: Nariman Poushin <nari...@opensource.wolfsonmicro.com>

The polarity of MICD_CLAMP_STS does not change when different clamp
modes are used, this patch corrects this issue.

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

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index 7bfaacd..6d030a0 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -1059,10 +1059,7 @@ static irqreturn_t arizona_jackdet(int irq, void *data)
 
if (arizona->pdata.jd_gpio5) {
mask = ARIZONA_MICD_CLAMP_STS;
-   if (arizona->pdata.jd_invert)
-   present = ARIZONA_MICD_CLAMP_STS;
-   else
-   present = 0;
+   present = 0;
} else {
mask = ARIZONA_JD1_STS;
if (arizona->pdata.jd_invert)
-- 
1.7.2.5

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


[PATCH RESEND 1/5] mfd: arizona: Add registers for ADC microphone detection

2015-09-09 Thread Charles Keepax
The newer devices support using a software comparison to determine
whether a 3/4 pole jack is present. Add the registers necessary for
this.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
Acked-by: Lee Jones <lee.jo...@linaro.org>
---
 drivers/mfd/wm5110-tables.c   |2 ++
 include/dt-bindings/mfd/arizona.h |2 ++
 include/linux/mfd/arizona/pdata.h |3 +++
 include/linux/mfd/arizona/registers.h |   17 ++---
 4 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/drivers/mfd/wm5110-tables.c b/drivers/mfd/wm5110-tables.c
index 12cad94..dd27872 100644
--- a/drivers/mfd/wm5110-tables.c
+++ b/drivers/mfd/wm5110-tables.c
@@ -1807,6 +1807,7 @@ static bool wm5110_readable_register(struct device *dev, 
unsigned int reg)
case ARIZONA_MIC_DETECT_1:
case ARIZONA_MIC_DETECT_2:
case ARIZONA_MIC_DETECT_3:
+   case ARIZONA_MIC_DETECT_4:
case ARIZONA_MIC_DETECT_LEVEL_1:
case ARIZONA_MIC_DETECT_LEVEL_2:
case ARIZONA_MIC_DETECT_LEVEL_3:
@@ -2843,6 +2844,7 @@ static bool wm5110_volatile_register(struct device *dev, 
unsigned int reg)
case ARIZONA_ASYNC_SAMPLE_RATE_1_STATUS:
case ARIZONA_ASYNC_SAMPLE_RATE_2_STATUS:
case ARIZONA_MIC_DETECT_3:
+   case ARIZONA_MIC_DETECT_4:
case ARIZONA_HP_CTRL_1L:
case ARIZONA_HP_CTRL_1R:
case ARIZONA_HEADPHONE_DETECT_2:
diff --git a/include/dt-bindings/mfd/arizona.h 
b/include/dt-bindings/mfd/arizona.h
index 7b2000c..c40f665 100644
--- a/include/dt-bindings/mfd/arizona.h
+++ b/include/dt-bindings/mfd/arizona.h
@@ -107,5 +107,7 @@
 #define ARIZONA_ACCDET_MODE_MIC 0
 #define ARIZONA_ACCDET_MODE_HPL 1
 #define ARIZONA_ACCDET_MODE_HPR 2
+#define ARIZONA_ACCDET_MODE_HPM 4
+#define ARIZONA_ACCDET_MODE_ADC 7
 
 #endif
diff --git a/include/linux/mfd/arizona/pdata.h 
b/include/linux/mfd/arizona/pdata.h
index 43db4fa..f030a32 100644
--- a/include/linux/mfd/arizona/pdata.h
+++ b/include/linux/mfd/arizona/pdata.h
@@ -124,6 +124,9 @@ struct arizona_pdata {
/** Channel to use for headphone detection */
unsigned int hpdet_channel;
 
+   /** Use software comparison to determine mic presence */
+   bool micd_software_compare;
+
/** Extra debounce timeout used during initial mic detection (ms) */
int micd_detect_debounce;
 
diff --git a/include/linux/mfd/arizona/registers.h 
b/include/linux/mfd/arizona/registers.h
index 3499d36..3f3bb2b 100644
--- a/include/linux/mfd/arizona/registers.h
+++ b/include/linux/mfd/arizona/registers.h
@@ -139,6 +139,7 @@
 #define ARIZONA_MIC_DETECT_LEVEL_2  0x2A7
 #define ARIZONA_MIC_DETECT_LEVEL_3  0x2A8
 #define ARIZONA_MIC_DETECT_LEVEL_4  0x2A9
+#define ARIZONA_MIC_DETECT_4 0x2AB
 #define ARIZONA_MIC_NOISE_MIX_CONTROL_1  0x2C3
 #define ARIZONA_ISOLATION_CONTROL0x2CB
 #define ARIZONA_JACK_DETECT_ANALOGUE 0x2D3
@@ -2301,9 +2302,9 @@
 #define ARIZONA_ACCDET_SRC_MASK  0x2000  /* ACCDET_SRC */
 #define ARIZONA_ACCDET_SRC_SHIFT 13  /* ACCDET_SRC */
 #define ARIZONA_ACCDET_SRC_WIDTH  1  /* ACCDET_SRC */
-#define ARIZONA_ACCDET_MODE_MASK 0x0003  /* ACCDET_MODE - 
[1:0] */
-#define ARIZONA_ACCDET_MODE_SHIFT 0  /* ACCDET_MODE - 
[1:0] */
-#define ARIZONA_ACCDET_MODE_WIDTH 2  /* ACCDET_MODE - 
[1:0] */
+#define ARIZONA_ACCDET_MODE_MASK 0x0007  /* ACCDET_MODE - 
[2:0] */
+#define ARIZONA_ACCDET_MODE_SHIFT 0  /* ACCDET_MODE - 
[2:0] */
+#define ARIZONA_ACCDET_MODE_WIDTH 3  /* ACCDET_MODE - 
[2:0] */
 
 /*
  * R667 (0x29B) - Headphone Detect 1
@@ -2413,6 +2414,16 @@
 #define ARIZONA_MICD_STS_WIDTH1  /* MICD_STS */
 
 /*
+ * R683 (0x2AB) - Mic Detect 4
+ */
+#define ARIZONA_MICDET_ADCVAL_DIFF_MASK  0xFF00  /* MICDET_ADCVAL_DIFF 
- [15:8] */
+#define ARIZONA_MICDET_ADCVAL_DIFF_SHIFT  8  /* MICDET_ADCVAL_DIFF 
- [15:8] */
+#define ARIZONA_MICDET_ADCVAL_DIFF_WIDTH  8  /* MICDET_ADCVAL_DIFF 
- [15:8] */
+#define ARIZONA_MICDET_ADCVAL_MASK   0x007F  /* MICDET_ADCVAL - 
[15:8] */
+#define ARIZONA_MICDET_ADCVAL_SHIFT   0  /* MICDET_ADCVAL - 
[15:8] */
+#define ARIZONA_MICDET_ADCVAL_WIDTH   7  /* MICDET_ADCVAL - 
[15:8] */
+
+/*
  * R707 (0x2C3) - Mic noise mix control 1
  */
 #define ARIZONA_MICMUTE_RATE_MASK0x7800  /* MICMUTE_RATE - 
[14:11] */
-- 
1.7.2.5

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


[PATCH RESEND 3/5] mfd: arizona: Add register bits for general purpose switch

2015-09-09 Thread Charles Keepax
The switch is typically used in conjunction with the MICDET clamp in
order to suppress pops and clicks associated with jack insertion.

Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
Acked-by: Lee Jones <lee.jo...@linaro.org>
---
 drivers/mfd/wm5110-tables.c   |2 ++
 include/linux/mfd/arizona/pdata.h |3 +++
 include/linux/mfd/arizona/registers.h |8 
 3 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/drivers/mfd/wm5110-tables.c b/drivers/mfd/wm5110-tables.c
index dd27872..acb3bb2 100644
--- a/drivers/mfd/wm5110-tables.c
+++ b/drivers/mfd/wm5110-tables.c
@@ -1472,6 +1472,7 @@ static const struct reg_default wm5110_reg_default[] = {
{ 0x0C04, 0xA101 },/* R3076  - GPIO5 CTRL */
{ 0x0C0F, 0x0400 },/* R3087  - IRQ CTRL 1 */
{ 0x0C10, 0x1000 },/* R3088  - GPIO Debounce Config */
+   { 0x0C18, 0x },/* R3096  - GP Switch 1 */
{ 0x0C20, 0x8002 },/* R3104  - Misc Pad Ctrl 1 */
{ 0x0C21, 0x8001 },/* R3105  - Misc Pad Ctrl 2 */
{ 0x0C22, 0x },/* R3106  - Misc Pad Ctrl 3 */
@@ -2524,6 +2525,7 @@ static bool wm5110_readable_register(struct device *dev, 
unsigned int reg)
case ARIZONA_GPIO5_CTRL:
case ARIZONA_IRQ_CTRL_1:
case ARIZONA_GPIO_DEBOUNCE_CONFIG:
+   case ARIZONA_GP_SWITCH_1:
case ARIZONA_MISC_PAD_CTRL_1:
case ARIZONA_MISC_PAD_CTRL_2:
case ARIZONA_MISC_PAD_CTRL_3:
diff --git a/include/linux/mfd/arizona/pdata.h 
b/include/linux/mfd/arizona/pdata.h
index f030a32..e76577b 100644
--- a/include/linux/mfd/arizona/pdata.h
+++ b/include/linux/mfd/arizona/pdata.h
@@ -182,6 +182,9 @@ struct arizona_pdata {
 
/** GPIO for primary IRQ (used for edge triggered emulation) */
int irq_gpio;
+
+   /** General purpose switch control */
+   unsigned int gpsw;
 };
 
 #endif
diff --git a/include/linux/mfd/arizona/registers.h 
b/include/linux/mfd/arizona/registers.h
index 3f3bb2b..e96644c 100644
--- a/include/linux/mfd/arizona/registers.h
+++ b/include/linux/mfd/arizona/registers.h
@@ -869,6 +869,7 @@
 #define ARIZONA_GPIO5_CTRL   0xC04
 #define ARIZONA_IRQ_CTRL_1   0xC0F
 #define ARIZONA_GPIO_DEBOUNCE_CONFIG 0xC10
+#define ARIZONA_GP_SWITCH_1  0xC18
 #define ARIZONA_MISC_PAD_CTRL_1  0xC20
 #define ARIZONA_MISC_PAD_CTRL_2  0xC21
 #define ARIZONA_MISC_PAD_CTRL_3  0xC22
@@ -4573,6 +4574,13 @@
 #define ARIZONA_GP_DBTIME_WIDTH   4  /* GP_DBTIME - 
[15:12] */
 
 /*
+ * R3096 (0xC18) - GP Switch 1
+ */
+#define ARIZONA_SW1_MODE_MASK0x0003  /* SW1_MODE - [1:0] */
+#define ARIZONA_SW1_MODE_SHIFT0  /* SW1_MODE - [1:0] */
+#define ARIZONA_SW1_MODE_WIDTH2  /* SW1_MODE - [1:0] */
+
+/*
  * R3104 (0xC20) - Misc Pad Ctrl 1
  */
 #define ARIZONA_LDO1ENA_PD   0x8000  /* LDO1ENA_PD */
-- 
1.7.2.5

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


[PATCH RESEND 2/5] extcon: arizona: Add support for new ADC value headphone detect

2015-09-09 Thread Charles Keepax
Newer devices give users the option to make the 3/4 pole jack
determination using a software comparison rather than a hardware one.
This patch adds support for this functionality.

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

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index 4b9f09c..f372156 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -48,6 +48,10 @@
 #define HPDET_DEBOUNCE 500
 #define DEFAULT_MICD_TIMEOUT 2000
 
+#define QUICK_HEADPHONE_MAX_OHM 3
+#define MICROPHONE_MIN_OHM  1257
+#define MICROPHONE_MAX_OHM  3
+
 #define MICD_DBTIME_TWO_READINGS 2
 #define MICD_DBTIME_FOUR_READINGS 4
 
@@ -117,12 +121,15 @@ static const struct arizona_micd_range 
micd_default_ranges[] = {
{ .max = 430, .key = BTN_5 },
 };
 
+/* The number of levels in arizona_micd_levels valid for button thresholds */
+#define ARIZONA_NUM_MICD_BUTTON_LEVELS 64
+
 static const int arizona_micd_levels[] = {
3, 6, 8, 11, 13, 16, 18, 21, 23, 26, 28, 31, 34, 36, 39, 41, 44, 46,
49, 52, 54, 57, 60, 62, 65, 67, 70, 73, 75, 78, 81, 83, 89, 94, 100,
105, 111, 116, 122, 127, 139, 150, 161, 173, 186, 196, 209, 220, 245,
270, 295, 321, 348, 375, 402, 430, 489, 550, 614, 681, 752, 903, 1071,
-   1257,
+   1257, 3,
 };
 
 static const unsigned int arizona_cable[] = {
@@ -270,6 +277,7 @@ static void arizona_start_mic(struct arizona_extcon_info 
*info)
struct arizona *arizona = info->arizona;
bool change;
int ret;
+   unsigned int mode;
 
/* Microphone detection can't use idle mode */
pm_runtime_get(info->dev);
@@ -295,9 +303,14 @@ static void arizona_start_mic(struct arizona_extcon_info 
*info)
regmap_write(arizona->regmap, 0x80, 0x0);
}
 
+   if (info->detecting && arizona->pdata.micd_software_compare)
+   mode = ARIZONA_ACCDET_MODE_ADC;
+   else
+   mode = ARIZONA_ACCDET_MODE_MIC;
+
regmap_update_bits(arizona->regmap,
   ARIZONA_ACCESSORY_DETECT_MODE_1,
-  ARIZONA_ACCDET_MODE_MASK, ARIZONA_ACCDET_MODE_MIC);
+  ARIZONA_ACCDET_MODE_MASK, mode);
 
arizona_extcon_pulse_micbias(info);
 
@@ -804,6 +817,37 @@ static void arizona_micd_detect(struct work_struct *work)
return;
}
 
+   if (info->detecting && arizona->pdata.micd_software_compare) {
+   /* Must disable MICD before we read the ADCVAL */
+   regmap_update_bits(arizona->regmap, ARIZONA_MIC_DETECT_1,
+  ARIZONA_MICD_ENA, 0);
+   ret = regmap_read(arizona->regmap, ARIZONA_MIC_DETECT_4, );
+   if (ret != 0) {
+   dev_err(arizona->dev,
+   "Failed to read MICDET_ADCVAL: %d\n",
+   ret);
+   mutex_unlock(>lock);
+   return;
+   }
+
+   dev_dbg(arizona->dev, "MICDET_ADCVAL: %x\n", val);
+
+   val &= ARIZONA_MICDET_ADCVAL_MASK;
+   if (val < ARRAY_SIZE(arizona_micd_levels))
+   val = arizona_micd_levels[val];
+   else
+   val = INT_MAX;
+
+   if (val <= QUICK_HEADPHONE_MAX_OHM)
+   val = ARIZONA_MICD_STS | ARIZONA_MICD_LVL_0;
+   else if (val <= MICROPHONE_MIN_OHM)
+   val = ARIZONA_MICD_STS | ARIZONA_MICD_LVL_1;
+   else if (val <= MICROPHONE_MAX_OHM)
+   val = ARIZONA_MICD_STS | ARIZONA_MICD_LVL_8;
+   else
+   val = ARIZONA_MICD_LVL_8;
+   }
+
for (i = 0; i < 10 && !(val & MICD_LVL_0_TO_8); i++) {
ret = regmap_read(arizona->regmap, ARIZONA_MIC_DETECT_3, );
if (ret != 0) {
@@ -932,10 +976,17 @@ static void arizona_micd_detect(struct work_struct *work)
}
 
 handled:
-   if (info->detecting)
+   if (info->detecting) {
+   if (arizona->pdata.micd_software_compare)
+   regmap_update_bits(arizona->regmap,
+  ARIZONA_MIC_DETECT_1,
+  ARIZONA_MICD_ENA,
+  ARIZONA_MICD_ENA);
+
queue_delayed_work(system_power_efficient_wq,
   >micd_timeout_work,
   msecs_to_jiffies(info->micd_timeout));
+   }
 
pm_runtime_mark_last_busy(info->dev);
mutex_unl

[PATCH RESEND 4/5] extcon: arizona: Add support for general purpose switch

2015-09-09 Thread Charles Keepax
The switch is typically used in conjunction with the MICDET clamp in
order to suppress pops and clicks associated with jack insertion.

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

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index f372156..b48fb29 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -1216,6 +1216,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", >gpsw);
+
return 0;
 }
 
@@ -1313,6 +1315,10 @@ static int arizona_extcon_probe(struct platform_device 
*pdev)
info->micd_num_modes = ARRAY_SIZE(micd_default_modes);
}
 
+   if (arizona->pdata.gpsw > 0)
+   regmap_update_bits(arizona->regmap, ARIZONA_GP_SWITCH_1,
+   ARIZONA_SW1_MODE_MASK, arizona->pdata.gpsw);
+
if (arizona->pdata.micd_pol_gpio > 0) {
if (info->micd_modes[0].gpio)
mode = GPIOF_OUT_INIT_HIGH;
-- 
1.7.2.5

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


[PATCH RESEND 5/5] mfd: arizona: Update DT doc for new mic detection bindings

2015-09-09 Thread Charles Keepax
Signed-off-by: Charles Keepax <ckee...@opensource.wolfsonmicro.com>
---
 Documentation/devicetree/bindings/mfd/arizona.txt |   21 +
 include/dt-bindings/mfd/arizona.h |5 +
 2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt 
b/Documentation/devicetree/bindings/mfd/arizona.txt
index a8fee60..b98a11b 100644
--- a/Documentation/devicetree/bindings/mfd/arizona.txt
+++ b/Documentation/devicetree/bindings/mfd/arizona.txt
@@ -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
diff --git a/include/dt-bindings/mfd/arizona.h 
b/include/dt-bindings/mfd/arizona.h
index c40f665..dedf46f 100644
--- a/include/dt-bindings/mfd/arizona.h
+++ b/include/dt-bindings/mfd/arizona.h
@@ -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
-- 
1.7.2.5

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


[PATCH RESEND 5/5] mfd: arizona: Update DT doc for new mic detection bindings

2015-08-11 Thread Charles Keepax
Signed-off-by: Charles Keepax ckee...@opensource.wolfsonmicro.com
---
 Documentation/devicetree/bindings/mfd/arizona.txt |   21 +
 include/dt-bindings/mfd/arizona.h |5 +
 2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt 
b/Documentation/devicetree/bindings/mfd/arizona.txt
index a8fee60..b98a11b 100644
--- a/Documentation/devicetree/bindings/mfd/arizona.txt
+++ b/Documentation/devicetree/bindings/mfd/arizona.txt
@@ -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
diff --git a/include/dt-bindings/mfd/arizona.h 
b/include/dt-bindings/mfd/arizona.h
index c40f665..dedf46f 100644
--- a/include/dt-bindings/mfd/arizona.h
+++ b/include/dt-bindings/mfd/arizona.h
@@ -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
-- 
1.7.2.5

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


[PATCH RESEND 2/5] extcon: arizona: Add support for new ADC value headphone detect

2015-08-11 Thread Charles Keepax
Newer devices give users the option to make the 3/4 pole jack
determination using a software comparison rather than a hardware one.
This patch adds support for this functionality.

Signed-off-by: Charles Keepax ckee...@opensource.wolfsonmicro.com
---
 drivers/extcon/extcon-arizona.c |   67 +++---
 1 files changed, 61 insertions(+), 6 deletions(-)

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index 4b9f09c..f372156 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -48,6 +48,10 @@
 #define HPDET_DEBOUNCE 500
 #define DEFAULT_MICD_TIMEOUT 2000
 
+#define QUICK_HEADPHONE_MAX_OHM 3
+#define MICROPHONE_MIN_OHM  1257
+#define MICROPHONE_MAX_OHM  3
+
 #define MICD_DBTIME_TWO_READINGS 2
 #define MICD_DBTIME_FOUR_READINGS 4
 
@@ -117,12 +121,15 @@ static const struct arizona_micd_range 
micd_default_ranges[] = {
{ .max = 430, .key = BTN_5 },
 };
 
+/* The number of levels in arizona_micd_levels valid for button thresholds */
+#define ARIZONA_NUM_MICD_BUTTON_LEVELS 64
+
 static const int arizona_micd_levels[] = {
3, 6, 8, 11, 13, 16, 18, 21, 23, 26, 28, 31, 34, 36, 39, 41, 44, 46,
49, 52, 54, 57, 60, 62, 65, 67, 70, 73, 75, 78, 81, 83, 89, 94, 100,
105, 111, 116, 122, 127, 139, 150, 161, 173, 186, 196, 209, 220, 245,
270, 295, 321, 348, 375, 402, 430, 489, 550, 614, 681, 752, 903, 1071,
-   1257,
+   1257, 3,
 };
 
 static const unsigned int arizona_cable[] = {
@@ -270,6 +277,7 @@ static void arizona_start_mic(struct arizona_extcon_info 
*info)
struct arizona *arizona = info-arizona;
bool change;
int ret;
+   unsigned int mode;
 
/* Microphone detection can't use idle mode */
pm_runtime_get(info-dev);
@@ -295,9 +303,14 @@ static void arizona_start_mic(struct arizona_extcon_info 
*info)
regmap_write(arizona-regmap, 0x80, 0x0);
}
 
+   if (info-detecting  arizona-pdata.micd_software_compare)
+   mode = ARIZONA_ACCDET_MODE_ADC;
+   else
+   mode = ARIZONA_ACCDET_MODE_MIC;
+
regmap_update_bits(arizona-regmap,
   ARIZONA_ACCESSORY_DETECT_MODE_1,
-  ARIZONA_ACCDET_MODE_MASK, ARIZONA_ACCDET_MODE_MIC);
+  ARIZONA_ACCDET_MODE_MASK, mode);
 
arizona_extcon_pulse_micbias(info);
 
@@ -804,6 +817,37 @@ static void arizona_micd_detect(struct work_struct *work)
return;
}
 
+   if (info-detecting  arizona-pdata.micd_software_compare) {
+   /* Must disable MICD before we read the ADCVAL */
+   regmap_update_bits(arizona-regmap, ARIZONA_MIC_DETECT_1,
+  ARIZONA_MICD_ENA, 0);
+   ret = regmap_read(arizona-regmap, ARIZONA_MIC_DETECT_4, val);
+   if (ret != 0) {
+   dev_err(arizona-dev,
+   Failed to read MICDET_ADCVAL: %d\n,
+   ret);
+   mutex_unlock(info-lock);
+   return;
+   }
+
+   dev_dbg(arizona-dev, MICDET_ADCVAL: %x\n, val);
+
+   val = ARIZONA_MICDET_ADCVAL_MASK;
+   if (val  ARRAY_SIZE(arizona_micd_levels))
+   val = arizona_micd_levels[val];
+   else
+   val = INT_MAX;
+
+   if (val = QUICK_HEADPHONE_MAX_OHM)
+   val = ARIZONA_MICD_STS | ARIZONA_MICD_LVL_0;
+   else if (val = MICROPHONE_MIN_OHM)
+   val = ARIZONA_MICD_STS | ARIZONA_MICD_LVL_1;
+   else if (val = MICROPHONE_MAX_OHM)
+   val = ARIZONA_MICD_STS | ARIZONA_MICD_LVL_8;
+   else
+   val = ARIZONA_MICD_LVL_8;
+   }
+
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) {
@@ -932,10 +976,17 @@ static void arizona_micd_detect(struct work_struct *work)
}
 
 handled:
-   if (info-detecting)
+   if (info-detecting) {
+   if (arizona-pdata.micd_software_compare)
+   regmap_update_bits(arizona-regmap,
+  ARIZONA_MIC_DETECT_1,
+  ARIZONA_MICD_ENA,
+  ARIZONA_MICD_ENA);
+
queue_delayed_work(system_power_efficient_wq,
   info-micd_timeout_work,
   msecs_to_jiffies(info-micd_timeout));
+   }
 
pm_runtime_mark_last_busy(info-dev);
mutex_unlock(info-lock);
@@ -1162,6 +1213,9 @@ static int arizona_extcon_device_get_pdata(struct arizona 
*arizona)
pdata-micd_force_micbias = device_property_read_bool

[PATCH RESEND 3/5] mfd: arizona: Add register bits for general purpose switch

2015-08-11 Thread Charles Keepax
The switch is typically used in conjunction with the MICDET clamp in
order to suppress pops and clicks associated with jack insertion.

Signed-off-by: Charles Keepax ckee...@opensource.wolfsonmicro.com
---
 drivers/mfd/wm5110-tables.c   |2 ++
 include/linux/mfd/arizona/pdata.h |3 +++
 include/linux/mfd/arizona/registers.h |8 
 3 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/drivers/mfd/wm5110-tables.c b/drivers/mfd/wm5110-tables.c
index dd27872..acb3bb2 100644
--- a/drivers/mfd/wm5110-tables.c
+++ b/drivers/mfd/wm5110-tables.c
@@ -1472,6 +1472,7 @@ static const struct reg_default wm5110_reg_default[] = {
{ 0x0C04, 0xA101 },/* R3076  - GPIO5 CTRL */
{ 0x0C0F, 0x0400 },/* R3087  - IRQ CTRL 1 */
{ 0x0C10, 0x1000 },/* R3088  - GPIO Debounce Config */
+   { 0x0C18, 0x },/* R3096  - GP Switch 1 */
{ 0x0C20, 0x8002 },/* R3104  - Misc Pad Ctrl 1 */
{ 0x0C21, 0x8001 },/* R3105  - Misc Pad Ctrl 2 */
{ 0x0C22, 0x },/* R3106  - Misc Pad Ctrl 3 */
@@ -2524,6 +2525,7 @@ static bool wm5110_readable_register(struct device *dev, 
unsigned int reg)
case ARIZONA_GPIO5_CTRL:
case ARIZONA_IRQ_CTRL_1:
case ARIZONA_GPIO_DEBOUNCE_CONFIG:
+   case ARIZONA_GP_SWITCH_1:
case ARIZONA_MISC_PAD_CTRL_1:
case ARIZONA_MISC_PAD_CTRL_2:
case ARIZONA_MISC_PAD_CTRL_3:
diff --git a/include/linux/mfd/arizona/pdata.h 
b/include/linux/mfd/arizona/pdata.h
index f030a32..e76577b 100644
--- a/include/linux/mfd/arizona/pdata.h
+++ b/include/linux/mfd/arizona/pdata.h
@@ -182,6 +182,9 @@ struct arizona_pdata {
 
/** GPIO for primary IRQ (used for edge triggered emulation) */
int irq_gpio;
+
+   /** General purpose switch control */
+   unsigned int gpsw;
 };
 
 #endif
diff --git a/include/linux/mfd/arizona/registers.h 
b/include/linux/mfd/arizona/registers.h
index 3f3bb2b..e96644c 100644
--- a/include/linux/mfd/arizona/registers.h
+++ b/include/linux/mfd/arizona/registers.h
@@ -869,6 +869,7 @@
 #define ARIZONA_GPIO5_CTRL   0xC04
 #define ARIZONA_IRQ_CTRL_1   0xC0F
 #define ARIZONA_GPIO_DEBOUNCE_CONFIG 0xC10
+#define ARIZONA_GP_SWITCH_1  0xC18
 #define ARIZONA_MISC_PAD_CTRL_1  0xC20
 #define ARIZONA_MISC_PAD_CTRL_2  0xC21
 #define ARIZONA_MISC_PAD_CTRL_3  0xC22
@@ -4573,6 +4574,13 @@
 #define ARIZONA_GP_DBTIME_WIDTH   4  /* GP_DBTIME - 
[15:12] */
 
 /*
+ * R3096 (0xC18) - GP Switch 1
+ */
+#define ARIZONA_SW1_MODE_MASK0x0003  /* SW1_MODE - [1:0] */
+#define ARIZONA_SW1_MODE_SHIFT0  /* SW1_MODE - [1:0] */
+#define ARIZONA_SW1_MODE_WIDTH2  /* SW1_MODE - [1:0] */
+
+/*
  * R3104 (0xC20) - Misc Pad Ctrl 1
  */
 #define ARIZONA_LDO1ENA_PD   0x8000  /* LDO1ENA_PD */
-- 
1.7.2.5

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


[PATCH RESEND 1/5] mfd: arizona: Add registers for ADC microphone detection

2015-08-11 Thread Charles Keepax
The newer devices support using a software comparison to determine
whether a 3/4 pole jack is present. Add the registers necessary for
this.

Signed-off-by: Charles Keepax ckee...@opensource.wolfsonmicro.com
---

Hi,

The first two MFD patches and the two extcon patches need to
go through together as there are build dependencies. However
the last documentation update can be treated seperately.

The patches are based of the extcon/extcon-next tree because
that is where most of the changes are but let me know if an
MFD based version would be preferred.

Thanks,
Charles

 drivers/mfd/wm5110-tables.c   |2 ++
 include/dt-bindings/mfd/arizona.h |2 ++
 include/linux/mfd/arizona/pdata.h |3 +++
 include/linux/mfd/arizona/registers.h |   17 ++---
 4 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/drivers/mfd/wm5110-tables.c b/drivers/mfd/wm5110-tables.c
index 12cad94..dd27872 100644
--- a/drivers/mfd/wm5110-tables.c
+++ b/drivers/mfd/wm5110-tables.c
@@ -1807,6 +1807,7 @@ static bool wm5110_readable_register(struct device *dev, 
unsigned int reg)
case ARIZONA_MIC_DETECT_1:
case ARIZONA_MIC_DETECT_2:
case ARIZONA_MIC_DETECT_3:
+   case ARIZONA_MIC_DETECT_4:
case ARIZONA_MIC_DETECT_LEVEL_1:
case ARIZONA_MIC_DETECT_LEVEL_2:
case ARIZONA_MIC_DETECT_LEVEL_3:
@@ -2843,6 +2844,7 @@ static bool wm5110_volatile_register(struct device *dev, 
unsigned int reg)
case ARIZONA_ASYNC_SAMPLE_RATE_1_STATUS:
case ARIZONA_ASYNC_SAMPLE_RATE_2_STATUS:
case ARIZONA_MIC_DETECT_3:
+   case ARIZONA_MIC_DETECT_4:
case ARIZONA_HP_CTRL_1L:
case ARIZONA_HP_CTRL_1R:
case ARIZONA_HEADPHONE_DETECT_2:
diff --git a/include/dt-bindings/mfd/arizona.h 
b/include/dt-bindings/mfd/arizona.h
index 7b2000c..c40f665 100644
--- a/include/dt-bindings/mfd/arizona.h
+++ b/include/dt-bindings/mfd/arizona.h
@@ -107,5 +107,7 @@
 #define ARIZONA_ACCDET_MODE_MIC 0
 #define ARIZONA_ACCDET_MODE_HPL 1
 #define ARIZONA_ACCDET_MODE_HPR 2
+#define ARIZONA_ACCDET_MODE_HPM 4
+#define ARIZONA_ACCDET_MODE_ADC 7
 
 #endif
diff --git a/include/linux/mfd/arizona/pdata.h 
b/include/linux/mfd/arizona/pdata.h
index 43db4fa..f030a32 100644
--- a/include/linux/mfd/arizona/pdata.h
+++ b/include/linux/mfd/arizona/pdata.h
@@ -124,6 +124,9 @@ struct arizona_pdata {
/** Channel to use for headphone detection */
unsigned int hpdet_channel;
 
+   /** Use software comparison to determine mic presence */
+   bool micd_software_compare;
+
/** Extra debounce timeout used during initial mic detection (ms) */
int micd_detect_debounce;
 
diff --git a/include/linux/mfd/arizona/registers.h 
b/include/linux/mfd/arizona/registers.h
index 3499d36..3f3bb2b 100644
--- a/include/linux/mfd/arizona/registers.h
+++ b/include/linux/mfd/arizona/registers.h
@@ -139,6 +139,7 @@
 #define ARIZONA_MIC_DETECT_LEVEL_2  0x2A7
 #define ARIZONA_MIC_DETECT_LEVEL_3  0x2A8
 #define ARIZONA_MIC_DETECT_LEVEL_4  0x2A9
+#define ARIZONA_MIC_DETECT_4 0x2AB
 #define ARIZONA_MIC_NOISE_MIX_CONTROL_1  0x2C3
 #define ARIZONA_ISOLATION_CONTROL0x2CB
 #define ARIZONA_JACK_DETECT_ANALOGUE 0x2D3
@@ -2301,9 +2302,9 @@
 #define ARIZONA_ACCDET_SRC_MASK  0x2000  /* ACCDET_SRC */
 #define ARIZONA_ACCDET_SRC_SHIFT 13  /* ACCDET_SRC */
 #define ARIZONA_ACCDET_SRC_WIDTH  1  /* ACCDET_SRC */
-#define ARIZONA_ACCDET_MODE_MASK 0x0003  /* ACCDET_MODE - 
[1:0] */
-#define ARIZONA_ACCDET_MODE_SHIFT 0  /* ACCDET_MODE - 
[1:0] */
-#define ARIZONA_ACCDET_MODE_WIDTH 2  /* ACCDET_MODE - 
[1:0] */
+#define ARIZONA_ACCDET_MODE_MASK 0x0007  /* ACCDET_MODE - 
[2:0] */
+#define ARIZONA_ACCDET_MODE_SHIFT 0  /* ACCDET_MODE - 
[2:0] */
+#define ARIZONA_ACCDET_MODE_WIDTH 3  /* ACCDET_MODE - 
[2:0] */
 
 /*
  * R667 (0x29B) - Headphone Detect 1
@@ -2413,6 +2414,16 @@
 #define ARIZONA_MICD_STS_WIDTH1  /* MICD_STS */
 
 /*
+ * R683 (0x2AB) - Mic Detect 4
+ */
+#define ARIZONA_MICDET_ADCVAL_DIFF_MASK  0xFF00  /* MICDET_ADCVAL_DIFF 
- [15:8] */
+#define ARIZONA_MICDET_ADCVAL_DIFF_SHIFT  8  /* MICDET_ADCVAL_DIFF 
- [15:8] */
+#define ARIZONA_MICDET_ADCVAL_DIFF_WIDTH  8  /* MICDET_ADCVAL_DIFF 
- [15:8] */
+#define ARIZONA_MICDET_ADCVAL_MASK   0x007F  /* MICDET_ADCVAL - 
[15:8] */
+#define ARIZONA_MICDET_ADCVAL_SHIFT   0  /* MICDET_ADCVAL - 
[15:8] */
+#define ARIZONA_MICDET_ADCVAL_WIDTH   7  /* MICDET_ADCVAL - 
[15:8] */
+
+/*
  * R707 (0x2C3) - Mic noise mix control 1
  */
 #define ARIZONA_MICMUTE_RATE_MASK0x7800  /* MICMUTE_RATE - 
[14:11] */
-- 
1.7.2.5

--
To unsubscribe from this list: send the line

[PATCH RESEND 4/5] extcon: arizona: Add support for general purpose switch

2015-08-11 Thread Charles Keepax
The switch is typically used in conjunction with the MICDET clamp in
order to suppress pops and clicks associated with jack insertion.

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

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index f372156..b48fb29 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -1216,6 +1216,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;
 }
 
@@ -1313,6 +1315,10 @@ static int arizona_extcon_probe(struct platform_device 
*pdev)
info-micd_num_modes = ARRAY_SIZE(micd_default_modes);
}
 
+   if (arizona-pdata.gpsw  0)
+   regmap_update_bits(arizona-regmap, ARIZONA_GP_SWITCH_1,
+   ARIZONA_SW1_MODE_MASK, arizona-pdata.gpsw);
+
if (arizona-pdata.micd_pol_gpio  0) {
if (info-micd_modes[0].gpio)
mode = GPIOF_OUT_INIT_HIGH;
-- 
1.7.2.5

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


[PATCH 1/5] mfd: arizona: Add registers for ADC microphone detection

2015-07-09 Thread Charles Keepax
The newer devices support using a software comparison to determine
whether a 3/4 pole jack is present. Add the registers necessary for
this.

Signed-off-by: Charles Keepax ckee...@opensource.wolfsonmicro.com
---

Hi,

The first two MFD patches and the two extcon patches need to
go through together as there are build dependencies. However
the last documentation update can be treated seperately.

The patches are based of the extcon/extcon-next tree because
that is where most of the changes are but let me know if an
MFD based version would be preferred.

Thanks,
Charles

 drivers/mfd/wm5110-tables.c   |2 ++
 include/dt-bindings/mfd/arizona.h |2 ++
 include/linux/mfd/arizona/pdata.h |3 +++
 include/linux/mfd/arizona/registers.h |   17 ++---
 4 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/drivers/mfd/wm5110-tables.c b/drivers/mfd/wm5110-tables.c
index 12cad94..dd27872 100644
--- a/drivers/mfd/wm5110-tables.c
+++ b/drivers/mfd/wm5110-tables.c
@@ -1807,6 +1807,7 @@ static bool wm5110_readable_register(struct device *dev, 
unsigned int reg)
case ARIZONA_MIC_DETECT_1:
case ARIZONA_MIC_DETECT_2:
case ARIZONA_MIC_DETECT_3:
+   case ARIZONA_MIC_DETECT_4:
case ARIZONA_MIC_DETECT_LEVEL_1:
case ARIZONA_MIC_DETECT_LEVEL_2:
case ARIZONA_MIC_DETECT_LEVEL_3:
@@ -2843,6 +2844,7 @@ static bool wm5110_volatile_register(struct device *dev, 
unsigned int reg)
case ARIZONA_ASYNC_SAMPLE_RATE_1_STATUS:
case ARIZONA_ASYNC_SAMPLE_RATE_2_STATUS:
case ARIZONA_MIC_DETECT_3:
+   case ARIZONA_MIC_DETECT_4:
case ARIZONA_HP_CTRL_1L:
case ARIZONA_HP_CTRL_1R:
case ARIZONA_HEADPHONE_DETECT_2:
diff --git a/include/dt-bindings/mfd/arizona.h 
b/include/dt-bindings/mfd/arizona.h
index 7b2000c..c40f665 100644
--- a/include/dt-bindings/mfd/arizona.h
+++ b/include/dt-bindings/mfd/arizona.h
@@ -107,5 +107,7 @@
 #define ARIZONA_ACCDET_MODE_MIC 0
 #define ARIZONA_ACCDET_MODE_HPL 1
 #define ARIZONA_ACCDET_MODE_HPR 2
+#define ARIZONA_ACCDET_MODE_HPM 4
+#define ARIZONA_ACCDET_MODE_ADC 7
 
 #endif
diff --git a/include/linux/mfd/arizona/pdata.h 
b/include/linux/mfd/arizona/pdata.h
index 43db4fa..f030a32 100644
--- a/include/linux/mfd/arizona/pdata.h
+++ b/include/linux/mfd/arizona/pdata.h
@@ -124,6 +124,9 @@ struct arizona_pdata {
/** Channel to use for headphone detection */
unsigned int hpdet_channel;
 
+   /** Use software comparison to determine mic presence */
+   bool micd_software_compare;
+
/** Extra debounce timeout used during initial mic detection (ms) */
int micd_detect_debounce;
 
diff --git a/include/linux/mfd/arizona/registers.h 
b/include/linux/mfd/arizona/registers.h
index 3499d36..3f3bb2b 100644
--- a/include/linux/mfd/arizona/registers.h
+++ b/include/linux/mfd/arizona/registers.h
@@ -139,6 +139,7 @@
 #define ARIZONA_MIC_DETECT_LEVEL_2  0x2A7
 #define ARIZONA_MIC_DETECT_LEVEL_3  0x2A8
 #define ARIZONA_MIC_DETECT_LEVEL_4  0x2A9
+#define ARIZONA_MIC_DETECT_4 0x2AB
 #define ARIZONA_MIC_NOISE_MIX_CONTROL_1  0x2C3
 #define ARIZONA_ISOLATION_CONTROL0x2CB
 #define ARIZONA_JACK_DETECT_ANALOGUE 0x2D3
@@ -2301,9 +2302,9 @@
 #define ARIZONA_ACCDET_SRC_MASK  0x2000  /* ACCDET_SRC */
 #define ARIZONA_ACCDET_SRC_SHIFT 13  /* ACCDET_SRC */
 #define ARIZONA_ACCDET_SRC_WIDTH  1  /* ACCDET_SRC */
-#define ARIZONA_ACCDET_MODE_MASK 0x0003  /* ACCDET_MODE - 
[1:0] */
-#define ARIZONA_ACCDET_MODE_SHIFT 0  /* ACCDET_MODE - 
[1:0] */
-#define ARIZONA_ACCDET_MODE_WIDTH 2  /* ACCDET_MODE - 
[1:0] */
+#define ARIZONA_ACCDET_MODE_MASK 0x0007  /* ACCDET_MODE - 
[2:0] */
+#define ARIZONA_ACCDET_MODE_SHIFT 0  /* ACCDET_MODE - 
[2:0] */
+#define ARIZONA_ACCDET_MODE_WIDTH 3  /* ACCDET_MODE - 
[2:0] */
 
 /*
  * R667 (0x29B) - Headphone Detect 1
@@ -2413,6 +2414,16 @@
 #define ARIZONA_MICD_STS_WIDTH1  /* MICD_STS */
 
 /*
+ * R683 (0x2AB) - Mic Detect 4
+ */
+#define ARIZONA_MICDET_ADCVAL_DIFF_MASK  0xFF00  /* MICDET_ADCVAL_DIFF 
- [15:8] */
+#define ARIZONA_MICDET_ADCVAL_DIFF_SHIFT  8  /* MICDET_ADCVAL_DIFF 
- [15:8] */
+#define ARIZONA_MICDET_ADCVAL_DIFF_WIDTH  8  /* MICDET_ADCVAL_DIFF 
- [15:8] */
+#define ARIZONA_MICDET_ADCVAL_MASK   0x007F  /* MICDET_ADCVAL - 
[15:8] */
+#define ARIZONA_MICDET_ADCVAL_SHIFT   0  /* MICDET_ADCVAL - 
[15:8] */
+#define ARIZONA_MICDET_ADCVAL_WIDTH   7  /* MICDET_ADCVAL - 
[15:8] */
+
+/*
  * R707 (0x2C3) - Mic noise mix control 1
  */
 #define ARIZONA_MICMUTE_RATE_MASK0x7800  /* MICMUTE_RATE - 
[14:11] */
-- 
1.7.2.5

--
To unsubscribe from this list: send the line

[PATCH 2/5] extcon: arizona: Add support for new ADC value headphone detect

2015-07-09 Thread Charles Keepax
Newer devices give users the option to make the 3/4 pole jack
determination using a software comparison rather than a hardware one.
This patch adds support for this functionality.

Signed-off-by: Charles Keepax ckee...@opensource.wolfsonmicro.com
---
 drivers/extcon/extcon-arizona.c |   67 +++---
 1 files changed, 61 insertions(+), 6 deletions(-)

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index 4b9f09c..f372156 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -48,6 +48,10 @@
 #define HPDET_DEBOUNCE 500
 #define DEFAULT_MICD_TIMEOUT 2000
 
+#define QUICK_HEADPHONE_MAX_OHM 3
+#define MICROPHONE_MIN_OHM  1257
+#define MICROPHONE_MAX_OHM  3
+
 #define MICD_DBTIME_TWO_READINGS 2
 #define MICD_DBTIME_FOUR_READINGS 4
 
@@ -117,12 +121,15 @@ static const struct arizona_micd_range 
micd_default_ranges[] = {
{ .max = 430, .key = BTN_5 },
 };
 
+/* The number of levels in arizona_micd_levels valid for button thresholds */
+#define ARIZONA_NUM_MICD_BUTTON_LEVELS 64
+
 static const int arizona_micd_levels[] = {
3, 6, 8, 11, 13, 16, 18, 21, 23, 26, 28, 31, 34, 36, 39, 41, 44, 46,
49, 52, 54, 57, 60, 62, 65, 67, 70, 73, 75, 78, 81, 83, 89, 94, 100,
105, 111, 116, 122, 127, 139, 150, 161, 173, 186, 196, 209, 220, 245,
270, 295, 321, 348, 375, 402, 430, 489, 550, 614, 681, 752, 903, 1071,
-   1257,
+   1257, 3,
 };
 
 static const unsigned int arizona_cable[] = {
@@ -270,6 +277,7 @@ static void arizona_start_mic(struct arizona_extcon_info 
*info)
struct arizona *arizona = info-arizona;
bool change;
int ret;
+   unsigned int mode;
 
/* Microphone detection can't use idle mode */
pm_runtime_get(info-dev);
@@ -295,9 +303,14 @@ static void arizona_start_mic(struct arizona_extcon_info 
*info)
regmap_write(arizona-regmap, 0x80, 0x0);
}
 
+   if (info-detecting  arizona-pdata.micd_software_compare)
+   mode = ARIZONA_ACCDET_MODE_ADC;
+   else
+   mode = ARIZONA_ACCDET_MODE_MIC;
+
regmap_update_bits(arizona-regmap,
   ARIZONA_ACCESSORY_DETECT_MODE_1,
-  ARIZONA_ACCDET_MODE_MASK, ARIZONA_ACCDET_MODE_MIC);
+  ARIZONA_ACCDET_MODE_MASK, mode);
 
arizona_extcon_pulse_micbias(info);
 
@@ -804,6 +817,37 @@ static void arizona_micd_detect(struct work_struct *work)
return;
}
 
+   if (info-detecting  arizona-pdata.micd_software_compare) {
+   /* Must disable MICD before we read the ADCVAL */
+   regmap_update_bits(arizona-regmap, ARIZONA_MIC_DETECT_1,
+  ARIZONA_MICD_ENA, 0);
+   ret = regmap_read(arizona-regmap, ARIZONA_MIC_DETECT_4, val);
+   if (ret != 0) {
+   dev_err(arizona-dev,
+   Failed to read MICDET_ADCVAL: %d\n,
+   ret);
+   mutex_unlock(info-lock);
+   return;
+   }
+
+   dev_dbg(arizona-dev, MICDET_ADCVAL: %x\n, val);
+
+   val = ARIZONA_MICDET_ADCVAL_MASK;
+   if (val  ARRAY_SIZE(arizona_micd_levels))
+   val = arizona_micd_levels[val];
+   else
+   val = INT_MAX;
+
+   if (val = QUICK_HEADPHONE_MAX_OHM)
+   val = ARIZONA_MICD_STS | ARIZONA_MICD_LVL_0;
+   else if (val = MICROPHONE_MIN_OHM)
+   val = ARIZONA_MICD_STS | ARIZONA_MICD_LVL_1;
+   else if (val = MICROPHONE_MAX_OHM)
+   val = ARIZONA_MICD_STS | ARIZONA_MICD_LVL_8;
+   else
+   val = ARIZONA_MICD_LVL_8;
+   }
+
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) {
@@ -932,10 +976,17 @@ static void arizona_micd_detect(struct work_struct *work)
}
 
 handled:
-   if (info-detecting)
+   if (info-detecting) {
+   if (arizona-pdata.micd_software_compare)
+   regmap_update_bits(arizona-regmap,
+  ARIZONA_MIC_DETECT_1,
+  ARIZONA_MICD_ENA,
+  ARIZONA_MICD_ENA);
+
queue_delayed_work(system_power_efficient_wq,
   info-micd_timeout_work,
   msecs_to_jiffies(info-micd_timeout));
+   }
 
pm_runtime_mark_last_busy(info-dev);
mutex_unlock(info-lock);
@@ -1162,6 +1213,9 @@ static int arizona_extcon_device_get_pdata(struct arizona 
*arizona)
pdata-micd_force_micbias = device_property_read_bool

[PATCH v6 5/5] mfd: arizona: Update DT doc for new mic detection bindings

2015-07-09 Thread Charles Keepax
Signed-off-by: Charles Keepax ckee...@opensource.wolfsonmicro.com
---

As this patch is still outstanding from the last series I
just updated the patch from the last series to include the
additions from this series.

This patch can obviously be applied seperately from the
rest of the series as there are no dependencies but I have
included it so everyone can see the series together.

Thanks,
Charles

 Documentation/devicetree/bindings/mfd/arizona.txt |   21 +
 include/dt-bindings/mfd/arizona.h |5 +
 2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt 
b/Documentation/devicetree/bindings/mfd/arizona.txt
index a8fee60..b98a11b 100644
--- a/Documentation/devicetree/bindings/mfd/arizona.txt
+++ b/Documentation/devicetree/bindings/mfd/arizona.txt
@@ -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
diff --git a/include/dt-bindings/mfd/arizona.h 
b/include/dt-bindings/mfd/arizona.h
index c40f665..dedf46f 100644
--- a/include/dt-bindings/mfd/arizona.h
+++ b/include/dt-bindings/mfd/arizona.h
@@ -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
-- 
1.7.2.5

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


[PATCH 4/5] extcon: arizona: Add support for general purpose switch

2015-07-09 Thread Charles Keepax
The switch is typically used in conjunction with the MICDET clamp in
order to suppress pops and clicks associated with jack insertion.

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

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index f372156..b48fb29 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -1216,6 +1216,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;
 }
 
@@ -1313,6 +1315,10 @@ static int arizona_extcon_probe(struct platform_device 
*pdev)
info-micd_num_modes = ARRAY_SIZE(micd_default_modes);
}
 
+   if (arizona-pdata.gpsw  0)
+   regmap_update_bits(arizona-regmap, ARIZONA_GP_SWITCH_1,
+   ARIZONA_SW1_MODE_MASK, arizona-pdata.gpsw);
+
if (arizona-pdata.micd_pol_gpio  0) {
if (info-micd_modes[0].gpio)
mode = GPIOF_OUT_INIT_HIGH;
-- 
1.7.2.5

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


[PATCH 3/5] mfd: arizona: Add register bits for general purpose switch

2015-07-09 Thread Charles Keepax
The switch is typically used in conjunction with the MICDET clamp in
order to suppress pops and clicks associated with jack insertion.

Signed-off-by: Charles Keepax ckee...@opensource.wolfsonmicro.com
---
 drivers/mfd/wm5110-tables.c   |2 ++
 include/linux/mfd/arizona/pdata.h |3 +++
 include/linux/mfd/arizona/registers.h |8 
 3 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/drivers/mfd/wm5110-tables.c b/drivers/mfd/wm5110-tables.c
index dd27872..acb3bb2 100644
--- a/drivers/mfd/wm5110-tables.c
+++ b/drivers/mfd/wm5110-tables.c
@@ -1472,6 +1472,7 @@ static const struct reg_default wm5110_reg_default[] = {
{ 0x0C04, 0xA101 },/* R3076  - GPIO5 CTRL */
{ 0x0C0F, 0x0400 },/* R3087  - IRQ CTRL 1 */
{ 0x0C10, 0x1000 },/* R3088  - GPIO Debounce Config */
+   { 0x0C18, 0x },/* R3096  - GP Switch 1 */
{ 0x0C20, 0x8002 },/* R3104  - Misc Pad Ctrl 1 */
{ 0x0C21, 0x8001 },/* R3105  - Misc Pad Ctrl 2 */
{ 0x0C22, 0x },/* R3106  - Misc Pad Ctrl 3 */
@@ -2524,6 +2525,7 @@ static bool wm5110_readable_register(struct device *dev, 
unsigned int reg)
case ARIZONA_GPIO5_CTRL:
case ARIZONA_IRQ_CTRL_1:
case ARIZONA_GPIO_DEBOUNCE_CONFIG:
+   case ARIZONA_GP_SWITCH_1:
case ARIZONA_MISC_PAD_CTRL_1:
case ARIZONA_MISC_PAD_CTRL_2:
case ARIZONA_MISC_PAD_CTRL_3:
diff --git a/include/linux/mfd/arizona/pdata.h 
b/include/linux/mfd/arizona/pdata.h
index f030a32..e76577b 100644
--- a/include/linux/mfd/arizona/pdata.h
+++ b/include/linux/mfd/arizona/pdata.h
@@ -182,6 +182,9 @@ struct arizona_pdata {
 
/** GPIO for primary IRQ (used for edge triggered emulation) */
int irq_gpio;
+
+   /** General purpose switch control */
+   unsigned int gpsw;
 };
 
 #endif
diff --git a/include/linux/mfd/arizona/registers.h 
b/include/linux/mfd/arizona/registers.h
index 3f3bb2b..e96644c 100644
--- a/include/linux/mfd/arizona/registers.h
+++ b/include/linux/mfd/arizona/registers.h
@@ -869,6 +869,7 @@
 #define ARIZONA_GPIO5_CTRL   0xC04
 #define ARIZONA_IRQ_CTRL_1   0xC0F
 #define ARIZONA_GPIO_DEBOUNCE_CONFIG 0xC10
+#define ARIZONA_GP_SWITCH_1  0xC18
 #define ARIZONA_MISC_PAD_CTRL_1  0xC20
 #define ARIZONA_MISC_PAD_CTRL_2  0xC21
 #define ARIZONA_MISC_PAD_CTRL_3  0xC22
@@ -4573,6 +4574,13 @@
 #define ARIZONA_GP_DBTIME_WIDTH   4  /* GP_DBTIME - 
[15:12] */
 
 /*
+ * R3096 (0xC18) - GP Switch 1
+ */
+#define ARIZONA_SW1_MODE_MASK0x0003  /* SW1_MODE - [1:0] */
+#define ARIZONA_SW1_MODE_SHIFT0  /* SW1_MODE - [1:0] */
+#define ARIZONA_SW1_MODE_WIDTH2  /* SW1_MODE - [1:0] */
+
+/*
  * R3104 (0xC20) - Misc Pad Ctrl 1
  */
 #define ARIZONA_LDO1ENA_PD   0x8000  /* LDO1ENA_PD */
-- 
1.7.2.5

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


Re: [PATCH v5 1/7] extcon: arizona: Simplify pdata symantics for micd_dbtime

2015-06-30 Thread Charles Keepax
On Sun, Jun 21, 2015 at 11:17:56PM +0900, Chanwoo Choi wrote:
 Hi Charles,
 
 Looks good go me. But you need the review from MFD maintainer
 before appling it.
 
 Thanks,
 Chanwoo Choi
 
 On Sat, Jun 20, 2015 at 1:23 AM, Charles Keepax
 ckee...@opensource.wolfsonmicro.com wrote:
  Currently micd_dbtime can be set to 0 for default, 1 for 4 measurements,
  or a greater than 16-bit value for 2 measurements. This patch simplifies
  the symantics to 2 for 2 measurements, 4 for 4 measurements and any
  other value for the default.
 
  I am not super keen on changing the symantics of the pdata at this stage
  in the drivers life, but acceptance of the DT binding for this field has
  been made conditional on this happening.
 
  Signed-off-by: Charles Keepax ckee...@opensource.wolfsonmicro.com
  ---
  diff --git a/include/linux/mfd/arizona/pdata.h 
  b/include/linux/mfd/arizona/pdata.h
  index aa5c48b..bd68355 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_READINGS 2
  +#define ARIZONA_MICD_DBTIME_FOUR_READINGS 4
  +

I am gonna respin and move these into the extcon driver itself,
should allow us to get the patch merged and their use in the
pdata header is probably minimal.

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


Re: [PATCH v3 6/7] mfd: arizona: Update DT doc for new mic detection bindings

2015-06-24 Thread Charles Keepax
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

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


[PATCH v3 5/7] extcon: arizona: Ensure variables are set for headphone detection

2015-06-19 Thread Charles Keepax
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 ckee...@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

--
To unsubscribe from this list: send the line unsubscribe devicetree in


[PATCH v3 3/7] extcon: arizona: Add basic microphone detection DT/ACPI bindings

2015-06-19 Thread Charles Keepax
This patch adds bindings for the basic microphone detection platform
data.

Signed-off-by: Charles Keepax ckee...@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 0x1
+#define ARIZONA_MICD_DBTIME_FOUR_DEBOUNCES 0x0001
+
 struct regulator_init_data;
 
 struct arizona_micbias {
-- 
1.7.2.5

--
To unsubscribe from this list: send the line unsubscribe devicetree in


[PATCH v3 6/7] mfd: arizona: Update DT doc for new mic detection bindings

2015-06-19 Thread Charles Keepax
Signed-off-by: Charles Keepax ckee...@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

--
To unsubscribe from this list: send the line unsubscribe devicetree in


Re: [PATCH v2 2/5] extcon: arizona: Add basic microphone detection DT/ACPI bindings

2015-06-19 Thread Charles Keepax
On Fri, Jun 19, 2015 at 08:03:37PM +0900, Chanwoo Choi wrote:
 On Fri, Jun 19, 2015 at 7:44 PM, Charles Keepax
 ckee...@opensource.wolfsonmicro.com wrote:
  On Fri, Jun 19, 2015 at 07:31:49PM +0900, Chanwoo Choi wrote:
  On Fri, Jun 19, 2015 at 6:08 PM, Charles Keepax
  ckee...@opensource.wolfsonmicro.com wrote:
   On Fri, Jun 19, 2015 at 05:28:11PM +0900, Chanwoo Choi wrote:
   On Fri, Jun 19, 2015 at 5:17 PM, Charles Keepax
   ckee...@opensource.wolfsonmicro.com wrote:
On Fri, Jun 19, 2015 at 11:25:57AM +0900, Chanwoo Choi wrote:
Hi Charles,
   
On Thu, Jun 18, 2015 at 11:43 PM, Charles Keepax
ckee...@opensource.wolfsonmicro.com wrote:
 This patch adds bindings for the basic microphone detection 
 platform
 data.

 Signed-off-by: Charles Keepax ckee...@opensource.wolfsonmicro.com
 ---
 +   dbtime = 0;
 +   device_property_read_u32(arizona-dev, wlf,micd-dbtime, 
 dbtime);
 +   switch (dbtime) {
 +   case 2:
   
I'd like you to define the constant variable for specific integer
value to improve the readability.
e.g.,
   
#define MICD_DBTIME_XXX 2
#define MICD_DBTIME_XXX 4
   
 +   pdata-micd_dbtime = 0x1;
   
Also, you better to define the constant variable for 0x1 to
improbe readability in the include/linux/mfd/arizona.h. If you just
use the hex value, the other developer cannot analyze the meaning of
0x1.
   
 +   break;
 +   case 4:
   
ditto.
   
   
I am not sure these two really warrant a define the number in DT
indicates the number of debounces to perform.
   
#define MICD_DBTIME_TWO 2
  
   No. I mean that you should define the appropriate name of definition
   to indicate the meaning of 2 or 4. Just not 2 - TWO.
  
   2 is 2 second? or 2 is milli-second? or Is there any other meaning?
   I can never know the meaning of '2' without any description and any
   proper name of definition.
  
   It is literally two, two debounces, I really can't see what I
   could call the define. What do you think to the idea I suggested
   to rename the variable dbtime - num_debounces?
 
  Is it either debounce time or the number of debounce?
 
  Also,
 
  When extcon-arizona driver update the bit for micd_dbtime, use the
  ARIZONA_MICD_DBTIME_MASK (0x0002).
 
  In following case, 0x1 is larger than ARIZONA_MICD_DBTIME_MASK(0x0002).
 
case 2:
  pdata-micd_dbtime = 0x1;
 
  Is it correct?
 
  I thinkt that arizona-pdata.micd_dbtime 
  ARIZONA_MICD_DBTIME_SHIFT value should be included in the range of
  ARIZONA_MICD_DBTIME_MASK(0x0002).
 
  Basically this boils down to setting a single bit which chooses
  between 2 and 4 debounces. The tricky thing is that the default
  value for the pdata will be 0, and the value of the bit for 2
  debounces will be 0. So inorder to show we have intentionally set
  the pdata we set a value that is non-zero but won't get written
  into the register. It is a little awkward but I don't want to
  change how the pdata works as there are probably systems out of
  tree that use it.
 
 This method cause the poor readabilidy of extcon-arizona.c.
 If you don't explain this complicated reason of this code, me and
 other developer will never understand the meaning of this code.
 
 I don't agree your suggestion. you need other way.

Well alright if you are sure, I guess if they are out of tree
anyway we don't really care whether we break their code from
mainline. I will respin to change the symantics of the pdata to
be more sensible.

Thanks,
Charles
--
To unsubscribe from this list: send the line unsubscribe devicetree in


[PATCH v4 0/8] Add basic microphone detection bindings

2015-06-19 Thread Charles Keepax
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.

Changes since v3:
 - Simplify the symantics of the pdata for micd_dbtime

Thanks,
Charles

Charles Keepax (8):
  extcon: arizona: Simplify pdata symantics for micd_dbtime
  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   |   99 +
 include/linux/mfd/arizona/pdata.h |   15 ++--
 3 files changed, 105 insertions(+), 25 deletions(-)

-- 
1.7.2.5

--
To unsubscribe from this list: send the line unsubscribe devicetree in


[PATCH v4 1/8] extcon: arizona: Simplify pdata symantics for micd_dbtime

2015-06-19 Thread Charles Keepax
Currently micd_dbtime can be set to 0 for default, 1 for 4 measurements,
or a greater than 16-bit value for 2 measurements. This patch simplifies
the symantics to 2 for 2 measurements, 4 for 4 measurements and any
other value for the default.

I am not super keen on changing the symantics of the pdata at this stage
in the drivers life, but acceptance of the DT binding for this field has
been made conditional on this happening.

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

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index 9262b45..1fbe3b4 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -1267,11 +1267,19 @@ static int arizona_extcon_probe(struct platform_device 
*pdev)
   arizona-pdata.micd_rate
ARIZONA_MICD_RATE_SHIFT);
 
-   if (arizona-pdata.micd_dbtime)
+   switch (arizona-pdata.micd_dbtime) {
+   case ARIZONA_MICD_DBTIME_FOUR_READINGS:
regmap_update_bits(arizona-regmap, ARIZONA_MIC_DETECT_1,
   ARIZONA_MICD_DBTIME_MASK,
-  arizona-pdata.micd_dbtime
-   ARIZONA_MICD_DBTIME_SHIFT);
+  ARIZONA_MICD_DBTIME);
+   break;
+   case ARIZONA_MICD_DBTIME_TWO_READINGS:
+   regmap_update_bits(arizona-regmap, ARIZONA_MIC_DETECT_1,
+  ARIZONA_MICD_DBTIME_MASK, 0);
+   break;
+   default:
+   break;
+   }
 
BUILD_BUG_ON(ARRAY_SIZE(arizona_micd_levels) != 0x40);
 
diff --git a/include/linux/mfd/arizona/pdata.h 
b/include/linux/mfd/arizona/pdata.h
index aa5c48b..bd68355 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_READINGS 2
+#define ARIZONA_MICD_DBTIME_FOUR_READINGS 4
+
 struct regulator_init_data;
 
 struct arizona_micbias {
-- 
1.7.2.5

--
To unsubscribe from this list: send the line unsubscribe devicetree in


  1   2   3   >