Skip to contentSkip to conversation

regulator: lochnagar: Move driver to binding from DT

PATCH In review Charles Keepax 6 participants 21 messages Nov 20, 2018 – Dec 21, 2018

Subsystems (8)
lore
Share & tools
lore

Charles Keepax

author maintainer
#0 lore raw

PATCH v5 1/8 regulator: lochnagar: Move driver to binding from DT

Based on review comments on the MFD driver, move the child drivers for the Lochnagar MFD over to binding through device tree.

---

Changes since v4:
- Split out regulator binding for each regulator

Thanks,
Charles

 drivers/regulator/lochnagar-regulator.c | 48 +++++++++++++++++++++++++--------
 1 file changed, 37 insertions(+), 11 deletions(-)
drivers/regulator/lochnagar-regulator.c +37 -11
index 182198246479..5a89e6d4b9a6 100644
@@ -13,6 +13,7 @@
 #include <linux/module.h>
 #include <linux/mutex.h>
 #include <linux/of.h>
+#include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/regmap.h>
 #include <linux/regulator/driver.h>
@@ -214,28 +215,52 @@ static const struct regulator_desc lochnagar_regulators[] = {
 	},
 };
 
+static const struct of_device_id lochnagar_of_match[] = {
+	{
+		.compatible = "cirrus,lochnagar2-micvdd",
+		.data = &lochnagar_regulators[LOCHNAGAR_MICVDD],
+	},
+	{
+		.compatible = "cirrus,lochnagar2-mic1vdd",
+		.data = &lochnagar_regulators[LOCHNAGAR_MIC1VDD],
+	},
+	{
+		.compatible = "cirrus,lochnagar2-mic2vdd",
+		.data = &lochnagar_regulators[LOCHNAGAR_MIC1VDD],
+	},
+	{
+		.compatible = "cirrus,lochnagar2-vddcore",
+		.data = &lochnagar_regulators[LOCHNAGAR_VDDCORE],
+	},
+	{},
+};
+
 static int lochnagar_regulator_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct lochnagar *lochnagar = dev_get_drvdata(dev->parent);
 	struct regulator_config config = { };
+	const struct of_device_id *of_id;
+	const struct regulator_desc *desc;
 	struct regulator_dev *rdev;
-	int ret, i;
+	int ret;
 
-	config.dev = lochnagar->dev;
+	config.dev = dev;
 	config.regmap = lochnagar->regmap;
 	config.driver_data = lochnagar;
 
-	for (i = 0; i < ARRAY_SIZE(lochnagar_regulators); i++) {
-		const struct regulator_desc *desc = &lochnagar_regulators[i];
+	of_id = of_match_device(lochnagar_of_match, dev);
+	if (!of_id)
+		return -EINVAL;
 
-		rdev = devm_regulator_register(dev, desc, &config);
-		if (IS_ERR(rdev)) {
-			ret = PTR_ERR(rdev);
-			dev_err(dev, "Failed to register %s regulator: %d\n",
-				desc->name, ret);
-			return ret;
-		}
+	desc = of_id->data;
+
+	rdev = devm_regulator_register(dev, desc, &config);
+	if (IS_ERR(rdev)) {
+		ret = PTR_ERR(rdev);
+		dev_err(dev, "Failed to register %s regulator: %d\n",
+			desc->name, ret);
+		return ret;
 	}
 
 	return 0;
@@ -244,6 +269,7 @@ static int lochnagar_regulator_probe(struct platform_device *pdev)
 static struct platform_driver lochnagar_regulator_driver = {
 	.driver = {
 		.name = "lochnagar-regulator",
+		.of_match_table = of_match_ptr(lochnagar_of_match),
 	},
 
 	.probe = lochnagar_regulator_probe,
Signature · 1 line
2.11.0
author maintainer
#1 lore raw

PATCH v5 2/8 mfd: lochnagar: Add initial binding documentation

Lochnagar is an evaluation and development board for Cirrus Logic Smart CODEC and Amp devices. It allows the connection of most Cirrus Logic devices on mini-cards, as well as allowing connection of various application processor systems to provide a full evaluation platform. This driver supports the board controller chip on the Lochnagar board.

---

Changes since v4:
- Move sub-bindings into separate documents

Again incase Rob missed v4 I have dropped his ack due to the large changes introduced in v4, see:

https://patchwork.kernel.org/patch/10673891/

Thanks,
Charles

 .../devicetree/bindings/mfd/cirrus,lochnagar.txt   |  71 +++++++++++
 include/dt-bindings/clk/lochnagar.h                |  26 ++++
 include/dt-bindings/pinctrl/lochnagar.h            | 132 +++++++++++++++++++++
 3 files changed, 229 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/cirrus,lochnagar.txt
 create mode 100644 include/dt-bindings/clk/lochnagar.h
 create mode 100644 include/dt-bindings/pinctrl/lochnagar.h
Documentation/devicetree/bindings/mfd/cirrus,lochnagar.txt new file +71 -0
new file mode 100644
index 000000000000..7a5f99fb489d
@@ -0,0 +1,71 @@
+Cirrus Logic Lochnagar Audio Development Board
+
+Lochnagar is an evaluation and development board for Cirrus Logic
+Smart CODEC and Amp devices. It allows the connection of most Cirrus
+Logic devices on mini-cards, as well as allowing connection of
+various application processor systems to provide a full evaluation
+platform.  Audio system topology, clocking and power can all be
+controlled through the Lochnagar, allowing the device under test
+to be used in a variety of possible use cases.
+
+Also see these documents for generic binding information:
+  [1] GPIO : ../gpio/gpio.txt
+
+And these for relevant defines:
+  [2] include/dt-bindings/pinctrl/lochnagar.h
+  [3] include/dt-bindings/clock/lochnagar.h
+
+And these documents for the required sub-node binding details:
+  [4] Clock: ../clock/cirrus,lochnagar.txt
+  [5] Pinctrl: ../pinctrl/cirrus,lochnagar.txt
+  [6] Regulator: ../regulator/cirrus,lochnagar.txt
+
+Required properties:
+
+  - compatible : One of the following strings:
+                 "cirrus,lochnagar1"
+                 "cirrus,lochnagar2"
+
+  - reg : I2C slave address
+
+  - reset-gpios : Reset line to the Lochnagar, see [1].
+
+Required sub-nodes:
+
+  - lochnagar-clk : Binding for the clocking components, see [4].
+
+  - lochnagar-pinctrl : Binding for the pin control components, see [5].
+
+  - lochnagar-regulator : Binding for the regulator components, see [6].
+                          Only required for Lochnagar 2.
+
+Optional properties:
+
+  - present-gpios : Host present line, indicating the presence of a
+    host system, see [1]. This can be omitted if the present line is
+    tied in hardware.
+
+Example:
+
+lochnagar: lochnagar@22 {
+	compatible = "cirrus,lochnagar2";
+	reg = <0x22>;
+
+	reset-gpios = <&gpio0 55 0>;
+	present-gpios = <&gpio0 60 0>;
+
+	lochnagar-clk {
+		compatible = "cirrus,lochnagar2-clk";
+		...
+	};
+
+	lochnagar-pinctrl {
+		compatible = "cirrus,lochnagar-pinctrl";
+		...
+	};
+
+	lochnagar-regulator {
+		compatible = "cirrus,lochnagar-regulator";
+		...
+	};
+};
include/dt-bindings/clk/lochnagar.h new file +26 -0
new file mode 100644
index 000000000000..8fa20551ff17
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Device Tree defines for Lochnagar clocking
+ *
+ * Copyright (c) 2017-2018 Cirrus Logic, Inc. and
+ *                         Cirrus Logic International Semiconductor Ltd.
+ *
+ * Author: Charles Keepax <[email protected]>
+ */
+
+#ifndef DT_BINDINGS_CLK_LOCHNAGAR_H
+#define DT_BINDINGS_CLK_LOCHNAGAR_H
+
+#define LOCHNAGAR_CDC_MCLK1		0
+#define LOCHNAGAR_CDC_MCLK2		1
+#define LOCHNAGAR_DSP_CLKIN		2
+#define LOCHNAGAR_GF_CLKOUT1		3
+#define LOCHNAGAR_GF_CLKOUT2		4
+#define LOCHNAGAR_PSIA1_MCLK		5
+#define LOCHNAGAR_PSIA2_MCLK		6
+#define LOCHNAGAR_SPDIF_MCLK		7
+#define LOCHNAGAR_ADAT_MCLK		8
+#define LOCHNAGAR_SOUNDCARD_MCLK	9
+#define LOCHNAGAR_SPDIF_CLKOUT		10
+
+#endif
include/dt-bindings/pinctrl/lochnagar.h new file +132 -0

132 lines not on this page · raw message

Signature · 1 line
2.11.0
#2 lore raw

Re: [PATCH v5 2/8] mfd: lochnagar: Add initial binding documentation

Quoted 16 lines · Charles Keepax

Lochnagar is an evaluation and development board for Cirrus Logic Smart CODEC and Amp devices. It allows the connection of most Cirrus Logic devices on mini-cards, as well as allowing connection of various application processor systems to provide a full evaluation platform. This driver supports the board controller chip on the Lochnagar board.

---

Changes since v4:
- Move sub-bindings into separate documents

Again incase Rob missed v4 I have dropped his ack due to the large changes introduced in v4, see:

Quoted 6 lines

https://patchwork.kernel.org/patch/10673891/

Thanks,
Charles

 .../devicetree/bindings/mfd/cirrus,lochnagar.txt   |  71 +++++++++++

For my own reference:

Signature · 4 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
author maintainer
#3 lore raw

PATCH v5 3/8 clk: lochnagar: Add initial binding documentation

In reply to Charles Keepax

Lochnagar is an evaluation and development board for Cirrus Logic Smart CODEC and Amp devices. It allows the connection of most Cirrus Logic devices on mini-cards, as well as allowing connection of various application processor systems to provide a full evaluation platform. This driver supports the board controller chip on the Lochnagar board.

---
 .../devicetree/bindings/clock/cirrus,lochnagar.txt | 89 ++++++++++++++++++++++
 1 file changed, 89 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/cirrus,lochnagar.txt
Documentation/devicetree/bindings/clock/cirrus,lochnagar.txt new file +89 -0
new file mode 100644
index 000000000000..c1b5478d5432
@@ -0,0 +1,89 @@
+Cirrus Logic Lochnagar Audio Development Board
+
+Lochnagar is an evaluation and development board for Cirrus Logic
+Smart CODEC and Amp devices. It allows the connection of most Cirrus
+Logic devices on mini-cards, as well as allowing connection of
+various application processor systems to provide a full evaluation
+platform.  Audio system topology, clocking and power can all be
+controlled through the Lochnagar, allowing the device under test
+to be used in a variety of possible use cases.
+
+This binding document describes the binding for the clock portion of
+the driver.
+
+Also see these documents for generic binding information:
+  [1] Clock : ../clock/clock-bindings.txt
+
+And these for relevant defines:
+  [2] include/dt-bindings/clock/lochnagar.h
+
+This binding must be part of the Lochnagar MFD binding:
+  [3] ../mfd/cirrus,lochnagar.txt
+
+Required properties:
+
+  - compatible : One of the following strings:
+                 "cirrus,lochnagar1-clk"
+                 "cirrus,lochnagar2-clk"
+
+  - #clock-cells : Must be 1. The first cell indicates the clock
+    number, see [2] for available clocks and [1].
+
+Optional properties:
+
+  - clocks : Must contain an entry for each clock in clock-names.
+  - clock-names : May contain entries for each of the following
+    clocks:
+     - ln-cdc-clkout : Output clock from CODEC card.
+     - ln-dsp-clkout : Output clock from DSP card.
+     - ln-gf-mclk1,ln-gf-mclk2,ln-gf-mclk3,ln-gf-mclk4 : Optional
+       input audio clocks from host system.
+     - ln-psia1-mclk, ln-psia2-mclk : Optional input audio clocks from
+       external connector.
+     - ln-spdif-clkout : Optional input audio clock from SPDIF.
+     - ln-adat-clkout : Optional input audio clock from ADAT.
+     - ln-pmic-32k : On board fixed regulator.
+     - ln-clk-12m : On board fixed regulator.
+     - ln-clk-11m : On board fixed regulator.
+     - ln-clk-24m : On board fixed regulator.
+     - ln-clk-22m : On board fixed regulator.
+     - ln-usb-clk-24m : On board fixed regulator.
+     - ln-usb-clk-12m : On board fixed regulator.
+
+  - assigned-clocks : A list of Lochnagar clocks to be reparented, see
+    [2] for available clocks.
+  - assigned-clock-parents : Parents to be assigned to the clocks
+    listed in "assigned-clocks".
+
+Optional sub-nodes:
+
+  - fixed-clock nodes may be registered for the following on board clocks:
+     - ln-pmic-32k : 32768 kHz
+     - ln-clk-12m : 12288000 kHz
+     - ln-clk-11m : 11298600 kHz
+     - ln-clk-24m : 24576000 kHz
+     - ln-clk-22m : 22579200 kHz
+     - ln-usb-clk-24m : 24576000 kHz
+     - ln-usb-clk-12m : 12288000 kHz
+
+Example:
+
+lochnagar-clk {
+	compatible = "cirrus,lochnagar2-clk";
+
+	#clock-cells = <1>;
+
+	clocks = <&clk-audio>, <&clk_pmic>;
+	clock-names = "ln-gf-mclk2", "ln-pmic-32k";
+
+	assigned-clocks = <&lochnagar-clk LOCHNAGAR_CDC_MCLK1>,
+			  <&lochnagar-clk LOCHNAGAR_CDC_MCLK2>;
+	assigned-clock-parents = <&clk-audio>,
+				 <&clk-pmic>;
+
+	clk-pmic: clk-pmic {
+		compatible = "fixed-clock";
+		clock-cells = <0>;
+		clock-frequency = <32768>;
+	};
+};
Signature · 1 line
2.11.0
maintainer
#4 lore raw

Re: [PATCH v5 3/8] clk: lochnagar: Add initial binding documentation

Quoted 36 lines · Charles Keepax

Lochnagar is an evaluation and development board for Cirrus Logic Smart CODEC and Amp devices. It allows the connection of most Cirrus Logic devices on mini-cards, as well as allowing connection of various application processor systems to provide a full evaluation platform. This driver supports the board controller chip on the Lochnagar board.

---
 .../devicetree/bindings/clock/cirrus,lochnagar.txt | 89 ++++++++++++++++++++++
 1 file changed, 89 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/cirrus,lochnagar.txt
Documentation/devicetree/bindings/clock/cirrus,lochnagar.txt new file +17 -0
new file mode 100644
index 000000000000..c1b5478d5432
@@ -0,0 +1,89 @@
+Cirrus Logic Lochnagar Audio Development Board
+
+Lochnagar is an evaluation and development board for Cirrus Logic
+Smart CODEC and Amp devices. It allows the connection of most Cirrus
+Logic devices on mini-cards, as well as allowing connection of
+various application processor systems to provide a full evaluation
+platform.  Audio system topology, clocking and power can all be
+controlled through the Lochnagar, allowing the device under test
+to be used in a variety of possible use cases.
+
+This binding document describes the binding for the clock portion of
+the driver.
+
+Also see these documents for generic binding information:
+  [1] Clock : ../clock/clock-bindings.txt
+
+And these for relevant defines:

Documentation/devicetree/bindings/clock/cirrus,lochnagar.txt line 27

Quoted 10 lines
Documentation/devicetree/bindings/clock/cirrus,lochnagar.txt new file +10 -0
+  [2] include/dt-bindings/clock/lochnagar.h
+
+This binding must be part of the Lochnagar MFD binding:
+  [3] ../mfd/cirrus,lochnagar.txt
+
+Required properties:
+
+  - compatible : One of the following strings:
+                 "cirrus,lochnagar1-clk"
+                 "cirrus,lochnagar2-clk"

What's the 1 vs. 2?

Quoted 8 lines
Documentation/devicetree/bindings/clock/cirrus,lochnagar.txt new file +8 -0
+
+  - #clock-cells : Must be 1. The first cell indicates the clock
+    number, see [2] for available clocks and [1].
+
+Optional properties:
+
+  - clocks : Must contain an entry for each clock in clock-names.
+  - clock-names : May contain entries for each of the following

Documentation/devicetree/bindings/clock/cirrus,lochnagar.txt line 45

Quoted 10 lines
Documentation/devicetree/bindings/clock/cirrus,lochnagar.txt new file +10 -0
+    clocks:
+     - ln-cdc-clkout : Output clock from CODEC card.
+     - ln-dsp-clkout : Output clock from DSP card.
+     - ln-gf-mclk1,ln-gf-mclk2,ln-gf-mclk3,ln-gf-mclk4 : Optional
+       input audio clocks from host system.
+     - ln-psia1-mclk, ln-psia2-mclk : Optional input audio clocks from
+       external connector.
+     - ln-spdif-clkout : Optional input audio clock from SPDIF.
+     - ln-adat-clkout : Optional input audio clock from ADAT.
+     - ln-pmic-32k : On board fixed regulator.

regulator?

Quoted 29 lines
Documentation/devicetree/bindings/clock/cirrus,lochnagar.txt new file +29 -0
+     - ln-clk-12m : On board fixed regulator.
+     - ln-clk-11m : On board fixed regulator.
+     - ln-clk-24m : On board fixed regulator.
+     - ln-clk-22m : On board fixed regulator.
+     - ln-usb-clk-24m : On board fixed regulator.
+     - ln-usb-clk-12m : On board fixed regulator.
+
+  - assigned-clocks : A list of Lochnagar clocks to be reparented, see
+    [2] for available clocks.
+  - assigned-clock-parents : Parents to be assigned to the clocks
+    listed in "assigned-clocks".
+
+Optional sub-nodes:
+
+  - fixed-clock nodes may be registered for the following on board clocks:
+     - ln-pmic-32k : 32768 kHz
+     - ln-clk-12m : 12288000 kHz
+     - ln-clk-11m : 11298600 kHz
+     - ln-clk-24m : 24576000 kHz
+     - ln-clk-22m : 22579200 kHz
+     - ln-usb-clk-24m : 24576000 kHz
+     - ln-usb-clk-12m : 12288000 kHz
+
+Example:
+
+lochnagar-clk {
+	compatible = "cirrus,lochnagar2-clk";
+
+	#clock-cells = <1>;

Documentation/devicetree/bindings/clock/cirrus,lochnagar.txt line 84

Quoted 10 lines
Documentation/devicetree/bindings/clock/cirrus,lochnagar.txt new file +10 -0
+
+	clocks = <&clk-audio>, <&clk_pmic>;
+	clock-names = "ln-gf-mclk2", "ln-pmic-32k";
+
+	assigned-clocks = <&lochnagar-clk LOCHNAGAR_CDC_MCLK1>,
+			  <&lochnagar-clk LOCHNAGAR_CDC_MCLK2>;
+	assigned-clock-parents = <&clk-audio>,
+				 <&clk-pmic>;
+
+	clk-pmic: clk-pmic {

This isn't really any relationship to the parent and I think shouldn't be a sub-node.

Quoted 8 lines
Documentation/devicetree/bindings/clock/cirrus,lochnagar.txt new file +5 -0
+		compatible = "fixed-clock";
+		clock-cells = <0>;
+		clock-frequency = <32768>;
+	};
+};
Signature · 1 line
2.11.0
author maintainer
#5 lore raw

Re: [PATCH v5 3/8] clk: lochnagar: Add initial binding documentation

Quoted 8 lines · Rob Herring
Quoted 7 lines · Charles Keepax

Lochnagar is an evaluation and development board for Cirrus Logic Smart CODEC and Amp devices. It allows the connection of most Cirrus Logic devices on mini-cards, as well as allowing connection of various application processor systems to provide a full evaluation platform. This driver supports the board controller chip on the Lochnagar board.

Quoted 8 lines

Documentation/devicetree/bindings/clock/cirrus,lochnagar.txt line 27

Quoted 5 lines

---

Documentation/devicetree/bindings/clock/cirrus,lochnagar.txt new file +3 -0
+  - compatible : One of the following strings:
+                 "cirrus,lochnagar1-clk"
+                 "cirrus,lochnagar2-clk"

What's the 1 vs. 2?

There are two versions of the device, we need to be able to differenciate between them in the driver.

Quoted 3 lines
Quoted 1 line

+ - ln-pmic-32k : On board fixed regulator.

regulator?

Well that is a spectacular copy and paste oversight sorry about that will get it fixed up.

Quoted 17 lines
Quoted 17 lines
Documentation/devicetree/bindings/clock/cirrus,lochnagar.txt new file +15 -0
+     - ln-clk-12m : On board fixed regulator.
+     - ln-clk-11m : On board fixed regulator.
+     - ln-clk-24m : On board fixed regulator.
+     - ln-clk-22m : On board fixed regulator.
+     - ln-usb-clk-24m : On board fixed regulator.
+     - ln-usb-clk-12m : On board fixed regulator.
 
+lochnagar-clk {
+	compatible = "cirrus,lochnagar2-clk";
+
+	#clock-cells = <1>;
+
+	clocks = <&clk-audio>, <&clk_pmic>;
+	clock-names = "ln-gf-mclk2", "ln-pmic-32k";
+
+	assigned-clocks = <&lochnagar-clk LOCHNAGAR_CDC_MCLK1>,
Quoted 9 lines

Documentation/devicetree/bindings/clock/cirrus,lochnagar.txt line 84

Quoted 5 lines
Documentation/devicetree/bindings/clock/cirrus,lochnagar.txt new file +5 -0
+			  <&lochnagar-clk LOCHNAGAR_CDC_MCLK2>;
+	assigned-clock-parents = <&clk-audio>,
+				 <&clk-pmic>;
+
+	clk-pmic: clk-pmic {

This isn't really any relationship to the parent and I think shouldn't be a sub-node.

Yeah sorry that is a good point will move it out.

Thanks,
Charles

author maintainer
#6 lore raw

PATCH v5 4/8 pinctrl: lochnagar: Add initial binding documentation

In reply to Charles Keepax

Lochnagar is an evaluation and development board for Cirrus Logic Smart CODEC and Amp devices. It allows the connection of most Cirrus Logic devices on mini-cards, as well as allowing connection of various application processor systems to provide a full evaluation platform. This driver supports the board controller chip on the Lochnagar board.

---
 .../bindings/pinctrl/cirrus,lochnagar.txt          | 141 +++++++++++++++++++++
 1 file changed, 141 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/cirrus,lochnagar.txt
Documentation/devicetree/bindings/pinctrl/cirrus,lochnagar.txt new file +141 -0
new file mode 100644
index 000000000000..36de6b0555f2
@@ -0,0 +1,141 @@
+Cirrus Logic Lochnagar Audio Development Board
+
+Lochnagar is an evaluation and development board for Cirrus Logic
+Smart CODEC and Amp devices. It allows the connection of most Cirrus
+Logic devices on mini-cards, as well as allowing connection of
+various application processor systems to provide a full evaluation
+platform.  Audio system topology, clocking and power can all be
+controlled through the Lochnagar, allowing the device under test
+to be used in a variety of possible use cases.
+
+This binding document describes the binding for the pinctrl portion
+of the driver.
+
+Also see these documents for generic binding information:
+  [1] GPIO : ../gpio/gpio.txt
+  [2] Pinctrl: ../pinctrl/pinctrl-bindings.txt
+
+And these for relevant defines:
+  [3] include/dt-bindings/pinctrl/lochnagar.h
+
+This binding must be part of the Lochnagar MFD binding:
+  [4] ../mfd/cirrus,lochnagar.txt
+
+Required properties:
+
+  - compatible : One of the following strings:
+                 "cirrus,lochnagar-pinctrl"
+
+  - gpio-controller : Indicates this device is a GPIO controller.
+  - #gpio-cells : Must be 2. The first cell is the pin number, see
+    [3] for available pins and the second cell is used to specify
+    optional parameters, see [1].
+  - gpio-ranges : Range of pins managed by the GPIO controller, see
+    [1]. Both the GPIO and Pinctrl base should be set to zero and the
+    count to the appropriate of the LOCHNAGARx_PIN_NUM_GPIOS define,
+    see [3].
+
+  - pinctrl-names : A pinctrl state named "default" must be defined.
+  - pinctrl-0 : A phandle to the default pinctrl state.
+
+Required sub-nodes:
+
+The pin configurations are defined as a child of the pinctrl states
+node, see [2]. Each sub-node can have the following properties:
+  - groups : A list of groups to select (either this or "pins" must be
+    specified), available groups:
+      codec-aif1, codec-aif2, codec-aif3, dsp-aif1, dsp-aif2, psia1,
+      psia2, gf-aif1, gf-aif2, gf-aif3, gf-aif4, spdif-aif, usb-aif1,
+      usb-aif2, adat-aif, soundcard-aif
+  - pins : A list of pin names to select (either this or "groups" must
+    be specified), available pins:
+      fgpa-gpio1, fgpa-gpio2, fgpa-gpio3, fgpa-gpio4, fgpa-gpio5,
+      fgpa-gpio6, codec-gpio1, codec-gpio2, codec-gpio3, codec-gpio4,
+      codec-gpio5, codec-gpio6, codec-gpio7, codec-gpio8, dsp-gpio1,
+      dsp-gpio2, dsp-gpio3, dsp-gpio4, dsp-gpio5, dsp-gpio6, gf-gpio2,
+      gf-gpio3, gf-gpio7, codec-aif1-bclk, codec-aif1-rxdat,
+      codec-aif1-lrclk, codec-aif1-txdat, codec-aif2-bclk,
+      codec-aif2-rxdat, codec-aif2-lrclk, codec-aif2-txdat,
+      codec-aif3-bclk, codec-aif3-rxdat, codec-aif3-lrclk,
+      codec-aif3-txdat, dsp-aif1-bclk, dsp-aif1-rxdat, dsp-aif1-lrclk,
+      dsp-aif1-txdat, dsp-aif2-bclk, dsp-aif2-rxdat,
+      dsp-aif2-lrclk, dsp-aif2-txdat, psia1-bclk, psia1-rxdat,
+      psia1-lrclk, psia1-txdat, psia2-bclk, psia2-rxdat, psia2-lrclk,
+      psia2-txdat, gf-aif3-bclk, gf-aif3-rxdat, gf-aif3-lrclk,
+      gf-aif3-txdat, gf-aif4-bclk, gf-aif4-rxdat, gf-aif4-lrclk,
+      gf-aif4-txdat, gf-aif1-bclk, gf-aif1-rxdat, gf-aif1-lrclk,
+      gf-aif1-txdat, gf-aif2-bclk, gf-aif2-rxdat, gf-aif2-lrclk,
+      gf-aif2-txdat, dsp-uart1-rx, dsp-uart1-tx, dsp-uart2-rx,
+      dsp-uart2-tx, gf-uart2-rx, gf-uart2-tx, usb-uart-rx,
+      codec-pdmclk1, codec-pdmdat1, codec-pdmclk2, codec-pdmdat2,
+      codec-dmicclk1, codec-dmicdat1, codec-dmicclk2, codec-dmicdat2,
+      codec-dmicclk3, codec-dmicdat3, codec-dmicclk4, codec-dmicdat4,
+      dsp-dmicclk1, dsp-dmicdat1, dsp-dmicclk2, dsp-dmicdat2, i2c2-scl,
+      i2c2-sda, i2c3-scl, i2c3-sda, i2c4-scl, i2c4-sda, dsp-standby,
+      codec-mclk1, codec-mclk2, dsp-clkin, psia1-mclk, psia2-mclk,
+      gf-gpio1, gf-gpio5, dsp-gpio20, led1, led2
+  - function : The mux function to select, available functions:
+      aif, fgpa-gpio1, fgpa-gpio2, fgpa-gpio3, fgpa-gpio4, fgpa-gpio5,
+      fgpa-gpio6, codec-gpio1, codec-gpio2, codec-gpio3, codec-gpio4,
+      codec-gpio5, codec-gpio6, codec-gpio7, codec-gpio8, dsp-gpio1,
+      dsp-gpio2, dsp-gpio3, dsp-gpio4, dsp-gpio5, dsp-gpio6, gf-gpio2,
+      gf-gpio3, gf-gpio7, gf-gpio1, gf-gpio5, dsp-gpio20, codec-clkout,
+      dsp-clkout, pmic-32k, spdif-clkout, clk-12m288, clk-11m2986,
+      clk-24m576, clk-22m5792, xmos-mclk, gf-clkout1, gf-mclk1,
+      gf-mclk3, gf-mclk2, gf-clkout2, codec-mclk1, codec-mclk2,
+      dsp-clkin, psia1-mclk, psia2-mclk, spdif-mclk, codec-irq,
+      codec-reset, dsp-reset, dsp-irq, dsp-standby, codec-pdmclk1,
+      codec-pdmdat1, codec-pdmclk2, codec-pdmdat2, codec-dmicclk1,
+      codec-dmicdat1, codec-dmicclk2, codec-dmicdat2, codec-dmicclk3,
+      codec-dmicdat3, codec-dmicclk4, codec-dmicdat4, dsp-dmicclk1,
+      dsp-dmicdat1, dsp-dmicclk2, dsp-dmicdat2, dsp-uart1-rx,
+      dsp-uart1-tx, dsp-uart2-rx, dsp-uart2-tx, gf-uart2-rx,
+      gf-uart2-tx, usb-uart-rx, usb-uart-tx, i2c2-scl, i2c2-sda,
+      i2c3-scl, i2c3-sda, i2c4-scl, i2c4-sda, gpio, spdif-aif, psia1,
+      psia1-bclk, psia1-lrclk, psia1-rxdat, psia1-txdat, psia2,
+      psia2-bclk, psia2-lrclk, psia2-rxdat, psia2-txdat, codec-aif1,
+      codec-aif1-bclk, codec-aif1-lrclk, codec-aif1-rxdat,
+      codec-aif1-txdat, codec-aif2, codec-aif2-bclk, codec-aif2-lrclk,
+      codec-aif2-rxdat, codec-aif2-txdat, codec-aif3, codec-aif3-bclk,
+      codec-aif3-lrclk, codec-aif3-rxdat, codec-aif3-txdat, dsp-aif1,
+      dsp-aif1-bclk, dsp-aif1-lrclk, dsp-aif1-rxdat, dsp-aif1-txdat,
+      dsp-aif2, dsp-aif2-bclk, dsp-aif2-lrclk, dsp-aif2-rxdat,
+      dsp-aif2-txdat, gf-aif3, gf-aif3-bclk, gf-aif3-lrclk,
+      gf-aif3-rxdat, gf-aif3-txdat, gf-aif4, gf-aif4-bclk,
+      gf-aif4-lrclk, gf-aif4-rxdat, gf-aif4-txdat, gf-aif1,
+      gf-aif1-bclk, gf-aif1-lrclk, gf-aif1-rxdat, gf-aif1-txdat,
+      gf-aif2, gf-aif2-bclk, gf-aif2-lrclk, gf-aif2-rxdat,
+      gf-aif2-txdat, usb-aif1, usb-aif2, adat-aif, soundcard-aif,
+
+  - output-enable : Specifies that an AIF group will be used as a master
+    interface (either this or input-enable is required if a group is
+    being muxed to an AIF)
+  - input-enable : Specifies that an AIF group will be used as a slave
+    interface (either this or output-enable is required if a group is
+    being muxed to an AIF)
+
+Example:
+
+lochnagar-pinctrl {
+	compatible = "cirrus,lochnagar-pinctrl";
+
+	gpio-controller;
+	#gpio-cells = <2>;
+	gpio-ranges = <&lochnagar 0 0 LOCHNAGAR2_PIN_NUM_GPIOS>;
+
+	pinctrl-names = "default";
+	pinctrl-0 = <&pin-settings>;
+
+	pin-settings: pin-settings {
+		ap-aif {
+			input-enable;
+			groups = "gf-aif1";
+			function = "codec-aif3";
+		};
+		codec-aif {
+			output-enable;
+			groups = "codec-aif3";
+			function = "gf-aif1";
+		};
+	};
+};
Signature · 1 line
2.11.0
maintainer Reviewed-by on v5 4/8
#7 lore raw

Re: [PATCH v5 4/8] pinctrl: lochnagar: Add initial binding documentation

Quoted 7 lines · Charles Keepax

Lochnagar is an evaluation and development board for Cirrus Logic Smart CODEC and Amp devices. It allows the connection of most Cirrus Logic devices on mini-cards, as well as allowing connection of various application processor systems to provide a full evaluation platform. This driver supports the board controller chip on the Lochnagar board.

Quoted 6 lines
---
 .../bindings/pinctrl/cirrus,lochnagar.txt          | 141 +++++++++++++++++++++
 1 file changed, 141 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/cirrus,lochnagar.txt
Acked-by on v5 4/8
#8 lore raw

Re: [PATCH v5 4/8] pinctrl: lochnagar: Add initial binding documentation

In reply to Charles Keepax
Quoted 8 lines · Charles Keepax

Lochnagar is an evaluation and development board for Cirrus Logic Smart CODEC and Amp devices. It allows the connection of most Cirrus Logic devices on mini-cards, as well as allowing connection of various application processor systems to provide a full evaluation platform. This driver supports the board controller chip on the Lochnagar board.

Yours,
Linus Walleij

author maintainer
#9 lore raw

PATCH v5 5/8 regulator: lochnagar: Add initial binding documentation

In reply to Charles Keepax

Lochnagar is an evaluation and development board for Cirrus Logic Smart CODEC and Amp devices. It allows the connection of most Cirrus Logic devices on mini-cards, as well as allowing connection of various application processor systems to provide a full evaluation platform. This driver supports the board controller chip on the Lochnagar board.

---
 .../bindings/regulator/cirrus,lochnagar.txt        | 82 ++++++++++++++++++++++
 1 file changed, 82 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/cirrus,lochnagar.txt
Documentation/devicetree/bindings/regulator/cirrus,lochnagar.txt new file +82 -0
new file mode 100644
index 000000000000..91974e6ee251
@@ -0,0 +1,82 @@
+Cirrus Logic Lochnagar Audio Development Board
+
+Lochnagar is an evaluation and development board for Cirrus Logic
+Smart CODEC and Amp devices. It allows the connection of most Cirrus
+Logic devices on mini-cards, as well as allowing connection of
+various application processor systems to provide a full evaluation
+platform.  Audio system topology, clocking and power can all be
+controlled through the Lochnagar, allowing the device under test
+to be used in a variety of possible use cases.
+
+This binding document describes the binding for the regulator portion
+of the driver.
+
+Also see these documents for generic binding information:
+  [1] Regulator: ../regulator/regulator.txt
+
+This binding must be part of the Lochnagar MFD binding:
+  [2] ../mfd/cirrus,lochnagar.txt
+
+Optional sub-nodes:
+
+  - VDDCORE : Initialisation data for the VDDCORE regulator, which
+    supplies the CODECs digital core if it has no build regulator for that
+    purpose.
+      Required Properties:
+      - compatible : One of the following strings:
+                     "cirrus,lochnagar2-vddcore"
+      - SYSVDD-supply: Primary power supply for the Lochnagar.
+
+  - MICVDD : Initialisation data for the MICVDD regulator, which
+    supplies the CODECs MICVDD.
+      Required Properties:
+      - compatible : One of the following strings:
+                     "cirrus,lochnagar2-micvdd"
+      - SYSVDD-supply: Primary power supply for the Lochnagar.
+
+  - MIC1VDD, MIC2VDD : Initialisation data for the MICxVDD supplies.
+      Required Properties:
+      - compatible : One of the following strings:
+                     "cirrus,lochnagar2-mic1vdd", "cirrus,lochnagar2-mic2vdd"
+      Optional Properties:
+      - cirrus,micbias-input : A property selecting which of the CODEC
+        minicard micbias outputs should be used, valid values are 1 - 4.
+      - MICBIAS1-supply, MICBIAS2-supply: Regulator supplies for the
+        MICxVDD outputs, supplying the digital microphones, normally
+        supplied from the attached CODEC.
+
+  - VDD1V8 : Recommended fixed regulator for the VDD1V8 regulator, which supplies the
+    CODECs analog and 1.8V digital supplies.
+      Required Properties:
+      - compatible : Should be set to "regulator-fixed"
+      - regulator-min-microvolt : Should be set to 1.8V
+      - regulator-max-microvolt : Should be set to 1.8V
+      - regulator-boot-on
+      - regulator-always-on
+      - vin-supply : Should be set to same supply as SYSVDD
+
+Example:
+
+lochnagar {
+	lochnagar-micvdd: MICVDD {
+		compatible = "cirrus,lochnagar2-micvdd";
+
+		SYSVDD-supply = <&wallvdd>;
+
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+	};
+
+	lochnagar-vdd1v8: VDD1V8 {
+		compatible = "regulator-fixed";
+
+		regulator-name = "VDD1V8";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+		regulator-boot-on;
+		regulator-always-on;
+
+		vin-supply = <&wallvdd>;
+	};
+};
+
Signature · 1 line
2.11.0
author maintainer
#10 lore raw

PATCH v5 6/8 mfd: lochnagar: Add support for the Cirrus Logic Lochnagar

In reply to Charles Keepax

Lochnagar is an evaluation and development board for Cirrus Logic Smart CODEC and Amp devices. It allows the connection of most Cirrus Logic devices on mini-cards, as well as allowing connection of various application processor systems to provide a full evaluation platform. This driver supports the board controller chip on the Lochnagar board. Audio system topology, clocking and power can all be controlled through the Lochnagar controller chip, allowing the device under test to be used in a variety of possible use cases.

As the Lochnagar is a fairly complex device this MFD driver allows the drivers for the various features to be bound in. Initially clocking, regulator and pinctrl will be added as these are necessary to configure the system. But in time at least audio and voltage/current monitoring will also be added.

---

No change since v4.

Thanks,
Charles

 MAINTAINERS                         |  17 ++
 drivers/mfd/Kconfig                 |   8 +
 drivers/mfd/Makefile                |   2 +
 drivers/mfd/lochnagar-i2c.c         | 394 ++++++++++++++++++++++++++++++++++++
 include/linux/mfd/lochnagar.h       |  55 +++++
 include/linux/mfd/lochnagar1_regs.h | 157 ++++++++++++++
 include/linux/mfd/lochnagar2_regs.h | 253 +++++++++++++++++++++++
 7 files changed, 886 insertions(+)
 create mode 100644 drivers/mfd/lochnagar-i2c.c
 create mode 100644 include/linux/mfd/lochnagar.h
 create mode 100644 include/linux/mfd/lochnagar1_regs.h
 create mode 100644 include/linux/mfd/lochnagar2_regs.h
MAINTAINERS +17 -0
index f4855974f325..dc60dd491757 100644
@@ -3567,6 +3567,23 @@ L:	[email protected]
 S:	Maintained
 F:	drivers/net/ethernet/cirrus/ep93xx_eth.c
 
+CIRRUS LOGIC LOCHNAGAR DRIVER
+M:	Charles Keepax <[email protected]>
+M:	Richard Fitzgerald <[email protected]>
+L:	[email protected]
+S:	Supported
+F:	drivers/clk/clk-lochnagar.c
+F:	drivers/mfd/lochnagar-i2c.c
+F:	drivers/pinctrl/cirrus/pinctrl-lochnagar.c
+F:	drivers/regulator/lochnagar-regulator.c
+F:	include/dt-bindings/clk/lochnagar.h
+F:	include/dt-bindings/pinctrl/lochnagar.h
+F:	include/linux/mfd/lochnagar*
+F:	Documentation/devicetree/bindings/mfd/cirrus,lochnagar.txt
+F:	Documentation/devicetree/bindings/clock/cirrus,lochnagar.txt
+F:	Documentation/devicetree/bindings/pinctrl/cirrus,lochnagar.txt
+F:	Documentation/devicetree/bindings/regulator/cirrus,lochnagar.txt
+
 CISCO FCOE HBA DRIVER
 M:	Satish Kharat <[email protected]>
 M:	Sesidhar Baddela <[email protected]>
drivers/mfd/Kconfig +8 -0
index f461460a2aeb..f68ce6f38ceb 100644
@@ -1686,6 +1686,14 @@ config MFD_VX855
 	  VIA VX855/VX875 south bridge. You will need to enable the vx855_spi
 	  and/or vx855_gpio drivers for this to do anything useful.
 
+config MFD_LOCHNAGAR
+	bool "Cirrus Logic Lochnagar Audio Development Board"
+	select MFD_CORE
+	select REGMAP_I2C
+	depends on I2C=y && OF
+	help
+	  Support for Cirrus Logic Lochnagar audio development board.
+
 config MFD_ARIZONA
 	select REGMAP
 	select REGMAP_IRQ
drivers/mfd/Makefile +2 -0
index 12980a4ad460..93284316d530 100644
@@ -37,6 +37,8 @@ obj-$(CONFIG_MFD_T7L66XB)	+= t7l66xb.o tmio_core.o
 obj-$(CONFIG_MFD_TC6387XB)	+= tc6387xb.o tmio_core.o
 obj-$(CONFIG_MFD_TC6393XB)	+= tc6393xb.o tmio_core.o
 
+obj-$(CONFIG_MFD_LOCHNAGAR)	+= lochnagar-i2c.o
+
 obj-$(CONFIG_MFD_ARIZONA)	+= arizona-core.o
 obj-$(CONFIG_MFD_ARIZONA)	+= arizona-irq.o
 obj-$(CONFIG_MFD_ARIZONA_I2C)	+= arizona-i2c.o
drivers/mfd/lochnagar-i2c.c new file +394 -0

394 lines not on this page · raw message

include/linux/mfd/lochnagar.h new file +55 -0

55 lines not on this page · raw message

include/linux/mfd/lochnagar1_regs.h new file +157 -0

157 lines not on this page · raw message

include/linux/mfd/lochnagar2_regs.h new file +253 -0

253 lines not on this page · raw message

Signature · 1 line
2.11.0
#11 lore raw

Re: [PATCH v5 6/8] mfd: lochnagar: Add support for the Cirrus Logic Lochnagar

I love your patch! Yet something to improve:

Hi Charles,

I love your patch! Yet something to improve:

[auto build test ERROR on ljones-mfd/for-mfd-next]
[also build test ERROR on v4.20-rc3]
[cannot apply to next-20181122]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Charles-Keepax/regulator-lochnagar-Move-driver-to-binding-from-DT/20181123-133943
base:   https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next
config: sh-allyesconfig (attached as .config)
compiler: sh4-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0

reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=sh

All errors (new ones prefixed by >>):

In file included from arch/sh/include/asm/string.h:3:0,

                    from include/linux/string.h:20,
                    from include/linux/bitmap.h:9,
                    from include/linux/nodemask.h:95,
                    from include/linux/mmzone.h:17,
                    from include/linux/gfp.h:6,
                    from include/linux/umh.h:4,
                    from include/linux/kmod.h:22,
                    from include/linux/module.h:13,
                    from drivers/staging/media/bcm2048/radio-bcm2048.c:33:
   drivers/staging/media/bcm2048/radio-bcm2048.c: In function 'bcm2048_vidioc_g_audio':
   arch/sh/include/asm/string_32.h:50:42: warning: array subscript is above array bounds [-Warray-bounds]
      : "0" (__dest), "1" (__src), "r" (__src+__n)
                                        ~~~~~^~~~
   drivers/staging/iio/adc/ad7606_par.c: In function 'ad7606_par16_read_block':
   drivers/staging/iio/adc/ad7606_par.c:22:23: warning: unused variable 'st' [-Wunused-variable]
     struct ad7606_state *st = iio_priv(indio_dev);
                          ^~
   drivers/staging/iio/adc/ad7606_par.c: In function 'ad7606_par8_read_block':
   drivers/staging/iio/adc/ad7606_par.c:37:23: warning: unused variable 'st' [-Wunused-variable]
     struct ad7606_state *st = iio_priv(indio_dev);
                          ^~
   drivers/staging/media/bcm2048/radio-bcm2048.c: In function 'bcm2048_vidioc_g_tuner':
   arch/sh/include/asm/string_32.h:50:42: warning: array subscript is above array bounds [-Warray-bounds]
      : "0" (__dest), "1" (__src), "r" (__src+__n)
                                        ~~~~~^~~~
   drivers/thermal/broadcom/ns-thermal.c: In function 'ns_thermal_remove':
   drivers/thermal/broadcom/ns-thermal.c:81:21: warning: unused variable 'ns_thermal' [-Wunused-variable]
     struct ns_thermal *ns_thermal = platform_get_drvdata(pdev);
                        ^~~~~~~~~~
   In file included from arch/sh/include/asm/string.h:3:0,
                    from include/linux/string.h:20,
                    from include/linux/bitmap.h:9,
                    from include/linux/nodemask.h:95,
                    from include/linux/mmzone.h:17,
                    from include/linux/gfp.h:6,
                    from include/linux/umh.h:4,
                    from include/linux/kmod.h:22,
                    from include/linux/module.h:13,
                    from drivers/scsi/ch.c:10:
   drivers/scsi/ch.c: In function 'ch_ioctl':
   arch/sh/include/asm/string_32.h:50:42: warning: array subscript is above array bounds [-Warray-bounds]
      : "0" (__dest), "1" (__src), "r" (__src+__n)
                                        ~~~~~^~~~
   arch/sh/include/asm/string_32.h:50:42: warning: array subscript is above array bounds [-Warray-bounds]
      : "0" (__dest), "1" (__src), "r" (__src+__n)
                                        ~~~~~^~~~
   arch/sh/include/asm/string_32.h:50:42: warning: array subscript is above array bounds [-Warray-bounds]
      : "0" (__dest), "1" (__src), "r" (__src+__n)
                                        ~~~~~^~~~
   arch/sh/include/asm/string_32.h:50:42: warning: array subscript is above array bounds [-Warray-bounds]
      : "0" (__dest), "1" (__src), "r" (__src+__n)
                                        ~~~~~^~~~
   drivers/regulator/lochnagar-regulator.c: In function 'lochnagar_micbias_of_parse':
>> drivers/regulator/lochnagar-regulator.c:115:7: error: 'LOCHNAGAR2_P2_MICBIAS_SRC_SHIFT' undeclared (first use in this function); did you mean 'LOCHNAGAR_DEVICE_ID_SHIFT'?
          LOCHNAGAR2_P2_MICBIAS_SRC_SHIFT;
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          LOCHNAGAR_DEVICE_ID_SHIFT
   drivers/regulator/lochnagar-regulator.c:115:7: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/regulator/lochnagar-regulator.c:116:13: error: 'LOCHNAGAR2_P1_MICBIAS_SRC_MASK' undeclared (first use in this function); did you mean 'LOCHNAGAR2_P2_MICBIAS_SRC_SHIFT'?
     int mask = LOCHNAGAR2_P1_MICBIAS_SRC_MASK << shift;
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                LOCHNAGAR2_P2_MICBIAS_SRC_SHIFT
   In file included from drivers/regulator/lochnagar-regulator.c:18:0:
>> drivers/regulator/lochnagar-regulator.c:124:7: error: 'LOCHNAGAR2_ANALOGUE_PATH_CTRL2' undeclared (first use in this function)
          LOCHNAGAR2_ANALOGUE_PATH_CTRL2,
          ^
   include/linux/regmap.h:77:31: note: in definition of macro 'regmap_update_bits'
     regmap_update_bits_base(map, reg, mask, val, NULL, false, false)
                                  ^~~
   drivers/regulator/lochnagar-regulator.c: At top level:
>> drivers/regulator/lochnagar-regulator.c:148:17: error: 'LOCHNAGAR2_MICVDD_CTRL1' undeclared here (not in a function); did you mean 'LOCHNAGAR_MICVDD'?
      .enable_reg = LOCHNAGAR2_MICVDD_CTRL1,
                    ^~~~~~~~~~~~~~~~~~~~~~~
                    LOCHNAGAR_MICVDD
>> drivers/regulator/lochnagar-regulator.c:149:18: error: 'LOCHNAGAR2_MICVDD_REG_ENA_MASK' undeclared here (not in a function); did you mean 'LOCHNAGAR2_MICVDD_CTRL1'?
      .enable_mask = LOCHNAGAR2_MICVDD_REG_ENA_MASK,
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                     LOCHNAGAR2_MICVDD_CTRL1
>> drivers/regulator/lochnagar-regulator.c:150:15: error: 'LOCHNAGAR2_MICVDD_CTRL2' undeclared here (not in a function); did you mean 'LOCHNAGAR2_MICVDD_CTRL1'?
      .vsel_reg = LOCHNAGAR2_MICVDD_CTRL2,
                  ^~~~~~~~~~~~~~~~~~~~~~~
                  LOCHNAGAR2_MICVDD_CTRL1
>> drivers/regulator/lochnagar-regulator.c:151:16: error: 'LOCHNAGAR2_MICVDD_VSEL_MASK' undeclared here (not in a function); did you mean 'LOCHNAGAR2_MICVDD_REG_ENA_MASK'?
      .vsel_mask = LOCHNAGAR2_MICVDD_VSEL_MASK,
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
                   LOCHNAGAR2_MICVDD_REG_ENA_MASK
>> drivers/regulator/lochnagar-regulator.c:171:17: error: 'LOCHNAGAR2_ANALOGUE_PATH_CTRL2' undeclared here (not in a function); did you mean 'LOCHNAGAR2_MICVDD_CTRL2'?
      .enable_reg = LOCHNAGAR2_ANALOGUE_PATH_CTRL2,
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                    LOCHNAGAR2_MICVDD_CTRL2
>> drivers/regulator/lochnagar-regulator.c:172:18: error: 'LOCHNAGAR2_P1_INPUT_BIAS_ENA_MASK' undeclared here (not in a function); did you mean 'LOCHNAGAR2_MICVDD_REG_ENA_MASK'?
      .enable_mask = LOCHNAGAR2_P1_INPUT_BIAS_ENA_MASK,
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                     LOCHNAGAR2_MICVDD_REG_ENA_MASK
>> drivers/regulator/lochnagar-regulator.c:187:18: error: 'LOCHNAGAR2_P2_INPUT_BIAS_ENA_MASK' undeclared here (not in a function); did you mean 'LOCHNAGAR2_P1_INPUT_BIAS_ENA_MASK'?
      .enable_mask = LOCHNAGAR2_P2_INPUT_BIAS_ENA_MASK,
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                     LOCHNAGAR2_P1_INPUT_BIAS_ENA_MASK
>> drivers/regulator/lochnagar-regulator.c:201:17: error: 'LOCHNAGAR2_VDDCORE_CDC_CTRL1' undeclared here (not in a function); did you mean 'LOCHNAGAR2_MICVDD_CTRL1'?
      .enable_reg = LOCHNAGAR2_VDDCORE_CDC_CTRL1,
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
                    LOCHNAGAR2_MICVDD_CTRL1
>> drivers/regulator/lochnagar-regulator.c:202:18: error: 'LOCHNAGAR2_VDDCORE_CDC_REG_ENA_MASK' undeclared here (not in a function); did you mean 'LOCHNAGAR2_MICVDD_REG_ENA_MASK'?
      .enable_mask = LOCHNAGAR2_VDDCORE_CDC_REG_ENA_MASK,
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                     LOCHNAGAR2_MICVDD_REG_ENA_MASK
>> drivers/regulator/lochnagar-regulator.c:203:15: error: 'LOCHNAGAR2_VDDCORE_CDC_CTRL2' undeclared here (not in a function); did you mean 'LOCHNAGAR2_VDDCORE_CDC_CTRL1'?
      .vsel_reg = LOCHNAGAR2_VDDCORE_CDC_CTRL2,
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
                  LOCHNAGAR2_VDDCORE_CDC_CTRL1
>> drivers/regulator/lochnagar-regulator.c:204:16: error: 'LOCHNAGAR2_VDDCORE_CDC_VSEL_MASK' undeclared here (not in a function); did you mean 'LOCHNAGAR2_VDDCORE_CDC_REG_ENA_MASK'?
      .vsel_mask = LOCHNAGAR2_VDDCORE_CDC_VSEL_MASK,
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                   LOCHNAGAR2_VDDCORE_CDC_REG_ENA_MASK
   make[3]: *** [drivers/regulator/lochnagar-regulator.o] Error 1
   make[3]: Target '__build' not remade because of errors.
   make[2]: *** [drivers/regulator] Error 2
   In file included from arch/sh/include/asm/string.h:3:0,
                    from include/linux/string.h:20,
                    from include/linux/bitmap.h:9,
                    from include/linux/cpumask.h:12,
                    from include/linux/rcupdate.h:44,
                    from include/linux/radix-tree.h:28,
                    from include/linux/idr.h:15,
                    from include/linux/kernfs.h:14,
                    from include/linux/sysfs.h:16,
                    from include/linux/kobject.h:20,
                    from include/linux/device.h:16,
                    from include/linux/platform_device.h:14,
                    from drivers/tty/serial/xilinx_uartps.c:16:
   drivers/tty/serial/xilinx_uartps.c: In function 'cdns_uart_probe':
   arch/sh/include/asm/string_32.h:50:42: warning: array subscript is above array bounds [-Warray-bounds]
      : "0" (__dest), "1" (__src), "r" (__src+__n)
                                        ~~~~~^~~~
   In file included from arch/sh/include/asm/string.h:3:0,
                    from include/linux/string.h:20,
                    from include/linux/bitmap.h:9,
                    from include/linux/nodemask.h:95,
                    from include/linux/mmzone.h:17,
                    from include/linux/gfp.h:6,
                    from include/linux/umh.h:4,
                    from include/linux/kmod.h:22,
                    from include/linux/module.h:13,
                    from drivers/usb/gadget/udc/mv_u3d_core.c:6:
   drivers/usb/gadget/udc/mv_u3d_core.c: In function 'mv_u3d_probe':
   arch/sh/include/asm/string_32.h:50:42: warning: array subscript is above array bounds [-Warray-bounds]
      : "0" (__dest), "1" (__src), "r" (__src+__n)
                                        ~~~~~^~~~
   In file included from arch/sh/include/asm/string.h:3:0,
                    from include/linux/string.h:20,
                    from include/linux/bitmap.h:9,
                    from include/linux/nodemask.h:95,
                    from include/linux/mmzone.h:17,
                    from include/linux/gfp.h:6,
                    from include/linux/umh.h:4,
                    from include/linux/kmod.h:22,
                    from include/linux/module.h:13,
                    from drivers/usb/gadget/udc/mv_udc_core.c:8:
   drivers/usb/gadget/udc/mv_udc_core.c: In function 'mv_udc_probe':
   arch/sh/include/asm/string_32.h:50:42: warning: array subscript is above array bounds [-Warray-bounds]
      : "0" (__dest), "1" (__src), "r" (__src+__n)
                                        ~~~~~^~~~

make[2]: Target '__build' not remade because of errors.

vim +115 drivers/regulator/lochnagar-regulator.c

bef9391c Charles Keepax 2018-10-08 9

bef9391c Charles Keepax 2018-10-08   10  #include <linux/bitops.h>
bef9391c Charles Keepax 2018-10-08   11  #include <linux/device.h>
bef9391c Charles Keepax 2018-10-08   12  #include <linux/err.h>
bef9391c Charles Keepax 2018-10-08   13  #include <linux/module.h>
bef9391c Charles Keepax 2018-10-08   14  #include <linux/mutex.h>
bef9391c Charles Keepax 2018-10-08   15  #include <linux/of.h>
fda7f8cb Charles Keepax 2018-11-20   16  #include <linux/of_device.h>
bef9391c Charles Keepax 2018-10-08   17  #include <linux/platform_device.h>
bef9391c Charles Keepax 2018-10-08  @18  #include <linux/regmap.h>
bef9391c Charles Keepax 2018-10-08   19  #include <linux/regulator/driver.h>
bef9391c Charles Keepax 2018-10-08   20  #include <linux/regulator/machine.h>
bef9391c Charles Keepax 2018-10-08   21  #include <linux/regulator/of_regulator.h>
bef9391c Charles Keepax 2018-10-08   22  
bef9391c Charles Keepax 2018-10-08   23  #include <linux/mfd/lochnagar.h>
bef9391c Charles Keepax 2018-10-08   24  
bef9391c Charles Keepax 2018-10-08   25  static const struct regulator_ops lochnagar_micvdd_ops = {
bef9391c Charles Keepax 2018-10-08   26  	.enable = regulator_enable_regmap,
bef9391c Charles Keepax 2018-10-08   27  	.disable = regulator_disable_regmap,
bef9391c Charles Keepax 2018-10-08   28  	.is_enabled = regulator_is_enabled_regmap,
bef9391c Charles Keepax 2018-10-08   29  
bef9391c Charles Keepax 2018-10-08   30  	.list_voltage = regulator_list_voltage_linear_range,
bef9391c Charles Keepax 2018-10-08   31  	.map_voltage = regulator_map_voltage_linear_range,
bef9391c Charles Keepax 2018-10-08   32  
bef9391c Charles Keepax 2018-10-08   33  	.get_voltage_sel = regulator_get_voltage_sel_regmap,
bef9391c Charles Keepax 2018-10-08   34  	.set_voltage_sel = regulator_set_voltage_sel_regmap,
bef9391c Charles Keepax 2018-10-08   35  };
bef9391c Charles Keepax 2018-10-08   36  
bef9391c Charles Keepax 2018-10-08   37  static const struct regulator_linear_range lochnagar_micvdd_ranges[] = {
bef9391c Charles Keepax 2018-10-08   38  	REGULATOR_LINEAR_RANGE(1000000, 0,    0xC, 50000),
bef9391c Charles Keepax 2018-10-08   39  	REGULATOR_LINEAR_RANGE(1700000, 0xD, 0x1F, 100000),
bef9391c Charles Keepax 2018-10-08   40  };
bef9391c Charles Keepax 2018-10-08   41  
bef9391c Charles Keepax 2018-10-08   42  static int lochnagar_micbias_enable(struct regulator_dev *rdev)
bef9391c Charles Keepax 2018-10-08   43  {
bef9391c Charles Keepax 2018-10-08   44  	struct lochnagar *lochnagar = rdev_get_drvdata(rdev);
bef9391c Charles Keepax 2018-10-08   45  	int ret;
bef9391c Charles Keepax 2018-10-08   46  
bef9391c Charles Keepax 2018-10-08   47  	mutex_lock(&lochnagar->analogue_config_lock);
bef9391c Charles Keepax 2018-10-08   48  
bef9391c Charles Keepax 2018-10-08   49  	ret = regulator_enable_regmap(rdev);
bef9391c Charles Keepax 2018-10-08   50  	if (ret < 0)
bef9391c Charles Keepax 2018-10-08   51  		goto err;
bef9391c Charles Keepax 2018-10-08   52  
bef9391c Charles Keepax 2018-10-08   53  	ret = lochnagar_update_config(lochnagar);
bef9391c Charles Keepax 2018-10-08   54  
bef9391c Charles Keepax 2018-10-08   55  err:
bef9391c Charles Keepax 2018-10-08   56  	mutex_unlock(&lochnagar->analogue_config_lock);
bef9391c Charles Keepax 2018-10-08   57  
bef9391c Charles Keepax 2018-10-08   58  	return ret;
bef9391c Charles Keepax 2018-10-08   59  }
bef9391c Charles Keepax 2018-10-08   60  
bef9391c Charles Keepax 2018-10-08   61  static int lochnagar_micbias_disable(struct regulator_dev *rdev)
bef9391c Charles Keepax 2018-10-08   62  {
bef9391c Charles Keepax 2018-10-08   63  	struct lochnagar *lochnagar = rdev_get_drvdata(rdev);
bef9391c Charles Keepax 2018-10-08   64  	int ret;
bef9391c Charles Keepax 2018-10-08   65  
bef9391c Charles Keepax 2018-10-08   66  	mutex_lock(&lochnagar->analogue_config_lock);
bef9391c Charles Keepax 2018-10-08   67  
bef9391c Charles Keepax 2018-10-08   68  	ret = regulator_disable_regmap(rdev);
bef9391c Charles Keepax 2018-10-08   69  	if (ret < 0)
bef9391c Charles Keepax 2018-10-08   70  		goto err;
bef9391c Charles Keepax 2018-10-08   71  
bef9391c Charles Keepax 2018-10-08   72  	ret = lochnagar_update_config(lochnagar);
bef9391c Charles Keepax 2018-10-08   73  
bef9391c Charles Keepax 2018-10-08   74  err:
bef9391c Charles Keepax 2018-10-08   75  	mutex_unlock(&lochnagar->analogue_config_lock);
bef9391c Charles Keepax 2018-10-08   76  
bef9391c Charles Keepax 2018-10-08   77  	return ret;
bef9391c Charles Keepax 2018-10-08   78  }
bef9391c Charles Keepax 2018-10-08   79  
bef9391c Charles Keepax 2018-10-08   80  static const struct regulator_ops lochnagar_micbias_ops = {
bef9391c Charles Keepax 2018-10-08   81  	.enable = lochnagar_micbias_enable,
bef9391c Charles Keepax 2018-10-08   82  	.disable = lochnagar_micbias_disable,
bef9391c Charles Keepax 2018-10-08   83  	.is_enabled = regulator_is_enabled_regmap,
bef9391c Charles Keepax 2018-10-08   84  };
bef9391c Charles Keepax 2018-10-08   85  
bef9391c Charles Keepax 2018-10-08   86  static const struct regulator_ops lochnagar_vddcore_ops = {
bef9391c Charles Keepax 2018-10-08   87  	.enable = regulator_enable_regmap,
bef9391c Charles Keepax 2018-10-08   88  	.disable = regulator_disable_regmap,
bef9391c Charles Keepax 2018-10-08   89  	.is_enabled = regulator_is_enabled_regmap,
bef9391c Charles Keepax 2018-10-08   90  
bef9391c Charles Keepax 2018-10-08   91  	.list_voltage = regulator_list_voltage_linear_range,
bef9391c Charles Keepax 2018-10-08   92  	.map_voltage = regulator_map_voltage_linear_range,
bef9391c Charles Keepax 2018-10-08   93  
bef9391c Charles Keepax 2018-10-08   94  	.get_voltage_sel = regulator_get_voltage_sel_regmap,
bef9391c Charles Keepax 2018-10-08   95  	.set_voltage_sel = regulator_set_voltage_sel_regmap,
bef9391c Charles Keepax 2018-10-08   96  };
bef9391c Charles Keepax 2018-10-08   97  
bef9391c Charles Keepax 2018-10-08   98  static const struct regulator_linear_range lochnagar_vddcore_ranges[] = {
bef9391c Charles Keepax 2018-10-08   99  	REGULATOR_LINEAR_RANGE(600000, 0x8, 0x41, 12500),
bef9391c Charles Keepax 2018-10-08  100  };
bef9391c Charles Keepax 2018-10-08  101  
bef9391c Charles Keepax 2018-10-08  102  enum lochnagar_regulators {
bef9391c Charles Keepax 2018-10-08  103  	LOCHNAGAR_MICVDD,
bef9391c Charles Keepax 2018-10-08  104  	LOCHNAGAR_MIC1VDD,
bef9391c Charles Keepax 2018-10-08  105  	LOCHNAGAR_MIC2VDD,
bef9391c Charles Keepax 2018-10-08  106  	LOCHNAGAR_VDDCORE,
bef9391c Charles Keepax 2018-10-08  107  };
bef9391c Charles Keepax 2018-10-08  108  
bef9391c Charles Keepax 2018-10-08  109  static int lochnagar_micbias_of_parse(struct device_node *np,
bef9391c Charles Keepax 2018-10-08  110  				      const struct regulator_desc *desc,
bef9391c Charles Keepax 2018-10-08  111  				      struct regulator_config *config)
bef9391c Charles Keepax 2018-10-08  112  {
bef9391c Charles Keepax 2018-10-08  113  	struct lochnagar *lochnagar = config->driver_data;
bef9391c Charles Keepax 2018-10-08  114  	int shift = (desc->id - LOCHNAGAR_MIC1VDD) *
bef9391c Charles Keepax 2018-10-08 @115  		    LOCHNAGAR2_P2_MICBIAS_SRC_SHIFT;
bef9391c Charles Keepax 2018-10-08 @116  	int mask = LOCHNAGAR2_P1_MICBIAS_SRC_MASK << shift;
bef9391c Charles Keepax 2018-10-08  117  	unsigned int val;
bef9391c Charles Keepax 2018-10-08  118  	int ret;
bef9391c Charles Keepax 2018-10-08  119  
bef9391c Charles Keepax 2018-10-08  120  	ret = of_property_read_u32(np, "cirrus,micbias-input", &val);
bef9391c Charles Keepax 2018-10-08  121  	if (ret >= 0) {
bef9391c Charles Keepax 2018-10-08  122  		mutex_lock(&lochnagar->analogue_config_lock);
bef9391c Charles Keepax 2018-10-08  123  		ret = regmap_update_bits(lochnagar->regmap,
bef9391c Charles Keepax 2018-10-08 @124  					 LOCHNAGAR2_ANALOGUE_PATH_CTRL2,
bef9391c Charles Keepax 2018-10-08  125  					 mask, val << shift);
bef9391c Charles Keepax 2018-10-08  126  		mutex_unlock(&lochnagar->analogue_config_lock);
bef9391c Charles Keepax 2018-10-08  127  		if (ret < 0) {
bef9391c Charles Keepax 2018-10-08  128  			dev_err(lochnagar->dev,
bef9391c Charles Keepax 2018-10-08  129  				"Failed to update micbias source: %d\n", ret);
bef9391c Charles Keepax 2018-10-08  130  			return ret;
bef9391c Charles Keepax 2018-10-08  131  		}
bef9391c Charles Keepax 2018-10-08  132  	}
bef9391c Charles Keepax 2018-10-08  133  
bef9391c Charles Keepax 2018-10-08  134  	return 0;
bef9391c Charles Keepax 2018-10-08  135  }
bef9391c Charles Keepax 2018-10-08  136  
bef9391c Charles Keepax 2018-10-08  137  static const struct regulator_desc lochnagar_regulators[] = {
bef9391c Charles Keepax 2018-10-08  138  	[LOCHNAGAR_MICVDD] = {
bef9391c Charles Keepax 2018-10-08  139  		.name = "MICVDD",
bef9391c Charles Keepax 2018-10-08  140  		.supply_name = "SYSVDD",
bef9391c Charles Keepax 2018-10-08  141  		.type = REGULATOR_VOLTAGE,
bef9391c Charles Keepax 2018-10-08  142  		.n_voltages = 32,
bef9391c Charles Keepax 2018-10-08  143  		.ops = &lochnagar_micvdd_ops,
bef9391c Charles Keepax 2018-10-08  144  
bef9391c Charles Keepax 2018-10-08  145  		.id = LOCHNAGAR_MICVDD,
bef9391c Charles Keepax 2018-10-08  146  		.of_match = of_match_ptr("MICVDD"),
bef9391c Charles Keepax 2018-10-08  147  
bef9391c Charles Keepax 2018-10-08 @148  		.enable_reg = LOCHNAGAR2_MICVDD_CTRL1,
bef9391c Charles Keepax 2018-10-08 @149  		.enable_mask = LOCHNAGAR2_MICVDD_REG_ENA_MASK,
bef9391c Charles Keepax 2018-10-08 @150  		.vsel_reg = LOCHNAGAR2_MICVDD_CTRL2,
bef9391c Charles Keepax 2018-10-08 @151  		.vsel_mask = LOCHNAGAR2_MICVDD_VSEL_MASK,
bef9391c Charles Keepax 2018-10-08  152  
bef9391c Charles Keepax 2018-10-08  153  		.linear_ranges = lochnagar_micvdd_ranges,
bef9391c Charles Keepax 2018-10-08  154  		.n_linear_ranges = ARRAY_SIZE(lochnagar_micvdd_ranges),
bef9391c Charles Keepax 2018-10-08  155  
bef9391c Charles Keepax 2018-10-08  156  		.enable_time = 3000,
bef9391c Charles Keepax 2018-10-08  157  		.ramp_delay = 1000,
bef9391c Charles Keepax 2018-10-08  158  
bef9391c Charles Keepax 2018-10-08  159  		.owner = THIS_MODULE,
bef9391c Charles Keepax 2018-10-08  160  	},
bef9391c Charles Keepax 2018-10-08  161  	[LOCHNAGAR_MIC1VDD] = {
bef9391c Charles Keepax 2018-10-08  162  		.name = "MIC1VDD",
bef9391c Charles Keepax 2018-10-08  163  		.supply_name = "MICBIAS1",
bef9391c Charles Keepax 2018-10-08  164  		.type = REGULATOR_VOLTAGE,
bef9391c Charles Keepax 2018-10-08  165  		.ops = &lochnagar_micbias_ops,
bef9391c Charles Keepax 2018-10-08  166  
bef9391c Charles Keepax 2018-10-08  167  		.id = LOCHNAGAR_MIC1VDD,
bef9391c Charles Keepax 2018-10-08  168  		.of_match = of_match_ptr("MIC1VDD"),
bef9391c Charles Keepax 2018-10-08  169  		.of_parse_cb = lochnagar_micbias_of_parse,
bef9391c Charles Keepax 2018-10-08  170  
bef9391c Charles Keepax 2018-10-08 @171  		.enable_reg = LOCHNAGAR2_ANALOGUE_PATH_CTRL2,
bef9391c Charles Keepax 2018-10-08 @172  		.enable_mask = LOCHNAGAR2_P1_INPUT_BIAS_ENA_MASK,
bef9391c Charles Keepax 2018-10-08  173  
bef9391c Charles Keepax 2018-10-08  174  		.owner = THIS_MODULE,
bef9391c Charles Keepax 2018-10-08  175  	},
bef9391c Charles Keepax 2018-10-08  176  	[LOCHNAGAR_MIC2VDD] = {
bef9391c Charles Keepax 2018-10-08  177  		.name = "MIC2VDD",
bef9391c Charles Keepax 2018-10-08  178  		.supply_name = "MICBIAS2",
bef9391c Charles Keepax 2018-10-08  179  		.type = REGULATOR_VOLTAGE,
bef9391c Charles Keepax 2018-10-08  180  		.ops = &lochnagar_micbias_ops,
bef9391c Charles Keepax 2018-10-08  181  
bef9391c Charles Keepax 2018-10-08  182  		.id = LOCHNAGAR_MIC2VDD,
bef9391c Charles Keepax 2018-10-08  183  		.of_match = of_match_ptr("MIC2VDD"),
bef9391c Charles Keepax 2018-10-08  184  		.of_parse_cb = lochnagar_micbias_of_parse,
bef9391c Charles Keepax 2018-10-08  185  
bef9391c Charles Keepax 2018-10-08  186  		.enable_reg = LOCHNAGAR2_ANALOGUE_PATH_CTRL2,
bef9391c Charles Keepax 2018-10-08 @187  		.enable_mask = LOCHNAGAR2_P2_INPUT_BIAS_ENA_MASK,
bef9391c Charles Keepax 2018-10-08  188  
bef9391c Charles Keepax 2018-10-08  189  		.owner = THIS_MODULE,
bef9391c Charles Keepax 2018-10-08  190  	},
bef9391c Charles Keepax 2018-10-08  191  	[LOCHNAGAR_VDDCORE] = {
bef9391c Charles Keepax 2018-10-08  192  		.name = "VDDCORE",
bef9391c Charles Keepax 2018-10-08  193  		.supply_name = "SYSVDD",
bef9391c Charles Keepax 2018-10-08  194  		.type = REGULATOR_VOLTAGE,
bef9391c Charles Keepax 2018-10-08  195  		.n_voltages = 57,
bef9391c Charles Keepax 2018-10-08  196  		.ops = &lochnagar_vddcore_ops,
bef9391c Charles Keepax 2018-10-08  197  
bef9391c Charles Keepax 2018-10-08  198  		.id = LOCHNAGAR_VDDCORE,
bef9391c Charles Keepax 2018-10-08  199  		.of_match = of_match_ptr("VDDCORE"),
bef9391c Charles Keepax 2018-10-08  200  
bef9391c Charles Keepax 2018-10-08 @201  		.enable_reg = LOCHNAGAR2_VDDCORE_CDC_CTRL1,
bef9391c Charles Keepax 2018-10-08 @202  		.enable_mask = LOCHNAGAR2_VDDCORE_CDC_REG_ENA_MASK,
bef9391c Charles Keepax 2018-10-08 @203  		.vsel_reg = LOCHNAGAR2_VDDCORE_CDC_CTRL2,
bef9391c Charles Keepax 2018-10-08 @204  		.vsel_mask = LOCHNAGAR2_VDDCORE_CDC_VSEL_MASK,
bef9391c Charles Keepax 2018-10-08  205  
bef9391c Charles Keepax 2018-10-08  206  		.linear_ranges = lochnagar_vddcore_ranges,
bef9391c Charles Keepax 2018-10-08  207  		.n_linear_ranges = ARRAY_SIZE(lochnagar_vddcore_ranges),
bef9391c Charles Keepax 2018-10-08  208  
bef9391c Charles Keepax 2018-10-08  209  		.enable_time = 3000,
bef9391c Charles Keepax 2018-10-08  210  		.ramp_delay = 1000,
bef9391c Charles Keepax 2018-10-08  211  
bef9391c Charles Keepax 2018-10-08  212  		.owner = THIS_MODULE,
bef9391c Charles Keepax 2018-10-08  213  	},
bef9391c Charles Keepax 2018-10-08  214  };
bef9391c Charles Keepax 2018-10-08  215  

:::::: The code at line 115 was first introduced by commit
:::::: bef9391cbec547351c6a13e52f3a26bb2d271ec7 regulator: lochnagar: Add support for the Cirrus Logic Lochnagar

:::::: TO: Charles Keepax <[email protected]> :::::: CC: Mark Brown <[email protected]>

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

author maintainer
#12 lore raw

Re: [PATCH v5 6/8] mfd: lochnagar: Add support for the Cirrus Logic Lochnagar

Quoted 10 lines · kbuild test robot

Hi Charles,

I love your patch! Yet something to improve:

[auto build test ERROR on ljones-mfd/for-mfd-next]
[also build test ERROR on v4.20-rc3]
[cannot apply to next-20181122]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
drivers/regulator/lochnagar-regulator.c: In function 'lochnagar_micbias_of_parse':

Quoted 3 lines
Quoted 1 line
Quoted 1 line

drivers/regulator/lochnagar-regulator.c:115:7: error: 'LOCHNAGAR2_P2_MICBIAS_SRC_SHIFT' undeclared (first use in this function); did you mean 'LOCHNAGAR_DEVICE_ID_SHIFT'?

          LOCHNAGAR2_P2_MICBIAS_SRC_SHIFT;
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

These issues will resolve themselves in the merge, this patch is already merged in Mark's tree and will resolve the issue:

fa2bb8b97d77 ("regulator: lochnagar: Explicitly include register headers")

Thanks,
Charles

#13 lore raw

Re: [PATCH v5 6/8] mfd: lochnagar: Add support for the Cirrus Logic Lochnagar

In reply to Charles Keepax
Quoted 24 lines · Charles Keepax

Lochnagar is an evaluation and development board for Cirrus Logic Smart CODEC and Amp devices. It allows the connection of most Cirrus Logic devices on mini-cards, as well as allowing connection of various application processor systems to provide a full evaluation platform. This driver supports the board controller chip on the Lochnagar board. Audio system topology, clocking and power can all be controlled through the Lochnagar controller chip, allowing the device under test to be used in a variety of possible use cases.

As the Lochnagar is a fairly complex device this MFD driver allows the drivers for the various features to be bound in. Initially clocking, regulator and pinctrl will be added as these are necessary to configure the system. But in time at least audio and voltage/current monitoring will also be added.

---

No change since v4.

Thanks,
Charles

Quoted 12 lines
 MAINTAINERS                         |  17 ++
 drivers/mfd/Kconfig                 |   8 +
 drivers/mfd/Makefile                |   2 +
 drivers/mfd/lochnagar-i2c.c         | 394 ++++++++++++++++++++++++++++++++++++
 include/linux/mfd/lochnagar.h       |  55 +++++
 include/linux/mfd/lochnagar1_regs.h | 157 ++++++++++++++
 include/linux/mfd/lochnagar2_regs.h | 253 +++++++++++++++++++++++
 7 files changed, 886 insertions(+)
 create mode 100644 drivers/mfd/lochnagar-i2c.c
 create mode 100644 include/linux/mfd/lochnagar.h
 create mode 100644 include/linux/mfd/lochnagar1_regs.h
 create mode 100644 include/linux/mfd/lochnagar2_regs.h

For my own reference:

Signature · 4 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
author maintainer
#14 lore raw

PATCH v5 7/8 clk: lochnagar: Add support for the Cirrus Logic Lochnagar

In reply to Charles Keepax

Lochnagar is an evaluation and development board for Cirrus Logic Smart CODEC and Amp devices. It allows the connection of most Cirrus Logic devices on mini-cards, as well as allowing connection of various application processor systems to provide a full evaluation platform. This driver supports the board controller chip on the Lochnagar board.

The Lochnagar can take several input clocks from the host system, provides several of its own clock sources, and provides extensive routing options for those clocks to be supplied to the attached CODEC/Amp device.

---

No change since v4.

Thanks,
Charles

 drivers/clk/Kconfig         |   7 +
 drivers/clk/Makefile        |   1 +
 drivers/clk/clk-lochnagar.c | 360 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 368 insertions(+)
 create mode 100644 drivers/clk/clk-lochnagar.c
drivers/clk/Kconfig +7 -0
index 81cdb4eaca07..2c63c431879f 100644
@@ -219,6 +219,13 @@ config COMMON_CLK_XGENE
 	---help---
 	  Sypport for the APM X-Gene SoC reference, PLL, and device clocks.
 
+config COMMON_CLK_LOCHNAGAR
+	tristate "Cirrus Logic Lochnagar clock driver"
+	depends on MFD_LOCHNAGAR
+	help
+	  This driver supports the clocking features of the Cirrus Logic
+	  Lochnagar audio development board.
+
 config COMMON_CLK_NXP
 	def_bool COMMON_CLK && (ARCH_LPC18XX || ARCH_LPC32XX)
 	select REGMAP_MMIO if ARCH_LPC32XX
drivers/clk/Makefile +1 -0
index 72be7a38cff1..2354f0c8c8f1 100644
@@ -30,6 +30,7 @@ obj-$(CONFIG_COMMON_CLK_GEMINI)		+= clk-gemini.o
 obj-$(CONFIG_COMMON_CLK_ASPEED)		+= clk-aspeed.o
 obj-$(CONFIG_ARCH_HIGHBANK)		+= clk-highbank.o
 obj-$(CONFIG_CLK_HSDK)			+= clk-hsdk-pll.o
+obj-$(CONFIG_COMMON_CLK_LOCHNAGAR)	+= clk-lochnagar.o
 obj-$(CONFIG_COMMON_CLK_MAX77686)	+= clk-max77686.o
 obj-$(CONFIG_COMMON_CLK_MAX9485)	+= clk-max9485.o
 obj-$(CONFIG_ARCH_MOXART)		+= clk-moxart.o
drivers/clk/clk-lochnagar.c new file +360 -0

360 lines not on this page · raw message

Signature · 1 line
2.11.0
maintainer
#15 lore raw

Re: [PATCH v5 7/8] clk: lochnagar: Add support for the Cirrus Logic Lochnagar

Quoting Charles Keepax (2018-11-20 06:16:30)

Quoted 6 lines
drivers/clk/clk-lochnagar.c new file +0 -0
new file mode 100644
index 000000000000..8b2a78689715
@@ -0,0 +1,360 @@

[...]

Quoted 4 lines
drivers/clk/clk-lochnagar.c new file +4 -0
+
+static int lochnagar_regmap_set_parent(struct clk_hw *hw, u8 index)
+{
+       struct lochnagar_clk *lclk = lochnagar_hw_to_lclk(hw);

drivers/clk/clk-lochnagar.c line 175

Quoted 10 lines
drivers/clk/clk-lochnagar.c new file +10 -0
+       struct lochnagar_clk_priv *priv = lclk->priv;
+       struct regmap *regmap = priv->regmap;
+       int ret;
+
+       /*
+        * Some clocks on Lochnagar can either generate a clock themselves
+        * or accept an external clock, these default to generating the clock
+        * themselves. If we set a parent however we should update the dir_mask
+        * to indicate to the hardware that this clock will now be receiving an
+        * external clock.

Hmm ok. So the plan is to configure parents in DT or from driver code if the configuration is to accept an external clk? I guess this works.

Quoted 21 lines
drivers/clk/clk-lochnagar.c new file +21 -0
+        */
+       if (lclk->dir_mask) {
+               ret = regmap_update_bits(regmap, lclk->cfg_reg,
+                                        lclk->dir_mask, lclk->dir_mask);
+               if (ret < 0) {
+                       dev_err(priv->dev, "Failed to set %s direction: %d\n",
+                               lclk->name, ret);
+                       return ret;
+               }
+       }
+
+       ret = regmap_update_bits(regmap, lclk->src_reg, lclk->src_mask, index);
+       if (ret < 0)
+               dev_err(priv->dev, "Failed to reparent %s: %d\n",
+                       lclk->name, ret);
+
+       return ret;
+}
+
+static u8 lochnagar_regmap_get_parent(struct clk_hw *hw)
+{

drivers/clk/clk-lochnagar.c line 206

Quoted 10 lines
drivers/clk/clk-lochnagar.c new file +10 -0
+       struct lochnagar_clk *lclk = lochnagar_hw_to_lclk(hw);
+       struct lochnagar_clk_priv *priv = lclk->priv;
+       struct regmap *regmap = priv->regmap;
+       unsigned int val;
+       int ret;
+
+       ret = regmap_read(regmap, lclk->src_reg, &val);
+       if (ret < 0) {
+               dev_err(priv->dev, "Failed to read parent of %s: %d\n",
+                       lclk->name, ret);

The error messages in the above functions could be spammy. Just let drivers who fail when using these clks ops print errors and maybe downgrade these to debug? If you don't agree with this it's fine, I'll just hope to never see these prints change to debug in the future.

drivers/clk/clk-lochnagar.c line 219

Quoted 13 lines
drivers/clk/clk-lochnagar.c new file +13 -0
+               return priv->nparents;
+       }
+
+       val &= lclk->src_mask;
+
+       return val;
+}
+
+static const struct clk_ops lochnagar_clk_regmap_ops = {
+       .prepare = lochnagar_regmap_prepare,
+       .unprepare = lochnagar_regmap_unprepare,
+       .set_parent = lochnagar_regmap_set_parent,
+       .get_parent = lochnagar_regmap_get_parent,

Is regmap important to have in the name of these functions and struct? I'd prefer it was just clk instead of regmap.

Quoted 13 lines
drivers/clk/clk-lochnagar.c new file +13 -0
+};
+
+static int lochnagar_init_parents(struct lochnagar_clk_priv *priv)
+{
+       struct device_node *np = priv->dev->of_node;
+       int i, j;
+
+       switch (priv->type) {
+       case LOCHNAGAR1:
+               memcpy(priv->lclks, lochnagar1_clks, sizeof(lochnagar1_clks));
+
+               priv->nparents = ARRAY_SIZE(lochnagar1_clk_parents);
+               priv->parents = devm_kmemdup(priv->dev, lochnagar1_clk_parents,

drivers/clk/clk-lochnagar.c line 242

Quoted 10 lines
drivers/clk/clk-lochnagar.c new file +10 -0
+                                            sizeof(lochnagar1_clk_parents),
+                                            GFP_KERNEL);
+               break;
+       case LOCHNAGAR2:
+               memcpy(priv->lclks, lochnagar2_clks, sizeof(lochnagar2_clks));
+
+               priv->nparents = ARRAY_SIZE(lochnagar2_clk_parents);
+               priv->parents = devm_kmemdup(priv->dev, lochnagar2_clk_parents,
+                                            sizeof(lochnagar2_clk_parents),
+                                            GFP_KERNEL);

Why do we need to kmemdup it? The clk framework already deep copies everything from clk_init structure.

Quoted 4 lines
drivers/clk/clk-lochnagar.c new file +4 -0
+               break;
+       default:
+               dev_err(priv->dev, "Unknown Lochnagar type: %d\n", priv->type);
+               return -EINVAL;

drivers/clk/clk-lochnagar.c line 256

Quoted 10 lines
drivers/clk/clk-lochnagar.c new file +10 -0
+       }
+
+       if (!priv->parents)
+               return -ENOMEM;
+
+       for (i = 0; i < priv->nparents; i++) {
+               j = of_property_match_string(np, "clock-names",
+                                            priv->parents[i]);
+               if (j >= 0)
+                       priv->parents[i] = of_clk_get_parent_name(np, j);

Isn't this of_clk_parent_fill()? But there are holes or something?

Quoted 6 lines
drivers/clk/clk-lochnagar.c new file +6 -0
+       }
+
+       return 0;
+}
+
+static int lochnagar_init_clks(struct lochnagar_clk_priv *priv)

drivers/clk/clk-lochnagar.c line 272

Quoted 10 lines
drivers/clk/clk-lochnagar.c new file +10 -0
+{
+       struct clk_init_data clk_init = {
+               .ops = &lochnagar_clk_regmap_ops,
+               .parent_names = priv->parents,
+               .num_parents = priv->nparents,
+       };
+       struct lochnagar_clk *lclk;
+       int ret, i;
+
+       for (i = 0; i < ARRAY_SIZE(priv->lclks); i++) {

We already have an array of clks.

Quoted 8 lines
drivers/clk/clk-lochnagar.c new file +8 -0
+               lclk = &priv->lclks[i];
+
+               if (!lclk->name)
+                       continue;
+
+               clk_init.name = lclk->name;
+
+               lclk->priv = priv;

drivers/clk/clk-lochnagar.c line 290

Quoted 10 lines
drivers/clk/clk-lochnagar.c new file +10 -0
+               lclk->hw.init = &clk_init;
+
+               ret = devm_clk_hw_register(priv->dev, &lclk->hw);
+               if (ret) {
+                       dev_err(priv->dev, "Failed to register %s: %d\n",
+                               lclk->name, ret);
+                       return ret;
+               }
+
+               priv->clk_data->hws[i] = &lclk->hw;

But then we copy the pointers into here to use of_clk_hw_onecell_get(). Can you just roll your own function to use your own array of clk structures? I know it's sort of sad, but it avoids a copy.

drivers/clk/clk-lochnagar.c line 302

Quoted 12 lines
drivers/clk/clk-lochnagar.c new file +12 -0
+       }
+
+       priv->clk_data->num = ARRAY_SIZE(priv->lclks);
+
+       ret = devm_of_clk_add_hw_provider(priv->dev, of_clk_hw_onecell_get,
+                                         priv->clk_data);
+       if (ret < 0) {
+               dev_err(priv->dev, "Failed to register provider: %d\n", ret);
+               return ret;
+       }
+
+       return 0;

Simplify this to

	if (ret < 0)
		dev_err(...)

	return ret;

drivers/clk/clk-lochnagar.c line 308

Quoted 6 lines
drivers/clk/clk-lochnagar.c new file +6 -0
+}
+
+static const struct of_device_id lochnagar_of_match[] = {
+       { .compatible = "cirrus,lochnagar1-clk", .data = (void *)LOCHNAGAR1 },
+       { .compatible = "cirrus,lochnagar2-clk", .data = (void *)LOCHNAGAR2 },
+       {},

Nitpick: Drop the comma, it's the sentinel so nothing should come after.

Quoted 1 line

+};

Any MODULE_DEVICE_TABLE?

Quoted 31 lines
drivers/clk/clk-lochnagar.c new file +31 -0
+
+static int lochnagar_clk_probe(struct platform_device *pdev)
+{
+       struct device *dev = &pdev->dev;
+       struct lochnagar_clk_priv *priv;
+       const struct of_device_id *of_id;
+       int ret;
+
+       of_id = of_match_device(lochnagar_of_match, dev);
+       if (!of_id)
+               return -EINVAL;
+
+       priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+       if (!priv)
+               return -ENOMEM;
+
+       priv->clk_data = devm_kzalloc(dev, struct_size(priv->clk_data, hws,
+                                                      ARRAY_SIZE(priv->lclks)),
+                                     GFP_KERNEL);
+       if (!priv->clk_data)
+               return -ENOMEM;
+
+       priv->dev = dev;
+       priv->regmap = dev_get_regmap(dev->parent, NULL);
+       priv->type = (enum lochnagar_type)of_id->data;
+
+       ret = lochnagar_init_parents(priv);
+       if (ret)
+               return ret;
+
+       ret = lochnagar_init_clks(priv);

drivers/clk/clk-lochnagar.c line 350

Quoted 10 lines
drivers/clk/clk-lochnagar.c new file +10 -0
+       if (ret)
+               return ret;
+
+       return 0;
+}
+
+static struct platform_driver lochnagar_clk_driver = {
+       .driver = {
+               .name = "lochnagar-clk",
+               .of_match_table = of_match_ptr(lochnagar_of_match),

I suspect of_match_ptr() makes the build complain about unused match table when CONFIG_OF=N. Can you try building it that way?

drivers/clk/clk-lochnagar.c line 352

Quoted 2 lines
drivers/clk/clk-lochnagar.c new file +2 -0
+       },
+

Nitpick: Why the extra newline?

drivers/clk/clk-lochnagar.c line 360

Quoted 8 lines
drivers/clk/clk-lochnagar.c new file +8 -0
+       .probe = lochnagar_clk_probe,
+};
+module_platform_driver(lochnagar_clk_driver);
+
+MODULE_AUTHOR("Charles Keepax <[email protected]>");
+MODULE_DESCRIPTION("Clock driver for Cirrus Logic Lochnagar Board");
+MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:lochnagar-clk");

I think MODULE_ALIAS is not needed if it's this simple?

author maintainer
#16 lore raw

Re: [PATCH v5 7/8] clk: lochnagar: Add support for the Cirrus Logic Lochnagar

Quoted 1 line · Stephen Boyd

Quoting Charles Keepax (2018-11-20 06:16:30)

Apologies for the delay on this we have been very swamped at this end lately.

Quoted 16 lines
Quoted 6 lines
drivers/clk/clk-lochnagar.c new file +0 -0
new file mode 100644
index 000000000000..8b2a78689715
@@ -0,0 +1,360 @@

[...]

Quoted 9 lines
drivers/clk/clk-lochnagar.c new file +9 -0
+
+static int lochnagar_regmap_set_parent(struct clk_hw *hw, u8 index)
+{
+       struct lochnagar_clk *lclk = lochnagar_hw_to_lclk(hw);
+       struct lochnagar_clk_priv *priv = lclk->priv;
+       struct regmap *regmap = priv->regmap;
+       int ret;
+
+       /*
Quoted 9 lines

drivers/clk/clk-lochnagar.c line 175

Quoted 5 lines
drivers/clk/clk-lochnagar.c new file +5 -0
+        * Some clocks on Lochnagar can either generate a clock themselves
+        * or accept an external clock, these default to generating the clock
+        * themselves. If we set a parent however we should update the dir_mask
+        * to indicate to the hardware that this clock will now be receiving an
+        * external clock.

Hmm ok. So the plan is to configure parents in DT or from driver code if the configuration is to accept an external clk? I guess this works.

Actually from further discussions on the hardware side it seems this is handled automatically by the hardware so we no longer need to set these direction bits. As such I will remove them in the next spin.

Quoted 28 lines
Quoted 28 lines
drivers/clk/clk-lochnagar.c new file +28 -0
+        */
+       if (lclk->dir_mask) {
+               ret = regmap_update_bits(regmap, lclk->cfg_reg,
+                                        lclk->dir_mask, lclk->dir_mask);
+               if (ret < 0) {
+                       dev_err(priv->dev, "Failed to set %s direction: %d\n",
+                               lclk->name, ret);
+                       return ret;
+               }
+       }
+
+       ret = regmap_update_bits(regmap, lclk->src_reg, lclk->src_mask, index);
+       if (ret < 0)
+               dev_err(priv->dev, "Failed to reparent %s: %d\n",
+                       lclk->name, ret);
+
+       return ret;
+}
+
+static u8 lochnagar_regmap_get_parent(struct clk_hw *hw)
+{
+       struct lochnagar_clk *lclk = lochnagar_hw_to_lclk(hw);
+       struct lochnagar_clk_priv *priv = lclk->priv;
+       struct regmap *regmap = priv->regmap;
+       unsigned int val;
+       int ret;
+
+       ret = regmap_read(regmap, lclk->src_reg, &val);
Quoted 9 lines

drivers/clk/clk-lochnagar.c line 206

Quoted 3 lines
drivers/clk/clk-lochnagar.c new file +3 -0
+       if (ret < 0) {
+               dev_err(priv->dev, "Failed to read parent of %s: %d\n",
+                       lclk->name, ret);

The error messages in the above functions could be spammy. Just let drivers who fail when using these clks ops print errors and maybe downgrade these to debug? If you don't agree with this it's fine, I'll just hope to never see these prints change to debug in the future.

Seems reasonable to me I will change them to debug prints.

Quoted 8 lines
Quoted 8 lines
drivers/clk/clk-lochnagar.c new file +8 -0
+               return priv->nparents;
+       }
+
+       val &= lclk->src_mask;
+
+       return val;
+}
+
Quoted 9 lines

drivers/clk/clk-lochnagar.c line 219

Quoted 5 lines
drivers/clk/clk-lochnagar.c new file +5 -0
+static const struct clk_ops lochnagar_clk_regmap_ops = {
+       .prepare = lochnagar_regmap_prepare,
+       .unprepare = lochnagar_regmap_unprepare,
+       .set_parent = lochnagar_regmap_set_parent,
+       .get_parent = lochnagar_regmap_get_parent,

Is regmap important to have in the name of these functions and struct? I'd prefer it was just clk instead of regmap.

Again no objection happy to rename.

Quoted 18 lines
Quoted 18 lines
drivers/clk/clk-lochnagar.c new file +18 -0
+};
+
+static int lochnagar_init_parents(struct lochnagar_clk_priv *priv)
+{
+       struct device_node *np = priv->dev->of_node;
+       int i, j;
+
+       switch (priv->type) {
+       case LOCHNAGAR1:
+               memcpy(priv->lclks, lochnagar1_clks, sizeof(lochnagar1_clks));
+
+               priv->nparents = ARRAY_SIZE(lochnagar1_clk_parents);
+               priv->parents = devm_kmemdup(priv->dev, lochnagar1_clk_parents,
+                                            sizeof(lochnagar1_clk_parents),
+                                            GFP_KERNEL);
+               break;
+       case LOCHNAGAR2:
+               memcpy(priv->lclks, lochnagar2_clks, sizeof(lochnagar2_clks));
Quoted 9 lines

drivers/clk/clk-lochnagar.c line 242

Quoted 5 lines
drivers/clk/clk-lochnagar.c new file +5 -0
+
+               priv->nparents = ARRAY_SIZE(lochnagar2_clk_parents);
+               priv->parents = devm_kmemdup(priv->dev, lochnagar2_clk_parents,
+                                            sizeof(lochnagar2_clk_parents),
+                                            GFP_KERNEL);

Why do we need to kmemdup it? The clk framework already deep copies everything from clk_init structure.

The copy is needed for the updates to the list down below.

Quoted 8 lines
Quoted 8 lines
drivers/clk/clk-lochnagar.c new file +8 -0
+               break;
+       default:
+               dev_err(priv->dev, "Unknown Lochnagar type: %d\n", priv->type);
+               return -EINVAL;
+       }
+
+       if (!priv->parents)
+               return -ENOMEM;
Quoted 9 lines

drivers/clk/clk-lochnagar.c line 256

Quoted 6 lines
drivers/clk/clk-lochnagar.c new file +6 -0
+
+       for (i = 0; i < priv->nparents; i++) {
+               j = of_property_match_string(np, "clock-names",
+                                            priv->parents[i]);
+               if (j >= 0)
+                       priv->parents[i] = of_clk_get_parent_name(np, j);

Isn't this of_clk_parent_fill()? But there are holes or something?

I guess rather than a fill, this is perhaps more of a name and replace. I could make this a core function if you prefer? I think there are a couple of other drivers that could also use it, although might be worth doing that as a separate series rather than holding this one up.

Quoted 33 lines
Quoted 6 lines
drivers/clk/clk-lochnagar.c new file +6 -0
+       }
+
+       return 0;
+}
+
+static int lochnagar_init_clks(struct lochnagar_clk_priv *priv)

drivers/clk/clk-lochnagar.c line 272

Quoted 10 lines
drivers/clk/clk-lochnagar.c new file +10 -0
+{
+       struct clk_init_data clk_init = {
+               .ops = &lochnagar_clk_regmap_ops,
+               .parent_names = priv->parents,
+               .num_parents = priv->nparents,
+       };
+       struct lochnagar_clk *lclk;
+       int ret, i;
+
+       for (i = 0; i < ARRAY_SIZE(priv->lclks); i++) {

We already have an array of clks.

Quoted 14 lines
drivers/clk/clk-lochnagar.c new file +14 -0
+               lclk = &priv->lclks[i];
+
+               if (!lclk->name)
+                       continue;
+
+               clk_init.name = lclk->name;
+
+               lclk->priv = priv;
+               lclk->hw.init = &clk_init;
+
+               ret = devm_clk_hw_register(priv->dev, &lclk->hw);
+               if (ret) {
+                       dev_err(priv->dev, "Failed to register %s: %d\n",
+                               lclk->name, ret);
Quoted 9 lines

drivers/clk/clk-lochnagar.c line 290

Quoted 4 lines
drivers/clk/clk-lochnagar.c new file +4 -0
+                       return ret;
+               }
+
+               priv->clk_data->hws[i] = &lclk->hw;

But then we copy the pointers into here to use of_clk_hw_onecell_get(). Can you just roll your own function to use your own array of clk structures? I know it's sort of sad, but it avoids a copy.

Apologies for not doing it this way the first time, looks much clearer that way round.

Quoted 15 lines

drivers/clk/clk-lochnagar.c line 302

Quoted 12 lines
drivers/clk/clk-lochnagar.c new file +12 -0
+       }
+
+       priv->clk_data->num = ARRAY_SIZE(priv->lclks);
+
+       ret = devm_of_clk_add_hw_provider(priv->dev, of_clk_hw_onecell_get,
+                                         priv->clk_data);
+       if (ret < 0) {
+               dev_err(priv->dev, "Failed to register provider: %d\n", ret);
+               return ret;
+       }
+
+       return 0;

Simplify this to

Quoted 5 lines
	if (ret < 0)
		dev_err(...)

	return ret;

No problem.

Quoted 9 lines

drivers/clk/clk-lochnagar.c line 308

Quoted 6 lines
drivers/clk/clk-lochnagar.c new file +6 -0
+}
+
+static const struct of_device_id lochnagar_of_match[] = {
+       { .compatible = "cirrus,lochnagar1-clk", .data = (void *)LOCHNAGAR1 },
+       { .compatible = "cirrus,lochnagar2-clk", .data = (void *)LOCHNAGAR2 },
+       {},

Nitpick: Drop the comma, it's the sentinel so nothing should come after.

Again no problem.

Quoted 4 lines
Quoted 1 line

+};

Any MODULE_DEVICE_TABLE?

Yes oversight there, will add that.

Quoted 8 lines

drivers/clk/clk-lochnagar.c line 350

Quoted 4 lines
drivers/clk/clk-lochnagar.c new file +4 -0
+static struct platform_driver lochnagar_clk_driver = {
+       .driver = {
+               .name = "lochnagar-clk",
+               .of_match_table = of_match_ptr(lochnagar_of_match),

I suspect of_match_ptr() makes the build complain about unused match table when CONFIG_OF=N. Can you try building it that way?

The driver depends on the MFD which in turn depends on CONFIG_OF so that shouldn't be a problem.

Quoted 5 lines

drivers/clk/clk-lochnagar.c line 352

Quoted 2 lines
drivers/clk/clk-lochnagar.c new file +2 -0
+       },
+

Nitpick: Why the extra newline?

Happy to remove.

Quoted 11 lines

drivers/clk/clk-lochnagar.c line 360

Quoted 8 lines
drivers/clk/clk-lochnagar.c new file +8 -0
+       .probe = lochnagar_clk_probe,
+};
+module_platform_driver(lochnagar_clk_driver);
+
+MODULE_AUTHOR("Charles Keepax <[email protected]>");
+MODULE_DESCRIPTION("Clock driver for Cirrus Logic Lochnagar Board");
+MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:lochnagar-clk");

I think MODULE_ALIAS is not needed if it's this simple?

Not actually sure on this one, to be honest its mostly cargo culted from other drivers. I will investigate and see what I dig up but if has any pointers I would greatly appreciate it.

Should be able to send another version very shortly.

Thanks,
Charles

author maintainer
#17 lore raw

Re: [PATCH v5 7/8] clk: lochnagar: Add support for the Cirrus Logic Lochnagar

Quoted 10 lines · Charles Keepax
Quoted 8 lines · Stephen Boyd

Quoting Charles Keepax (2018-11-20 06:16:30)

drivers/clk/clk-lochnagar.c line 360

Quoted 4 lines
drivers/clk/clk-lochnagar.c new file +4 -0
+MODULE_AUTHOR("Charles Keepax <[email protected]>");
+MODULE_DESCRIPTION("Clock driver for Cirrus Logic Lochnagar Board");
+MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:lochnagar-clk");

I think MODULE_ALIAS is not needed if it's this simple?

Quoted 6 lines

Not actually sure on this one, to be honest its mostly cargo culted from other drivers. I will investigate and see what I dig up but if has any pointers I would greatly appreciate it.

From what I can find out it looks like MODULE_ALIAS is indeed

redundant on DT only drivers, which these are at the moment so will remove and give it a test.

Thanks,
Charles

maintainer
#18 lore raw

Re: [PATCH v5 7/8] clk: lochnagar: Add support for the Cirrus Logic Lochnagar

In reply to Charles Keepax

Quoting Charles Keepax (2018-12-21 05:50:37)

Quoted 21 lines · Stephen Boyd
Quoted 19 lines

Quoting Charles Keepax (2018-11-20 06:16:30)

Quoted 4 lines
drivers/clk/clk-lochnagar.c new file +4 -0
+               break;
+       default:
+               dev_err(priv->dev, "Unknown Lochnagar type: %d\n", priv->type);
+               return -EINVAL;

drivers/clk/clk-lochnagar.c line 256

Quoted 10 lines
drivers/clk/clk-lochnagar.c new file +10 -0
+       }
+
+       if (!priv->parents)
+               return -ENOMEM;
+
+       for (i = 0; i < priv->nparents; i++) {
+               j = of_property_match_string(np, "clock-names",
+                                            priv->parents[i]);
+               if (j >= 0)
+                       priv->parents[i] = of_clk_get_parent_name(np, j);

Isn't this of_clk_parent_fill()? But there are holes or something?

Quoted 5 lines

I guess rather than a fill, this is perhaps more of a name and replace. I could make this a core function if you prefer? I think there are a couple of other drivers that could also use it, although might be worth doing that as a separate series rather than holding this one up.

No worries. I'm actively changing the parent_names design anyway so this is fine.

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
drivers/clk/clk-lochnagar.c new file +4 -0
+static struct platform_driver lochnagar_clk_driver = {
+       .driver = {
+               .name = "lochnagar-clk",
+               .of_match_table = of_match_ptr(lochnagar_of_match),
Quoted 6 lines
Quoted 3 lines

I suspect of_match_ptr() makes the build complain about unused match table when CONFIG_OF=N. Can you try building it that way?

The driver depends on the MFD which in turn depends on CONFIG_OF so that shouldn't be a problem.

Ok. Then it's really not needed and it's better to drop the usage of of_match_ptr() then.

Quoted 1 line
author maintainer
#19 lore raw

PATCH v5 8/8 pinctrl: lochnagar: Add support for the Cirrus Logic Lochnagar

In reply to Charles Keepax

Lochnagar is an evaluation and development board for Cirrus Logic Smart CODEC and Amp devices. It allows the connection of most Cirrus Logic devices on mini-cards, as well as allowing connection of various application processor systems to provide a full evaluation platform. This driver supports the board controller chip on the Lochnagar board.

Lochnagar provides many pins which can generally be used for an audio function such as an AIF or a PDM interface, but also as GPIOs.

---

Changes since v4:
- Removed pinctrl-lochnagar.h and moved its contents into the source file
- Removed template chip and just set values directly

Thanks,
Charles

 drivers/pinctrl/cirrus/Kconfig             |   10 +
 drivers/pinctrl/cirrus/Makefile            |    2 +
 drivers/pinctrl/cirrus/pinctrl-lochnagar.c | 1236 ++++++++++++++++++++++++++++
 3 files changed, 1248 insertions(+)
 create mode 100644 drivers/pinctrl/cirrus/pinctrl-lochnagar.c
drivers/pinctrl/cirrus/Kconfig +10 -0
index 27013e5949bc..74af07e25174 100644
@@ -1,3 +1,13 @@
+config PINCTRL_LOCHNAGAR
+	tristate "Cirrus Logic Lochnagar pinctrl driver"
+	depends on MFD_LOCHNAGAR
+	select PINMUX
+	select PINCONF
+	select GENERIC_PINCONF
+	help
+	  This driver supports configuring the GPIO and other pin configuration
+	  of the Cirrus Logic Lochnagar audio development board.
+
 # This is all selected by the Madera MFD driver Kconfig options
 config PINCTRL_MADERA
 	tristate
drivers/pinctrl/cirrus/Makefile +2 -0
index 6e4938cde9e3..20baebf438f6 100644
@@ -1,4 +1,6 @@
 # Cirrus Logic pinctrl drivers
+obj-$(CONFIG_PINCTRL_LOCHNAGAR)	+= pinctrl-lochnagar.o
+
 pinctrl-madera-objs		:= pinctrl-madera-core.o
 ifeq ($(CONFIG_PINCTRL_CS47L35),y)
 pinctrl-madera-objs		+= pinctrl-cs47l35.o
drivers/pinctrl/cirrus/pinctrl-lochnagar.c new file +1236 -0

1,236 lines not on this page · raw message

Signature · 1 line
2.11.0
#20 lore raw

Re: [PATCH v5 8/8] pinctrl: lochnagar: Add support for the Cirrus Logic Lochnagar

I love your patch! Yet something to improve:

Hi Charles,

I love your patch! Yet something to improve:

[auto build test ERROR on ljones-mfd/for-mfd-next]
[also build test ERROR on v4.20-rc3]
[cannot apply to next-20181123]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Charles-Keepax/regulator-lochnagar-Move-driver-to-binding-from-DT/20181123-133943
base:   https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next
config: x86_64-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

>> drivers/regulator/lochnagar-regulator.c:115:21: error: undefined identifier 'LOCHNAGAR2_P2_MICBIAS_SRC_SHIFT'
>> drivers/regulator/lochnagar-regulator.c:116:20: error: undefined identifier 'LOCHNAGAR2_P1_MICBIAS_SRC_MASK'
>> drivers/regulator/lochnagar-regulator.c:123:23: error: undefined identifier 'LOCHNAGAR2_ANALOGUE_PATH_CTRL2'
>> drivers/regulator/lochnagar-regulator.c:148:31: error: undefined identifier 'LOCHNAGAR2_MICVDD_CTRL1'
>> drivers/regulator/lochnagar-regulator.c:149:32: error: undefined identifier 'LOCHNAGAR2_MICVDD_REG_ENA_MASK'
>> drivers/regulator/lochnagar-regulator.c:150:29: error: undefined identifier 'LOCHNAGAR2_MICVDD_CTRL2'
>> drivers/regulator/lochnagar-regulator.c:151:30: error: undefined identifier 'LOCHNAGAR2_MICVDD_VSEL_MASK'
   drivers/regulator/lochnagar-regulator.c:171:31: error: undefined identifier 'LOCHNAGAR2_ANALOGUE_PATH_CTRL2'
>> drivers/regulator/lochnagar-regulator.c:172:32: error: undefined identifier 'LOCHNAGAR2_P1_INPUT_BIAS_ENA_MASK'
   drivers/regulator/lochnagar-regulator.c:186:31: error: undefined identifier 'LOCHNAGAR2_ANALOGUE_PATH_CTRL2'
>> drivers/regulator/lochnagar-regulator.c:187:32: error: undefined identifier 'LOCHNAGAR2_P2_INPUT_BIAS_ENA_MASK'
>> drivers/regulator/lochnagar-regulator.c:201:31: error: undefined identifier 'LOCHNAGAR2_VDDCORE_CDC_CTRL1'
>> drivers/regulator/lochnagar-regulator.c:202:32: error: undefined identifier 'LOCHNAGAR2_VDDCORE_CDC_REG_ENA_MASK'
>> drivers/regulator/lochnagar-regulator.c:203:29: error: undefined identifier 'LOCHNAGAR2_VDDCORE_CDC_CTRL2'
>> drivers/regulator/lochnagar-regulator.c:204:30: error: undefined identifier 'LOCHNAGAR2_VDDCORE_CDC_VSEL_MASK'
   drivers/regulator/lochnagar-regulator.c: In function 'lochnagar_micbias_of_parse':
   drivers/regulator/lochnagar-regulator.c:115:7: error: 'LOCHNAGAR2_P2_MICBIAS_SRC_SHIFT' undeclared (first use in this function); did you mean 'LOCHNAGAR_DEVICE_ID_SHIFT'?
          LOCHNAGAR2_P2_MICBIAS_SRC_SHIFT;
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          LOCHNAGAR_DEVICE_ID_SHIFT
   drivers/regulator/lochnagar-regulator.c:115:7: note: each undeclared identifier is reported only once for each function it appears in
   drivers/regulator/lochnagar-regulator.c:116:13: error: 'LOCHNAGAR2_P1_MICBIAS_SRC_MASK' undeclared (first use in this function); did you mean 'LOCHNAGAR2_P2_MICBIAS_SRC_SHIFT'?
     int mask = LOCHNAGAR2_P1_MICBIAS_SRC_MASK << shift;
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                LOCHNAGAR2_P2_MICBIAS_SRC_SHIFT
   In file included from drivers/regulator/lochnagar-regulator.c:18:0:
   drivers/regulator/lochnagar-regulator.c:124:7: error: 'LOCHNAGAR2_ANALOGUE_PATH_CTRL2' undeclared (first use in this function)
          LOCHNAGAR2_ANALOGUE_PATH_CTRL2,
          ^

include/linux/regmap.h:77:31: note: in definition of macro 'regmap_update_bits'
regmap_update_bits_base(map, reg, mask, val, NULL, false, false)
^~~
drivers/regulator/lochnagar-regulator.c: At top level:
drivers/regulator/lochnagar-regulator.c:148:17: error: 'LOCHNAGAR2_MICVDD_CTRL1' undeclared here (not in a function); did you mean 'LOCHNAGAR_MICVDD'?
.enable_reg = LOCHNAGAR2_MICVDD_CTRL1,
^~~~~~~~~~~~~~~~~~~~~~~
LOCHNAGAR_MICVDD
drivers/regulator/lochnagar-regulator.c:149:18: error: 'LOCHNAGAR2_MICVDD_REG_ENA_MASK' undeclared here (not in a function); did you mean 'LOCHNAGAR2_MICVDD_CTRL1'?
.enable_mask = LOCHNAGAR2_MICVDD_REG_ENA_MASK,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LOCHNAGAR2_MICVDD_CTRL1
drivers/regulator/lochnagar-regulator.c:150:15: error: 'LOCHNAGAR2_MICVDD_CTRL2' undeclared here (not in a function); did you mean 'LOCHNAGAR2_MICVDD_CTRL1'?
.vsel_reg = LOCHNAGAR2_MICVDD_CTRL2,
^~~~~~~~~~~~~~~~~~~~~~~
LOCHNAGAR2_MICVDD_CTRL1
drivers/regulator/lochnagar-regulator.c:151:16: error: 'LOCHNAGAR2_MICVDD_VSEL_MASK' undeclared here (not in a function); did you mean 'LOCHNAGAR2_MICVDD_REG_ENA_MASK'?
.vsel_mask = LOCHNAGAR2_MICVDD_VSEL_MASK,
^~~~~~~~~~~~~~~~~~~~~~~~~~~
LOCHNAGAR2_MICVDD_REG_ENA_MASK
drivers/regulator/lochnagar-regulator.c:171:17: error: 'LOCHNAGAR2_ANALOGUE_PATH_CTRL2' undeclared here (not in a function); did you mean 'LOCHNAGAR2_MICVDD_CTRL2'?
.enable_reg = LOCHNAGAR2_ANALOGUE_PATH_CTRL2,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LOCHNAGAR2_MICVDD_CTRL2
drivers/regulator/lochnagar-regulator.c:172:18: error: 'LOCHNAGAR2_P1_INPUT_BIAS_ENA_MASK' undeclared here (not in a function); did you mean 'LOCHNAGAR2_MICVDD_REG_ENA_MASK'?
.enable_mask = LOCHNAGAR2_P1_INPUT_BIAS_ENA_MASK,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LOCHNAGAR2_MICVDD_REG_ENA_MASK
drivers/regulator/lochnagar-regulator.c:187:18: error: 'LOCHNAGAR2_P2_INPUT_BIAS_ENA_MASK' undeclared here (not in a function); did you mean 'LOCHNAGAR2_P1_INPUT_BIAS_ENA_MASK'?
.enable_mask = LOCHNAGAR2_P2_INPUT_BIAS_ENA_MASK,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LOCHNAGAR2_P1_INPUT_BIAS_ENA_MASK
drivers/regulator/lochnagar-regulator.c:201:17: error: 'LOCHNAGAR2_VDDCORE_CDC_CTRL1' undeclared here (not in a function); did you mean 'LOCHNAGAR2_MICVDD_CTRL1'?
.enable_reg = LOCHNAGAR2_VDDCORE_CDC_CTRL1,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
LOCHNAGAR2_MICVDD_CTRL1
drivers/regulator/lochnagar-regulator.c:202:18: error: 'LOCHNAGAR2_VDDCORE_CDC_REG_ENA_MASK' undeclared here (not in a function); did you mean 'LOCHNAGAR2_MICVDD_REG_ENA_MASK'?
.enable_mask = LOCHNAGAR2_VDDCORE_CDC_REG_ENA_MASK,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LOCHNAGAR2_MICVDD_REG_ENA_MASK
drivers/regulator/lochnagar-regulator.c:203:15: error: 'LOCHNAGAR2_VDDCORE_CDC_CTRL2' undeclared here (not in a function); did you mean 'LOCHNAGAR2_VDDCORE_CDC_CTRL1'?
.vsel_reg = LOCHNAGAR2_VDDCORE_CDC_CTRL2,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
LOCHNAGAR2_VDDCORE_CDC_CTRL1
drivers/regulator/lochnagar-regulator.c:204:16: error: 'LOCHNAGAR2_VDDCORE_CDC_VSEL_MASK' undeclared here (not in a function); did you mean 'LOCHNAGAR2_VDDCORE_CDC_REG_ENA_MASK'?
.vsel_mask = LOCHNAGAR2_VDDCORE_CDC_VSEL_MASK,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LOCHNAGAR2_VDDCORE_CDC_REG_ENA_MASK

vim +/LOCHNAGAR2_P2_MICBIAS_SRC_SHIFT +115 drivers/regulator/lochnagar-regulator.c

bef9391c Charles Keepax 2018-10-08  108  
bef9391c Charles Keepax 2018-10-08  109  static int lochnagar_micbias_of_parse(struct device_node *np,
bef9391c Charles Keepax 2018-10-08  110  				      const struct regulator_desc *desc,
bef9391c Charles Keepax 2018-10-08  111  				      struct regulator_config *config)
bef9391c Charles Keepax 2018-10-08  112  {
bef9391c Charles Keepax 2018-10-08  113  	struct lochnagar *lochnagar = config->driver_data;
bef9391c Charles Keepax 2018-10-08  114  	int shift = (desc->id - LOCHNAGAR_MIC1VDD) *
bef9391c Charles Keepax 2018-10-08 @115  		    LOCHNAGAR2_P2_MICBIAS_SRC_SHIFT;
bef9391c Charles Keepax 2018-10-08 @116  	int mask = LOCHNAGAR2_P1_MICBIAS_SRC_MASK << shift;
bef9391c Charles Keepax 2018-10-08  117  	unsigned int val;
bef9391c Charles Keepax 2018-10-08  118  	int ret;
bef9391c Charles Keepax 2018-10-08  119  
bef9391c Charles Keepax 2018-10-08  120  	ret = of_property_read_u32(np, "cirrus,micbias-input", &val);
bef9391c Charles Keepax 2018-10-08  121  	if (ret >= 0) {
bef9391c Charles Keepax 2018-10-08  122  		mutex_lock(&lochnagar->analogue_config_lock);
bef9391c Charles Keepax 2018-10-08 @123  		ret = regmap_update_bits(lochnagar->regmap,
bef9391c Charles Keepax 2018-10-08  124  					 LOCHNAGAR2_ANALOGUE_PATH_CTRL2,
bef9391c Charles Keepax 2018-10-08  125  					 mask, val << shift);
bef9391c Charles Keepax 2018-10-08  126  		mutex_unlock(&lochnagar->analogue_config_lock);
bef9391c Charles Keepax 2018-10-08  127  		if (ret < 0) {
bef9391c Charles Keepax 2018-10-08  128  			dev_err(lochnagar->dev,
bef9391c Charles Keepax 2018-10-08  129  				"Failed to update micbias source: %d\n", ret);
bef9391c Charles Keepax 2018-10-08  130  			return ret;
bef9391c Charles Keepax 2018-10-08  131  		}
bef9391c Charles Keepax 2018-10-08  132  	}
bef9391c Charles Keepax 2018-10-08  133  
bef9391c Charles Keepax 2018-10-08  134  	return 0;
bef9391c Charles Keepax 2018-10-08  135  }
bef9391c Charles Keepax 2018-10-08  136  
bef9391c Charles Keepax 2018-10-08  137  static const struct regulator_desc lochnagar_regulators[] = {
bef9391c Charles Keepax 2018-10-08  138  	[LOCHNAGAR_MICVDD] = {
bef9391c Charles Keepax 2018-10-08  139  		.name = "MICVDD",
bef9391c Charles Keepax 2018-10-08  140  		.supply_name = "SYSVDD",
bef9391c Charles Keepax 2018-10-08  141  		.type = REGULATOR_VOLTAGE,
bef9391c Charles Keepax 2018-10-08  142  		.n_voltages = 32,
bef9391c Charles Keepax 2018-10-08  143  		.ops = &lochnagar_micvdd_ops,
bef9391c Charles Keepax 2018-10-08  144  
bef9391c Charles Keepax 2018-10-08  145  		.id = LOCHNAGAR_MICVDD,
bef9391c Charles Keepax 2018-10-08  146  		.of_match = of_match_ptr("MICVDD"),
bef9391c Charles Keepax 2018-10-08  147  
bef9391c Charles Keepax 2018-10-08 @148  		.enable_reg = LOCHNAGAR2_MICVDD_CTRL1,
bef9391c Charles Keepax 2018-10-08 @149  		.enable_mask = LOCHNAGAR2_MICVDD_REG_ENA_MASK,
bef9391c Charles Keepax 2018-10-08 @150  		.vsel_reg = LOCHNAGAR2_MICVDD_CTRL2,
bef9391c Charles Keepax 2018-10-08 @151  		.vsel_mask = LOCHNAGAR2_MICVDD_VSEL_MASK,
bef9391c Charles Keepax 2018-10-08  152  
bef9391c Charles Keepax 2018-10-08  153  		.linear_ranges = lochnagar_micvdd_ranges,
bef9391c Charles Keepax 2018-10-08  154  		.n_linear_ranges = ARRAY_SIZE(lochnagar_micvdd_ranges),
bef9391c Charles Keepax 2018-10-08  155  
bef9391c Charles Keepax 2018-10-08  156  		.enable_time = 3000,
bef9391c Charles Keepax 2018-10-08  157  		.ramp_delay = 1000,
bef9391c Charles Keepax 2018-10-08  158  
bef9391c Charles Keepax 2018-10-08  159  		.owner = THIS_MODULE,
bef9391c Charles Keepax 2018-10-08  160  	},
bef9391c Charles Keepax 2018-10-08  161  	[LOCHNAGAR_MIC1VDD] = {
bef9391c Charles Keepax 2018-10-08  162  		.name = "MIC1VDD",
bef9391c Charles Keepax 2018-10-08  163  		.supply_name = "MICBIAS1",
bef9391c Charles Keepax 2018-10-08  164  		.type = REGULATOR_VOLTAGE,
bef9391c Charles Keepax 2018-10-08  165  		.ops = &lochnagar_micbias_ops,
bef9391c Charles Keepax 2018-10-08  166  
bef9391c Charles Keepax 2018-10-08  167  		.id = LOCHNAGAR_MIC1VDD,
bef9391c Charles Keepax 2018-10-08  168  		.of_match = of_match_ptr("MIC1VDD"),
bef9391c Charles Keepax 2018-10-08  169  		.of_parse_cb = lochnagar_micbias_of_parse,
bef9391c Charles Keepax 2018-10-08  170  
bef9391c Charles Keepax 2018-10-08  171  		.enable_reg = LOCHNAGAR2_ANALOGUE_PATH_CTRL2,
bef9391c Charles Keepax 2018-10-08 @172  		.enable_mask = LOCHNAGAR2_P1_INPUT_BIAS_ENA_MASK,
bef9391c Charles Keepax 2018-10-08  173  
bef9391c Charles Keepax 2018-10-08  174  		.owner = THIS_MODULE,
bef9391c Charles Keepax 2018-10-08  175  	},
bef9391c Charles Keepax 2018-10-08  176  	[LOCHNAGAR_MIC2VDD] = {
bef9391c Charles Keepax 2018-10-08  177  		.name = "MIC2VDD",
bef9391c Charles Keepax 2018-10-08  178  		.supply_name = "MICBIAS2",
bef9391c Charles Keepax 2018-10-08  179  		.type = REGULATOR_VOLTAGE,
bef9391c Charles Keepax 2018-10-08  180  		.ops = &lochnagar_micbias_ops,
bef9391c Charles Keepax 2018-10-08  181  
bef9391c Charles Keepax 2018-10-08  182  		.id = LOCHNAGAR_MIC2VDD,
bef9391c Charles Keepax 2018-10-08  183  		.of_match = of_match_ptr("MIC2VDD"),
bef9391c Charles Keepax 2018-10-08  184  		.of_parse_cb = lochnagar_micbias_of_parse,
bef9391c Charles Keepax 2018-10-08  185  
bef9391c Charles Keepax 2018-10-08  186  		.enable_reg = LOCHNAGAR2_ANALOGUE_PATH_CTRL2,
bef9391c Charles Keepax 2018-10-08 @187  		.enable_mask = LOCHNAGAR2_P2_INPUT_BIAS_ENA_MASK,
bef9391c Charles Keepax 2018-10-08  188  
bef9391c Charles Keepax 2018-10-08  189  		.owner = THIS_MODULE,
bef9391c Charles Keepax 2018-10-08  190  	},
bef9391c Charles Keepax 2018-10-08  191  	[LOCHNAGAR_VDDCORE] = {
bef9391c Charles Keepax 2018-10-08  192  		.name = "VDDCORE",
bef9391c Charles Keepax 2018-10-08  193  		.supply_name = "SYSVDD",
bef9391c Charles Keepax 2018-10-08  194  		.type = REGULATOR_VOLTAGE,
bef9391c Charles Keepax 2018-10-08  195  		.n_voltages = 57,
bef9391c Charles Keepax 2018-10-08  196  		.ops = &lochnagar_vddcore_ops,
bef9391c Charles Keepax 2018-10-08  197  
bef9391c Charles Keepax 2018-10-08  198  		.id = LOCHNAGAR_VDDCORE,
bef9391c Charles Keepax 2018-10-08  199  		.of_match = of_match_ptr("VDDCORE"),
bef9391c Charles Keepax 2018-10-08  200  
bef9391c Charles Keepax 2018-10-08 @201  		.enable_reg = LOCHNAGAR2_VDDCORE_CDC_CTRL1,
bef9391c Charles Keepax 2018-10-08 @202  		.enable_mask = LOCHNAGAR2_VDDCORE_CDC_REG_ENA_MASK,
bef9391c Charles Keepax 2018-10-08 @203  		.vsel_reg = LOCHNAGAR2_VDDCORE_CDC_CTRL2,
bef9391c Charles Keepax 2018-10-08 @204  		.vsel_mask = LOCHNAGAR2_VDDCORE_CDC_VSEL_MASK,
bef9391c Charles Keepax 2018-10-08  205  
bef9391c Charles Keepax 2018-10-08  206  		.linear_ranges = lochnagar_vddcore_ranges,
bef9391c Charles Keepax 2018-10-08  207  		.n_linear_ranges = ARRAY_SIZE(lochnagar_vddcore_ranges),
bef9391c Charles Keepax 2018-10-08  208  
bef9391c Charles Keepax 2018-10-08  209  		.enable_time = 3000,
bef9391c Charles Keepax 2018-10-08  210  		.ramp_delay = 1000,
bef9391c Charles Keepax 2018-10-08  211  
bef9391c Charles Keepax 2018-10-08  212  		.owner = THIS_MODULE,
bef9391c Charles Keepax 2018-10-08  213  	},
bef9391c Charles Keepax 2018-10-08  214  };
bef9391c Charles Keepax 2018-10-08  215  

:::::: The code at line 115 was first introduced by commit
:::::: bef9391cbec547351c6a13e52f3a26bb2d271ec7 regulator: lochnagar: Add support for the Cirrus Logic Lochnagar

:::::: TO: Charles Keepax <[email protected]> :::::: CC: Mark Brown <[email protected]>

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