All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] extcon: arizona: Remove enable/disable of 32k clock
@ 2016-01-05 15:41 ` Charles Keepax
  0 siblings, 0 replies; 13+ messages in thread
From: Charles Keepax @ 2016-01-05 15:41 UTC (permalink / raw)
  To: mturquette, cw00.choi, lee.jones
  Cc: sboyd, myungjoo.ham, devicetree, linux-clk, linux-kernel, patches

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 <ckeepax@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(&info->hpdet_work);
 	regmap_update_bits(arizona->regmap, ARIZONA_JACK_DETECT_ANALOGUE,
 			   ARIZONA_JD1_ENA, 0);
-	arizona_clk32k_disable(arizona);
 
 	return 0;
 }
-- 
2.1.4


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

* [PATCH 1/4] extcon: arizona: Remove enable/disable of 32k clock
@ 2016-01-05 15:41 ` Charles Keepax
  0 siblings, 0 replies; 13+ messages in thread
From: Charles Keepax @ 2016-01-05 15:41 UTC (permalink / raw)
  To: mturquette-rdvid1DuHRBWk0Htik3J/w,
	cw00.choi-Sze3O3UU22JBDgjK7y7TUQ,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A
  Cc: sboyd-sgV2jX0FEOL9JmXXK+q4OQ,
	myungjoo.ham-Sze3O3UU22JBDgjK7y7TUQ,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-clk-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	patches-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E

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 <ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
---
 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(&info->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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 2/4] clk: arizona: Add clock driver for the Arizona devices
  2016-01-05 15:41 ` Charles Keepax
@ 2016-01-05 15:41   ` Charles Keepax
  -1 siblings, 0 replies; 13+ messages in thread
From: Charles Keepax @ 2016-01-05 15:41 UTC (permalink / raw)
  To: mturquette, cw00.choi, lee.jones
  Cc: sboyd, myungjoo.ham, devicetree, linux-clk, linux-kernel, patches

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 <ckeepax@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 0000000..1ab69ee
--- /dev/null
+++ b/drivers/clk/clk-arizona.c
@@ -0,0 +1,192 @@
+/*
+ * Arizona clock control
+ *
+ * Copyright 2016 Cirrus Logic, Inc.
+ *
+ * Author: Charles Keepax <ckeepax@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 <linux/clkdev.h>
+#include <linux/clk-provider.h>
+#include <linux/delay.h>
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+
+#include <linux/mfd/arizona/core.h>
+#include <linux/mfd/arizona/pdata.h>
+#include <linux/mfd/arizona/registers.h>
+
+#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);
+
+		if (clk_get_rate(mclk) == CLK32K_RATE) {
+			arizona->pdata.clk32k_src = ARIZONA_32KZ_MCLK1 + i;
+			arizona->pdata.clk32k_parent = __clk_get_name(mclk);
+		}
+
+		clk_put(mclk);
+	}
+
+	return 0;
+}
+
+static int arizona_clk_probe(struct platform_device *pdev)
+{
+	struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
+	struct arizona_clk *clkdata;
+	int ret;
+
+	struct clk_init_data clk32k_init = {
+		.name = "arizona-32k",
+		.ops = &arizona_32k_ops,
+	};
+
+	if (IS_ENABLED(CONFIG_OF) && !dev_get_platdata(arizona->dev)) {
+		ret = arizona_clk_of_get_pdata(arizona);
+		if (ret) {
+			dev_err(arizona->dev, "Failed parsing clock DT: %d\n",
+				ret);
+			return ret;
+		}
+	}
+
+	clkdata = devm_kzalloc(&pdev->dev, sizeof(*clkdata), GFP_KERNEL);
+	if (!clkdata)
+		return -ENOMEM;
+
+	clkdata->arizona = arizona;
+
+	switch (arizona->pdata.clk32k_src) {
+	case 0:
+		arizona->pdata.clk32k_src = ARIZONA_32KZ_MCLK2;
+		/* Fall through */
+	case ARIZONA_32KZ_MCLK1:
+	case ARIZONA_32KZ_MCLK2:
+	case ARIZONA_32KZ_NONE:
+		regmap_update_bits(arizona->regmap, ARIZONA_CLOCK_32K_1,
+				   ARIZONA_CLK_32K_SRC_MASK,
+				   arizona->pdata.clk32k_src - 1);
+		break;
+	default:
+		dev_err(arizona->dev, "Invalid 32kHz clock source: %d\n",
+			arizona->pdata.clk32k_src);
+		return -EINVAL;
+	}
+
+	if (arizona->pdata.clk32k_parent) {
+		clk32k_init.num_parents = 1;
+		clk32k_init.parent_names = &arizona->pdata.clk32k_parent;
+	} else {
+		clk32k_init.flags |= CLK_IS_ROOT;
+	}
+
+	clkdata->clk32k_hw.init = &clk32k_init;
+	clkdata->clk32k = devm_clk_register(&pdev->dev, &clkdata->clk32k_hw);
+	if (IS_ERR(clkdata->clk32k)) {
+		ret = PTR_ERR(clkdata->clk32k);
+		dev_err(arizona->dev, "Failed to register 32k clock: %d\n",
+			ret);
+		return ret;
+	}
+
+	ret = clk_register_clkdev(clkdata->clk32k, "arizona-32k",
+				  dev_name(arizona->dev));
+	if (ret) {
+		dev_err(arizona->dev, "Failed to register 32k clock dev: %d\n",
+			ret);
+		return ret;
+	}
+
+	platform_set_drvdata(pdev, clkdata);
+
+	return 0;
+}
+
+static struct platform_driver arizona_clk_driver = {
+	.probe = arizona_clk_probe,
+	.driver		= {
+		.name	= "arizona-clk",
+	},
+};
+
+module_platform_driver(arizona_clk_driver);
+
+/* Module information */
+MODULE_AUTHOR("Charles Keepax <ckeepax@opensource.wolfsonmicro.com>");
+MODULE_DESCRIPTION("Clock driver for Arizona devices");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:arizona-clk");
diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h
index 57b45ca..ddeee17 100644
--- a/include/linux/mfd/arizona/pdata.h
+++ b/include/linux/mfd/arizona/pdata.h
@@ -87,6 +87,9 @@ struct arizona_pdata {
 	/** If a direct 32kHz clock is provided on an MCLK specify it here */
 	int clk32k_src;
 
+	/** Name of the parent clock for the 32k clock */
+	const char *clk32k_parent;
+
 	/** Mode for primary IRQ (defaults to active low) */
 	unsigned int irq_flags;
 
-- 
2.1.4


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

* [PATCH 2/4] clk: arizona: Add clock driver for the Arizona devices
@ 2016-01-05 15:41   ` Charles Keepax
  0 siblings, 0 replies; 13+ messages in thread
From: Charles Keepax @ 2016-01-05 15:41 UTC (permalink / raw)
  To: mturquette, cw00.choi, lee.jones
  Cc: sboyd, myungjoo.ham, devicetree, linux-clk, linux-kernel, patches

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 <ckeepax@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 0000000..1ab69ee
--- /dev/null
+++ b/drivers/clk/clk-arizona.c
@@ -0,0 +1,192 @@
+/*
+ * Arizona clock control
+ *
+ * Copyright 2016 Cirrus Logic, Inc.
+ *
+ * Author: Charles Keepax <ckeepax@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 <linux/clkdev.h>
+#include <linux/clk-provider.h>
+#include <linux/delay.h>
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+
+#include <linux/mfd/arizona/core.h>
+#include <linux/mfd/arizona/pdata.h>
+#include <linux/mfd/arizona/registers.h>
+
+#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);
+
+		if (clk_get_rate(mclk) == CLK32K_RATE) {
+			arizona->pdata.clk32k_src = ARIZONA_32KZ_MCLK1 + i;
+			arizona->pdata.clk32k_parent = __clk_get_name(mclk);
+		}
+
+		clk_put(mclk);
+	}
+
+	return 0;
+}
+
+static int arizona_clk_probe(struct platform_device *pdev)
+{
+	struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
+	struct arizona_clk *clkdata;
+	int ret;
+
+	struct clk_init_data clk32k_init = {
+		.name = "arizona-32k",
+		.ops = &arizona_32k_ops,
+	};
+
+	if (IS_ENABLED(CONFIG_OF) && !dev_get_platdata(arizona->dev)) {
+		ret = arizona_clk_of_get_pdata(arizona);
+		if (ret) {
+			dev_err(arizona->dev, "Failed parsing clock DT: %d\n",
+				ret);
+			return ret;
+		}
+	}
+
+	clkdata = devm_kzalloc(&pdev->dev, sizeof(*clkdata), GFP_KERNEL);
+	if (!clkdata)
+		return -ENOMEM;
+
+	clkdata->arizona = arizona;
+
+	switch (arizona->pdata.clk32k_src) {
+	case 0:
+		arizona->pdata.clk32k_src = ARIZONA_32KZ_MCLK2;
+		/* Fall through */
+	case ARIZONA_32KZ_MCLK1:
+	case ARIZONA_32KZ_MCLK2:
+	case ARIZONA_32KZ_NONE:
+		regmap_update_bits(arizona->regmap, ARIZONA_CLOCK_32K_1,
+				   ARIZONA_CLK_32K_SRC_MASK,
+				   arizona->pdata.clk32k_src - 1);
+		break;
+	default:
+		dev_err(arizona->dev, "Invalid 32kHz clock source: %d\n",
+			arizona->pdata.clk32k_src);
+		return -EINVAL;
+	}
+
+	if (arizona->pdata.clk32k_parent) {
+		clk32k_init.num_parents = 1;
+		clk32k_init.parent_names = &arizona->pdata.clk32k_parent;
+	} else {
+		clk32k_init.flags |= CLK_IS_ROOT;
+	}
+
+	clkdata->clk32k_hw.init = &clk32k_init;
+	clkdata->clk32k = devm_clk_register(&pdev->dev, &clkdata->clk32k_hw);
+	if (IS_ERR(clkdata->clk32k)) {
+		ret = PTR_ERR(clkdata->clk32k);
+		dev_err(arizona->dev, "Failed to register 32k clock: %d\n",
+			ret);
+		return ret;
+	}
+
+	ret = clk_register_clkdev(clkdata->clk32k, "arizona-32k",
+				  dev_name(arizona->dev));
+	if (ret) {
+		dev_err(arizona->dev, "Failed to register 32k clock dev: %d\n",
+			ret);
+		return ret;
+	}
+
+	platform_set_drvdata(pdev, clkdata);
+
+	return 0;
+}
+
+static struct platform_driver arizona_clk_driver = {
+	.probe = arizona_clk_probe,
+	.driver		= {
+		.name	= "arizona-clk",
+	},
+};
+
+module_platform_driver(arizona_clk_driver);
+
+/* Module information */
+MODULE_AUTHOR("Charles Keepax <ckeepax@opensource.wolfsonmicro.com>");
+MODULE_DESCRIPTION("Clock driver for Arizona devices");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:arizona-clk");
diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h
index 57b45ca..ddeee17 100644
--- a/include/linux/mfd/arizona/pdata.h
+++ b/include/linux/mfd/arizona/pdata.h
@@ -87,6 +87,9 @@ struct arizona_pdata {
 	/** If a direct 32kHz clock is provided on an MCLK specify it here */
 	int clk32k_src;
 
+	/** Name of the parent clock for the 32k clock */
+	const char *clk32k_parent;
+
 	/** Mode for primary IRQ (defaults to active low) */
 	unsigned int irq_flags;
 
-- 
2.1.4


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

* [PATCH 3/4] mfd: arizona: Switch to using clock driver for 32k clock
@ 2016-01-05 15:41   ` Charles Keepax
  0 siblings, 0 replies; 13+ messages in thread
From: Charles Keepax @ 2016-01-05 15:41 UTC (permalink / raw)
  To: mturquette, cw00.choi, lee.jones
  Cc: sboyd, myungjoo.ham, devicetree, linux-clk, linux-kernel, patches

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 <ckeepax@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(&arizona->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(&arizona->clk_lock);
-
-	return ret;
-}
-EXPORT_SYMBOL_GPL(arizona_clk32k_enable);
-
-int arizona_clk32k_disable(struct arizona *arizona)
-{
-	mutex_lock(&arizona->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(&arizona->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(&arizona->clk_lock);
 
 	if (dev_get_platdata(arizona->dev))
 		memcpy(&arizona->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", ret);
+		goto err_pm;
+	}
+
+	ret = clk_prepare_enable(arizona->clk32k);
+	if (ret < 0) {
+		dev_err(arizona->dev, "Failed to enable 32k clock: %d\n", ret);
+		goto err_pm;
+	}
+
 	/* Set up for interrupts */
 	ret = arizona_irq_init(arizona);
 	if (ret != 0)
-		goto err_reset;
+		goto err_clock;
 
 	pm_runtime_set_autosuspend_delay(arizona->dev, 100);
 	pm_runtime_use_autosuspend(arizona->dev);
@@ -1414,6 +1350,10 @@ int arizona_dev_init(struct arizona *arizona)
 
 err_irq:
 	arizona_irq_exit(arizona);
+err_clock:
+	clk_disable_unprepare(arizona->clk32k);
+err_pm:
+	pm_runtime_disable(arizona->dev);
 err_reset:
 	arizona_enable_reset(arizona);
 	regulator_disable(arizona->dcvdd);
@@ -1430,6 +1370,8 @@ EXPORT_SYMBOL_GPL(arizona_dev_init);
 
 int arizona_dev_exit(struct arizona *arizona)
 {
+	clk_disable_unprepare(arizona->clk32k);
+
 	pm_runtime_disable(arizona->dev);
 
 	regulator_disable(arizona->dcvdd);
diff --git a/include/linux/mfd/arizona/core.h b/include/linux/mfd/arizona/core.h
index 79e607e..b9a1da4 100644
--- a/include/linux/mfd/arizona/core.h
+++ b/include/linux/mfd/arizona/core.h
@@ -13,6 +13,7 @@
 #ifndef _WM_ARIZONA_CORE_H
 #define _WM_ARIZONA_CORE_H
 
+#include <linux/clk.h>
 #include <linux/interrupt.h>
 #include <linux/regmap.h>
 #include <linux/regulator/consumer.h>
@@ -133,8 +134,7 @@ struct arizona {
 	bool hpdet_clamp;
 	unsigned int hp_ena;
 
-	struct mutex clk_lock;
-	int clk32k_ref;
+	struct clk *clk32k;
 
 	bool ctrlif_error;
 
@@ -148,9 +148,6 @@ struct arizona {
 	struct mutex dac_comp_lock;
 };
 
-int arizona_clk32k_enable(struct arizona *arizona);
-int arizona_clk32k_disable(struct arizona *arizona);
-
 int arizona_request_irq(struct arizona *arizona, int irq, char *name,
 			irq_handler_t handler, void *data);
 void arizona_free_irq(struct arizona *arizona, int irq, void *data);
-- 
2.1.4


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

* [PATCH 3/4] mfd: arizona: Switch to using clock driver for 32k clock
@ 2016-01-05 15:41   ` Charles Keepax
  0 siblings, 0 replies; 13+ messages in thread
From: Charles Keepax @ 2016-01-05 15:41 UTC (permalink / raw)
  To: mturquette-rdvid1DuHRBWk0Htik3J/w,
	cw00.choi-Sze3O3UU22JBDgjK7y7TUQ,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A
  Cc: sboyd-sgV2jX0FEOL9JmXXK+q4OQ,
	myungjoo.ham-Sze3O3UU22JBDgjK7y7TUQ,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-clk-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	patches-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E

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 <ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
---
 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(&arizona->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(&arizona->clk_lock);
-
-	return ret;
-}
-EXPORT_SYMBOL_GPL(arizona_clk32k_enable);
-
-int arizona_clk32k_disable(struct arizona *arizona)
-{
-	mutex_lock(&arizona->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(&arizona->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(&arizona->clk_lock);
 
 	if (dev_get_platdata(arizona->dev))
 		memcpy(&arizona->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", ret);
+		goto err_pm;
+	}
+
+	ret = clk_prepare_enable(arizona->clk32k);
+	if (ret < 0) {
+		dev_err(arizona->dev, "Failed to enable 32k clock: %d\n", ret);
+		goto err_pm;
+	}
+
 	/* Set up for interrupts */
 	ret = arizona_irq_init(arizona);
 	if (ret != 0)
-		goto err_reset;
+		goto err_clock;
 
 	pm_runtime_set_autosuspend_delay(arizona->dev, 100);
 	pm_runtime_use_autosuspend(arizona->dev);
@@ -1414,6 +1350,10 @@ int arizona_dev_init(struct arizona *arizona)
 
 err_irq:
 	arizona_irq_exit(arizona);
+err_clock:
+	clk_disable_unprepare(arizona->clk32k);
+err_pm:
+	pm_runtime_disable(arizona->dev);
 err_reset:
 	arizona_enable_reset(arizona);
 	regulator_disable(arizona->dcvdd);
@@ -1430,6 +1370,8 @@ EXPORT_SYMBOL_GPL(arizona_dev_init);
 
 int arizona_dev_exit(struct arizona *arizona)
 {
+	clk_disable_unprepare(arizona->clk32k);
+
 	pm_runtime_disable(arizona->dev);
 
 	regulator_disable(arizona->dcvdd);
diff --git a/include/linux/mfd/arizona/core.h b/include/linux/mfd/arizona/core.h
index 79e607e..b9a1da4 100644
--- a/include/linux/mfd/arizona/core.h
+++ b/include/linux/mfd/arizona/core.h
@@ -13,6 +13,7 @@
 #ifndef _WM_ARIZONA_CORE_H
 #define _WM_ARIZONA_CORE_H
 
+#include <linux/clk.h>
 #include <linux/interrupt.h>
 #include <linux/regmap.h>
 #include <linux/regulator/consumer.h>
@@ -133,8 +134,7 @@ struct arizona {
 	bool hpdet_clamp;
 	unsigned int hp_ena;
 
-	struct mutex clk_lock;
-	int clk32k_ref;
+	struct clk *clk32k;
 
 	bool ctrlif_error;
 
@@ -148,9 +148,6 @@ struct arizona {
 	struct mutex dac_comp_lock;
 };
 
-int arizona_clk32k_enable(struct arizona *arizona);
-int arizona_clk32k_disable(struct arizona *arizona);
-
 int arizona_request_irq(struct arizona *arizona, int irq, char *name,
 			irq_handler_t handler, void *data);
 void arizona_free_irq(struct arizona *arizona, int irq, void *data);
-- 
2.1.4

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

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

* [PATCH 4/4] mfd: arizona: Add device tree binding documentation for new clock driver
  2016-01-05 15:41 ` Charles Keepax
@ 2016-01-05 15:41   ` Charles Keepax
  -1 siblings, 0 replies; 13+ messages in thread
From: Charles Keepax @ 2016-01-05 15:41 UTC (permalink / raw)
  To: mturquette, cw00.choi, lee.jones
  Cc: sboyd, myungjoo.ham, devicetree, linux-clk, linux-kernel, patches

Specify the device tree binding for the input clocks to Arizona devices.

Signed-off-by: Charles Keepax <ckeepax@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 <dt-bindings/mfd/arizona.txt>. If
     absent, no configuration of these registers is performed. If any entry has
-- 
2.1.4


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

* [PATCH 4/4] mfd: arizona: Add device tree binding documentation for new clock driver
@ 2016-01-05 15:41   ` Charles Keepax
  0 siblings, 0 replies; 13+ messages in thread
From: Charles Keepax @ 2016-01-05 15:41 UTC (permalink / raw)
  To: mturquette, cw00.choi, lee.jones
  Cc: sboyd, myungjoo.ham, devicetree, linux-clk, linux-kernel, patches

Specify the device tree binding for the input clocks to Arizona devices.

Signed-off-by: Charles Keepax <ckeepax@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 <dt-bindings/mfd/arizona.txt>. If
     absent, no configuration of these registers is performed. If any entry has
-- 
2.1.4

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

* Re: [PATCH 3/4] mfd: arizona: Switch to using clock driver for 32k clock
  2016-01-05 15:41   ` Charles Keepax
  (?)
@ 2016-01-05 16:19   ` kbuild test robot
  2016-01-06  9:37       ` Charles Keepax
  -1 siblings, 1 reply; 13+ messages in thread
From: kbuild test robot @ 2016-01-05 16:19 UTC (permalink / raw)
  To: Charles Keepax
  Cc: kbuild-all, mturquette, cw00.choi, lee.jones, sboyd,
	myungjoo.ham, devicetree, linux-clk, linux-kernel, patches

[-- Attachment #1: Type: text/plain, Size: 890 bytes --]

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)

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 25289 bytes --]

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

* Re: [PATCH 3/4] mfd: arizona: Switch to using clock driver for 32k clock
  2016-01-05 15:41   ` Charles Keepax
  (?)
  (?)
@ 2016-01-05 16:23   ` kbuild test robot
  -1 siblings, 0 replies; 13+ messages in thread
From: kbuild test robot @ 2016-01-05 16:23 UTC (permalink / raw)
  To: Charles Keepax
  Cc: kbuild-all, mturquette, cw00.choi, lee.jones, sboyd,
	myungjoo.ham, devicetree, linux-clk, linux-kernel, patches

[-- Attachment #1: Type: text/plain, Size: 15640 bytes --]

Hi Charles,

[auto build test ERROR on clk/clk-next]
[also build test ERROR 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: i386-randconfig-s1-201601 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All error/warnings (new ones prefixed by >>):

>> drivers/clk/clk-arizona.c:31:16: error: field 'clk32k_hw' has incomplete type
     struct clk_hw clk32k_hw;
                   ^
   In file included from include/asm-generic/bug.h:13:0,
                    from arch/x86/include/asm/bug.h:35,
                    from include/linux/bug.h:4,
                    from include/linux/mmdebug.h:4,
                    from include/linux/gfp.h:4,
                    from include/linux/slab.h:14,
                    from include/asm-generic/clkdev.h:16,
                    from arch/x86/include/generated/asm/clkdev.h:1,
                    from include/linux/clkdev.h:15,
                    from drivers/clk/clk-arizona.c:14:
   drivers/clk/clk-arizona.c: In function 'clk32k_to_arizona_clk':
   include/linux/kernel.h:813:48: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
     const typeof( ((type *)0)->member ) *__mptr = (ptr); \
                                                   ^
>> drivers/clk/clk-arizona.c:37:9: note: in expansion of macro 'container_of'
     return container_of(hw, struct arizona_clk, clk32k_hw);
            ^
   drivers/clk/clk-arizona.c: At top level:
>> drivers/clk/clk-arizona.c:77:21: error: variable 'arizona_32k_ops' has initializer but incomplete type
    static const struct clk_ops arizona_32k_ops = {
                        ^
>> drivers/clk/clk-arizona.c:78:2: error: unknown field 'prepare' specified in initializer
     .prepare = arizona_32k_enable,
     ^
>> drivers/clk/clk-arizona.c:78:13: warning: excess elements in struct initializer
     .prepare = arizona_32k_enable,
                ^
   drivers/clk/clk-arizona.c:78:13: note: (near initialization for 'arizona_32k_ops')
>> drivers/clk/clk-arizona.c:79:2: error: unknown field 'unprepare' specified in initializer
     .unprepare = arizona_32k_disable,
     ^
   drivers/clk/clk-arizona.c:79:15: warning: excess elements in struct initializer
     .unprepare = arizona_32k_disable,
                  ^
   drivers/clk/clk-arizona.c:79:15: note: (near initialization for 'arizona_32k_ops')
   drivers/clk/clk-arizona.c: In function 'arizona_clk_of_get_pdata':
>> drivers/clk/clk-arizona.c:98:35: error: implicit declaration of function '__clk_get_name' [-Werror=implicit-function-declaration]
       arizona->pdata.clk32k_parent = __clk_get_name(mclk);
                                      ^
>> drivers/clk/clk-arizona.c:98:33: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
       arizona->pdata.clk32k_parent = __clk_get_name(mclk);
                                    ^
   drivers/clk/clk-arizona.c: In function 'arizona_clk_probe':
>> drivers/clk/clk-arizona.c:113:9: error: variable 'clk32k_init' has initializer but incomplete type
     struct clk_init_data clk32k_init = {
            ^
>> drivers/clk/clk-arizona.c:114:3: error: unknown field 'name' specified in initializer
      .name = "arizona-32k",
      ^
   drivers/clk/clk-arizona.c:114:11: warning: excess elements in struct initializer
      .name = "arizona-32k",
              ^
   drivers/clk/clk-arizona.c:114:11: note: (near initialization for 'clk32k_init')
>> drivers/clk/clk-arizona.c:115:3: error: unknown field 'ops' specified in initializer
      .ops = &arizona_32k_ops,
      ^
   drivers/clk/clk-arizona.c:115:10: warning: excess elements in struct initializer
      .ops = &arizona_32k_ops,
             ^
   drivers/clk/clk-arizona.c:115:10: note: (near initialization for 'clk32k_init')
>> drivers/clk/clk-arizona.c:113:23: error: storage size of 'clk32k_init' isn't known
     struct clk_init_data clk32k_init = {
                          ^
>> drivers/clk/clk-arizona.c:154:24: error: 'CLK_IS_ROOT' undeclared (first use in this function)
      clk32k_init.flags |= CLK_IS_ROOT;
                           ^
   drivers/clk/clk-arizona.c:154:24: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/clk/clk-arizona.c:158:20: error: implicit declaration of function 'devm_clk_register' [-Werror=implicit-function-declaration]
     clkdata->clk32k = devm_clk_register(&pdev->dev, &clkdata->clk32k_hw);
                       ^
>> drivers/clk/clk-arizona.c:113:23: warning: unused variable 'clk32k_init' [-Wunused-variable]
     struct clk_init_data clk32k_init = {
                          ^
   cc1: some warnings being treated as errors

vim +/clk32k_hw +31 drivers/clk/clk-arizona.c

bbd51c97 Charles Keepax 2016-01-05    8   *  This program is free software; you can redistribute  it and/or modify it
bbd51c97 Charles Keepax 2016-01-05    9   *  under  the terms of  the GNU General  Public License as published by the
bbd51c97 Charles Keepax 2016-01-05   10   *  Free Software Foundation;  either version 2 of the  License, or (at your
bbd51c97 Charles Keepax 2016-01-05   11   *  option) any later version.
bbd51c97 Charles Keepax 2016-01-05   12   */
bbd51c97 Charles Keepax 2016-01-05   13  
bbd51c97 Charles Keepax 2016-01-05  @14  #include <linux/clkdev.h>
bbd51c97 Charles Keepax 2016-01-05   15  #include <linux/clk-provider.h>
bbd51c97 Charles Keepax 2016-01-05   16  #include <linux/delay.h>
bbd51c97 Charles Keepax 2016-01-05   17  #include <linux/module.h>
bbd51c97 Charles Keepax 2016-01-05   18  #include <linux/slab.h>
bbd51c97 Charles Keepax 2016-01-05   19  #include <linux/platform_device.h>
bbd51c97 Charles Keepax 2016-01-05   20  #include <linux/pm_runtime.h>
bbd51c97 Charles Keepax 2016-01-05   21  
bbd51c97 Charles Keepax 2016-01-05   22  #include <linux/mfd/arizona/core.h>
bbd51c97 Charles Keepax 2016-01-05   23  #include <linux/mfd/arizona/pdata.h>
bbd51c97 Charles Keepax 2016-01-05   24  #include <linux/mfd/arizona/registers.h>
bbd51c97 Charles Keepax 2016-01-05   25  
bbd51c97 Charles Keepax 2016-01-05   26  #define CLK32K_RATE 32768
bbd51c97 Charles Keepax 2016-01-05   27  
bbd51c97 Charles Keepax 2016-01-05   28  struct arizona_clk {
bbd51c97 Charles Keepax 2016-01-05   29  	struct arizona *arizona;
bbd51c97 Charles Keepax 2016-01-05   30  
bbd51c97 Charles Keepax 2016-01-05  @31  	struct clk_hw clk32k_hw;
bbd51c97 Charles Keepax 2016-01-05   32  	struct clk *clk32k;
bbd51c97 Charles Keepax 2016-01-05   33  };
bbd51c97 Charles Keepax 2016-01-05   34  
bbd51c97 Charles Keepax 2016-01-05   35  static inline struct arizona_clk *clk32k_to_arizona_clk(struct clk_hw *hw)
bbd51c97 Charles Keepax 2016-01-05   36  {
bbd51c97 Charles Keepax 2016-01-05  @37  	return container_of(hw, struct arizona_clk, clk32k_hw);
bbd51c97 Charles Keepax 2016-01-05   38  }
bbd51c97 Charles Keepax 2016-01-05   39  
bbd51c97 Charles Keepax 2016-01-05   40  static int arizona_32k_enable(struct clk_hw *hw)
bbd51c97 Charles Keepax 2016-01-05   41  {
bbd51c97 Charles Keepax 2016-01-05   42  	struct arizona_clk *clkdata = clk32k_to_arizona_clk(hw);
bbd51c97 Charles Keepax 2016-01-05   43  	struct arizona *arizona = clkdata->arizona;
bbd51c97 Charles Keepax 2016-01-05   44  	int ret;
bbd51c97 Charles Keepax 2016-01-05   45  
bbd51c97 Charles Keepax 2016-01-05   46  	switch (arizona->pdata.clk32k_src) {
bbd51c97 Charles Keepax 2016-01-05   47  	case ARIZONA_32KZ_MCLK1:
bbd51c97 Charles Keepax 2016-01-05   48  		ret = pm_runtime_get_sync(arizona->dev);
bbd51c97 Charles Keepax 2016-01-05   49  		if (ret != 0)
bbd51c97 Charles Keepax 2016-01-05   50  			goto out;
bbd51c97 Charles Keepax 2016-01-05   51  		break;
bbd51c97 Charles Keepax 2016-01-05   52  	}
bbd51c97 Charles Keepax 2016-01-05   53  
bbd51c97 Charles Keepax 2016-01-05   54  	ret = regmap_update_bits_async(arizona->regmap, ARIZONA_CLOCK_32K_1,
bbd51c97 Charles Keepax 2016-01-05   55  				       ARIZONA_CLK_32K_ENA,
bbd51c97 Charles Keepax 2016-01-05   56  				       ARIZONA_CLK_32K_ENA);
bbd51c97 Charles Keepax 2016-01-05   57  
bbd51c97 Charles Keepax 2016-01-05   58  out:
bbd51c97 Charles Keepax 2016-01-05   59  	return ret;
bbd51c97 Charles Keepax 2016-01-05   60  }
bbd51c97 Charles Keepax 2016-01-05   61  
bbd51c97 Charles Keepax 2016-01-05   62  static void arizona_32k_disable(struct clk_hw *hw)
bbd51c97 Charles Keepax 2016-01-05   63  {
bbd51c97 Charles Keepax 2016-01-05   64  	struct arizona_clk *clkdata = clk32k_to_arizona_clk(hw);
bbd51c97 Charles Keepax 2016-01-05   65  	struct arizona *arizona = clkdata->arizona;
bbd51c97 Charles Keepax 2016-01-05   66  
bbd51c97 Charles Keepax 2016-01-05   67  	regmap_update_bits_async(arizona->regmap, ARIZONA_CLOCK_32K_1,
bbd51c97 Charles Keepax 2016-01-05   68  				 ARIZONA_CLK_32K_ENA, 0);
bbd51c97 Charles Keepax 2016-01-05   69  
bbd51c97 Charles Keepax 2016-01-05   70  	switch (arizona->pdata.clk32k_src) {
bbd51c97 Charles Keepax 2016-01-05   71  	case ARIZONA_32KZ_MCLK1:
bbd51c97 Charles Keepax 2016-01-05   72  		pm_runtime_put_sync(arizona->dev);
bbd51c97 Charles Keepax 2016-01-05   73  		break;
bbd51c97 Charles Keepax 2016-01-05   74  	}
bbd51c97 Charles Keepax 2016-01-05   75  }
bbd51c97 Charles Keepax 2016-01-05   76  
bbd51c97 Charles Keepax 2016-01-05  @77  static const struct clk_ops arizona_32k_ops = {
bbd51c97 Charles Keepax 2016-01-05  @78  	.prepare = arizona_32k_enable,
bbd51c97 Charles Keepax 2016-01-05  @79  	.unprepare = arizona_32k_disable,
bbd51c97 Charles Keepax 2016-01-05   80  };
bbd51c97 Charles Keepax 2016-01-05   81  
bbd51c97 Charles Keepax 2016-01-05   82  static int arizona_clk_of_get_pdata(struct arizona *arizona)
bbd51c97 Charles Keepax 2016-01-05   83  {
bbd51c97 Charles Keepax 2016-01-05   84  	const char * const pins[] = { "mclk1", "mclk2" };
bbd51c97 Charles Keepax 2016-01-05   85  	struct clk *mclk;
bbd51c97 Charles Keepax 2016-01-05   86  	int i;
bbd51c97 Charles Keepax 2016-01-05   87  
bbd51c97 Charles Keepax 2016-01-05   88  	if (!of_property_read_bool(arizona->dev->of_node, "clocks"))
bbd51c97 Charles Keepax 2016-01-05   89  		return 0;
bbd51c97 Charles Keepax 2016-01-05   90  
bbd51c97 Charles Keepax 2016-01-05   91  	for (i = 0; i < ARRAY_SIZE(pins); ++i) {
bbd51c97 Charles Keepax 2016-01-05   92  		mclk = of_clk_get_by_name(arizona->dev->of_node, pins[i]);
bbd51c97 Charles Keepax 2016-01-05   93  		if (IS_ERR(mclk))
bbd51c97 Charles Keepax 2016-01-05   94  			return PTR_ERR(mclk);
bbd51c97 Charles Keepax 2016-01-05   95  
bbd51c97 Charles Keepax 2016-01-05   96  		if (clk_get_rate(mclk) == CLK32K_RATE) {
bbd51c97 Charles Keepax 2016-01-05   97  			arizona->pdata.clk32k_src = ARIZONA_32KZ_MCLK1 + i;
bbd51c97 Charles Keepax 2016-01-05  @98  			arizona->pdata.clk32k_parent = __clk_get_name(mclk);
bbd51c97 Charles Keepax 2016-01-05   99  		}
bbd51c97 Charles Keepax 2016-01-05  100  
bbd51c97 Charles Keepax 2016-01-05  101  		clk_put(mclk);
bbd51c97 Charles Keepax 2016-01-05  102  	}
bbd51c97 Charles Keepax 2016-01-05  103  
bbd51c97 Charles Keepax 2016-01-05  104  	return 0;
bbd51c97 Charles Keepax 2016-01-05  105  }
bbd51c97 Charles Keepax 2016-01-05  106  
bbd51c97 Charles Keepax 2016-01-05  107  static int arizona_clk_probe(struct platform_device *pdev)
bbd51c97 Charles Keepax 2016-01-05  108  {
bbd51c97 Charles Keepax 2016-01-05  109  	struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
bbd51c97 Charles Keepax 2016-01-05  110  	struct arizona_clk *clkdata;
bbd51c97 Charles Keepax 2016-01-05  111  	int ret;
bbd51c97 Charles Keepax 2016-01-05  112  
bbd51c97 Charles Keepax 2016-01-05 @113  	struct clk_init_data clk32k_init = {
bbd51c97 Charles Keepax 2016-01-05 @114  		.name = "arizona-32k",
bbd51c97 Charles Keepax 2016-01-05 @115  		.ops = &arizona_32k_ops,
bbd51c97 Charles Keepax 2016-01-05  116  	};
bbd51c97 Charles Keepax 2016-01-05  117  
bbd51c97 Charles Keepax 2016-01-05  118  	if (IS_ENABLED(CONFIG_OF) && !dev_get_platdata(arizona->dev)) {
bbd51c97 Charles Keepax 2016-01-05  119  		ret = arizona_clk_of_get_pdata(arizona);
bbd51c97 Charles Keepax 2016-01-05  120  		if (ret) {
bbd51c97 Charles Keepax 2016-01-05  121  			dev_err(arizona->dev, "Failed parsing clock DT: %d\n",
bbd51c97 Charles Keepax 2016-01-05  122  				ret);
bbd51c97 Charles Keepax 2016-01-05  123  			return ret;
bbd51c97 Charles Keepax 2016-01-05  124  		}
bbd51c97 Charles Keepax 2016-01-05  125  	}
bbd51c97 Charles Keepax 2016-01-05  126  
bbd51c97 Charles Keepax 2016-01-05  127  	clkdata = devm_kzalloc(&pdev->dev, sizeof(*clkdata), GFP_KERNEL);
bbd51c97 Charles Keepax 2016-01-05  128  	if (!clkdata)
bbd51c97 Charles Keepax 2016-01-05  129  		return -ENOMEM;
bbd51c97 Charles Keepax 2016-01-05  130  
bbd51c97 Charles Keepax 2016-01-05  131  	clkdata->arizona = arizona;
bbd51c97 Charles Keepax 2016-01-05  132  
bbd51c97 Charles Keepax 2016-01-05  133  	switch (arizona->pdata.clk32k_src) {
bbd51c97 Charles Keepax 2016-01-05  134  	case 0:
bbd51c97 Charles Keepax 2016-01-05  135  		arizona->pdata.clk32k_src = ARIZONA_32KZ_MCLK2;
bbd51c97 Charles Keepax 2016-01-05  136  		/* Fall through */
bbd51c97 Charles Keepax 2016-01-05  137  	case ARIZONA_32KZ_MCLK1:
bbd51c97 Charles Keepax 2016-01-05  138  	case ARIZONA_32KZ_MCLK2:
bbd51c97 Charles Keepax 2016-01-05  139  	case ARIZONA_32KZ_NONE:
bbd51c97 Charles Keepax 2016-01-05  140  		regmap_update_bits(arizona->regmap, ARIZONA_CLOCK_32K_1,
bbd51c97 Charles Keepax 2016-01-05  141  				   ARIZONA_CLK_32K_SRC_MASK,
bbd51c97 Charles Keepax 2016-01-05  142  				   arizona->pdata.clk32k_src - 1);
bbd51c97 Charles Keepax 2016-01-05  143  		break;
bbd51c97 Charles Keepax 2016-01-05  144  	default:
bbd51c97 Charles Keepax 2016-01-05  145  		dev_err(arizona->dev, "Invalid 32kHz clock source: %d\n",
bbd51c97 Charles Keepax 2016-01-05  146  			arizona->pdata.clk32k_src);
bbd51c97 Charles Keepax 2016-01-05  147  		return -EINVAL;
bbd51c97 Charles Keepax 2016-01-05  148  	}
bbd51c97 Charles Keepax 2016-01-05  149  
bbd51c97 Charles Keepax 2016-01-05  150  	if (arizona->pdata.clk32k_parent) {
bbd51c97 Charles Keepax 2016-01-05  151  		clk32k_init.num_parents = 1;
bbd51c97 Charles Keepax 2016-01-05  152  		clk32k_init.parent_names = &arizona->pdata.clk32k_parent;
bbd51c97 Charles Keepax 2016-01-05  153  	} else {
bbd51c97 Charles Keepax 2016-01-05 @154  		clk32k_init.flags |= CLK_IS_ROOT;
bbd51c97 Charles Keepax 2016-01-05  155  	}
bbd51c97 Charles Keepax 2016-01-05  156  
bbd51c97 Charles Keepax 2016-01-05  157  	clkdata->clk32k_hw.init = &clk32k_init;
bbd51c97 Charles Keepax 2016-01-05 @158  	clkdata->clk32k = devm_clk_register(&pdev->dev, &clkdata->clk32k_hw);
bbd51c97 Charles Keepax 2016-01-05  159  	if (IS_ERR(clkdata->clk32k)) {
bbd51c97 Charles Keepax 2016-01-05  160  		ret = PTR_ERR(clkdata->clk32k);
bbd51c97 Charles Keepax 2016-01-05  161  		dev_err(arizona->dev, "Failed to register 32k clock: %d\n",

:::::: The code at line 31 was first introduced by commit
:::::: bbd51c97104a0151ab632cf717b7119124291e1a clk: arizona: Add clock driver for the Arizona devices

:::::: TO: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
:::::: CC: 0day robot <fengguang.wu@intel.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 22276 bytes --]

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

* Re: [PATCH 2/4] clk: arizona: Add clock driver for the Arizona devices
  2016-01-05 15:41   ` Charles Keepax
  (?)
@ 2016-01-06  1:45   ` Stephen Boyd
  -1 siblings, 0 replies; 13+ messages in thread
From: Stephen Boyd @ 2016-01-06  1:45 UTC (permalink / raw)
  To: Charles Keepax
  Cc: mturquette, cw00.choi, lee.jones, myungjoo.ham, devicetree,
	linux-clk, linux-kernel, patches

On 01/05, Charles Keepax wrote:
> 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 <ckeepax@opensource.wolfsonmicro.com>

Can this go through clk-tree without the other three patches and
nothing breaks?

> diff --git a/drivers/clk/clk-arizona.c b/drivers/clk/clk-arizona.c
> new file mode 100644
> index 0000000..1ab69ee
> --- /dev/null
> +++ b/drivers/clk/clk-arizona.c
> @@ -0,0 +1,192 @@
> +
> +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)

typically we write this as

	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 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);
> +
> +		if (clk_get_rate(mclk) == CLK32K_RATE) {
> +			arizona->pdata.clk32k_src = ARIZONA_32KZ_MCLK1 + i;
> +			arizona->pdata.clk32k_parent = __clk_get_name(mclk);
> +		}
> +
> +		clk_put(mclk);

Is this configuring some mux for the 32kHz source? Perhaps this
can be done with assigned clock parents and a set_parent clk_op
instead of with of_clk_get_by_name() in a loop over the possible
parents?

> +	}
> +
> +	return 0;
> +}
> +
> +static int arizona_clk_probe(struct platform_device *pdev)
> +{
[..]
> +
> +	if (arizona->pdata.clk32k_parent) {
> +		clk32k_init.num_parents = 1;
> +		clk32k_init.parent_names = &arizona->pdata.clk32k_parent;
> +	} else {
> +		clk32k_init.flags |= CLK_IS_ROOT;
> +	}
> +
> +	clkdata->clk32k_hw.init = &clk32k_init;
> +	clkdata->clk32k = devm_clk_register(&pdev->dev, &clkdata->clk32k_hw);
> +	if (IS_ERR(clkdata->clk32k)) {
> +		ret = PTR_ERR(clkdata->clk32k);
> +		dev_err(arizona->dev, "Failed to register 32k clock: %d\n",
> +			ret);
> +		return ret;
> +	}
> +
> +	ret = clk_register_clkdev(clkdata->clk32k, "arizona-32k",
> +				  dev_name(arizona->dev));

Any reason we register with clkdev but don't register an of clk
provider?

> +	if (ret) {
> +		dev_err(arizona->dev, "Failed to register 32k clock dev: %d\n",
> +			ret);
> +		return ret;
> +	}
> +
> +	platform_set_drvdata(pdev, clkdata);
> +
> +	return 0;
> +}

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* Re: [PATCH 3/4] mfd: arizona: Switch to using clock driver for 32k clock
  2016-01-05 16:19   ` kbuild test robot
@ 2016-01-06  9:37       ` Charles Keepax
  0 siblings, 0 replies; 13+ messages in thread
From: Charles Keepax @ 2016-01-06  9:37 UTC (permalink / raw)
  To: mturquette
  Cc: kbuild-all, mturquette, cw00.choi, lee.jones, sboyd,
	myungjoo.ham, devicetree, linux-clk, linux-kernel, patches

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

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

* Re: [PATCH 3/4] mfd: arizona: Switch to using clock driver for 32k clock
@ 2016-01-06  9:37       ` Charles Keepax
  0 siblings, 0 replies; 13+ messages in thread
From: Charles Keepax @ 2016-01-06  9:37 UTC (permalink / raw)
  Cc: kbuild-all, mturquette, cw00.choi, lee.jones, sboyd,
	myungjoo.ham, devicetree, linux-clk, linux-kernel, patches

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

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

end of thread, other threads:[~2016-01-06  9:38 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-05 15:41 [PATCH 1/4] extcon: arizona: Remove enable/disable of 32k clock Charles Keepax
2016-01-05 15:41 ` Charles Keepax
2016-01-05 15:41 ` [PATCH 2/4] clk: arizona: Add clock driver for the Arizona devices Charles Keepax
2016-01-05 15:41   ` Charles Keepax
2016-01-06  1:45   ` Stephen Boyd
2016-01-05 15:41 ` [PATCH 3/4] mfd: arizona: Switch to using clock driver for 32k clock Charles Keepax
2016-01-05 15:41   ` Charles Keepax
2016-01-05 16:19   ` kbuild test robot
2016-01-06  9:37     ` Charles Keepax
2016-01-06  9:37       ` Charles Keepax
2016-01-05 16:23   ` kbuild test robot
2016-01-05 15:41 ` [PATCH 4/4] mfd: arizona: Add device tree binding documentation for new clock driver Charles Keepax
2016-01-05 15:41   ` Charles Keepax

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