Skip to contentSkip to conversation

Do some cleanups at the HiSilicon 6421 regulator

PATCH In review Mauro Carvalho Chehab 2 participants 10 messages Aug 18, 2020

Subsystems (2)
lore
Share & tools
lore
#6 lore raw

PATCH 3/6 staging: spmi: hisi-spmi-controller: change compatible string

In reply to Mauro Carvalho Chehab

Add the chipset name at the compatible string, as other HiSilicon chipsets with SPMI bus might require something different.

---
 drivers/staging/hikey9xx/hisi-spmi-controller.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/hikey9xx/hisi-spmi-controller.c +2 -1
index 513d962b8bce..66a0b296e06f 100644
@@ -324,7 +324,8 @@ static int spmi_del_controller(struct platform_device *pdev)
 }
 
 static const struct of_device_id spmi_controller_match_table[] = {
-	{	.compatible = "hisilicon,spmi-controller",
+	{
+		.compatible = "hisilicon,kirin970-spmi-controller",
 	},
 	{}
 };
Signature · 1 line
2.26.2
#1 lore raw

PATCH 1/6 staging: hikey9xx: fix Kconfig dependency chain

In reply to Mauro Carvalho Chehab

Both the SPMI controller and the SPMI PMIC driver
depends on the SPMI bus support.

The dependency for the regulator is also wrong:
it should depends on the SPMI version of the HiSilicon 6421, and not on the normal one.

---
 drivers/staging/hikey9xx/Kconfig | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/hikey9xx/Kconfig +3 -1
index 76267b9be562..a004839e8fa9 100644
@@ -5,6 +5,7 @@ config SPMI_HISI3670
 	tristate "Hisilicon 3670 SPMI Controller"
 	select IRQ_DOMAIN_HIERARCHY
 	depends on HAS_IOMEM
+	depends on SPMI
 	help
 	  If you say yes to this option, support will be included for the
 	  built-in SPMI PMIC Arbiter interface on Hisilicon 3670
@@ -14,6 +15,7 @@ config SPMI_HISI3670
 config MFD_HI6421_SPMI
 	tristate "HiSilicon Hi6421v600 SPMI PMU/Codec IC"
 	depends on OF
+	depends on SPMI
 	select MFD_CORE
 	help
 	  Add support for HiSilicon Hi6421v600 SPMI PMIC. Hi6421 includes
@@ -28,7 +30,7 @@ config MFD_HI6421_SPMI
 # to be placed at drivers/regulator
 config REGULATOR_HI6421V600
 	tristate "HiSilicon Hi6421v600 PMIC voltage regulator support"
-	depends on MFD_HI6421_PMIC && OF
+	depends on MFD_HI6421_SPMI && OF
 	help
 	  This driver provides support for the voltage regulators on
 	  HiSilicon Hi6421v600 PMU / Codec IC.
Signature · 1 line
2.26.2
#8 lore raw

PATCH 5/6 dt: document HiSilicon SPMI controller and mfd/regulator properties

In reply to Mauro Carvalho Chehab

Add documentation for the properties needed by the HiSilicon 6421v600 driver, and by the SPMI controller used to access the chipset.

---
 .../hikey9xx/hisilicon,hi6421-spmi-pmic.yaml  | 159 ++++++++++++++++++
 .../hisilicon,hisi-spmi-controller.yaml       |  62 +++++++
 2 files changed, 221 insertions(+)
 create mode 100644 drivers/staging/hikey9xx/hisilicon,hi6421-spmi-pmic.yaml
 create mode 100644 drivers/staging/hikey9xx/hisilicon,hisi-spmi-controller.yaml
drivers/staging/hikey9xx/hisilicon,hi6421-spmi-pmic.yaml new file +159 -0
new file mode 100644
index 000000000000..c76093f320f1
@@ -0,0 +1,159 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mfd/hisilicon,hi6421-spmi-pmic.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: HiSilicon 6421v600 SPMI PMIC
+
+maintainers:
+  - Mauro Carvalho Chehab <[email protected]>
+
+description: |
+  HiSilicon 6421v600 should be connected inside a MIPI System Power Management
+  (SPMI) bus. It provides interrupts and power supply.
+
+  The GPIO and interrupt settings are represented as part of the top-level PMIC
+  node.
+
+  The SPMI controller part is provided by
+  Documentation/devicetree/bindings/spmi/hisilicon,hisi-spmi-controller.yaml.
+
+properties:
+  $nodename:
+    pattern: "pmic@[0-9a-f]"
+
+  compatible:
+    const: hisilicon,hi6421v600-spmi
+
+  reg:
+    maxItems: 1
+
+  '#interrupt-cells':
+    const: 2
+
+  interrupt-controller:
+    description:
+      Identify that the PMIC is capable of behaving as an interrupt controller.
+
+  gpios:
+    maxItems: 1
+
+  regulators:
+    type: object
+
+    properties:
+      '#address-cells':
+        const: 1
+
+      '#size-cells':
+        const: 0
+
+    patternProperties:
+      '^ldo[0-9]+@[0-9a-f]$':
+        type: object
+
+        $ref: "/schemas/regulator/regulator.yaml#"
+
+        properties:
+          reg:
+            description: Enable register.
+
+          '#address-cells':
+            const: 1
+
+          '#size-cells':
+            const: 0
+
+          vsel-reg:
+            description: Voltage selector register.
+
+          enable-mask:
+            description: Bitmask used to enable the regulator.
+
+          voltage-table:
+            description: Table with the selector items for the voltage regulator.
+            minItems: 2
+            maxItems: 16
+
+          off-on-delay-us:
+            description: Time required for changing state to enabled in microseconds.
+
+          startup-delay-us:
+            description: Startup time in microseconds.
+
+          idle-mode-mask:
+            description: Bitmask used to put the regulator on idle mode.
+
+          eco-microamp:
+            description: Maximum current while on idle mode.
+
+        required:
+          - reg
+          - vsel-reg
+          - enable-mask
+          - voltage-table
+          - off-on-delay-us
+          - startup-delay-us
+
+required:
+  - compatible
+  - reg
+  - regulators
+
+examples:
+  - |
+    /* pmic properties */
+
+    pmic: pmic@0 {
+      compatible = "hisilicon,hi6421-spmi";
+      reg = <0 0>;
+
+      #interrupt-cells = <2>;
+      interrupt-controller;
+      gpios = <&gpio28 0 0>;
+
+      regulators {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        ldo3: ldo3@16 {
+          reg = <0x16>;
+          vsel-reg = <0x51>;
+
+          regulator-name = "ldo3";
+          regulator-min-microvolt = <1500000>;
+          regulator-max-microvolt = <2000000>;
+          regulator-boot-on;
+
+          enable-mask = <0x01>;
+
+          voltage-table = <1500000>, <1550000>, <1600000>, <1650000>,
+                          <1700000>, <1725000>, <1750000>, <1775000>,
+                          <1800000>, <1825000>, <1850000>, <1875000>,
+                          <1900000>, <1925000>, <1950000>, <2000000>;
+          off-on-delay-us = <20000>;
+          startup-delay-us = <120>;
+        };
+
+        ldo4: ldo4@17 { /* 40 PIN */
+          reg = <0x17>;
+          vsel-reg = <0x52>;
+
+          regulator-name = "ldo4";
+          regulator-min-microvolt = <1725000>;
+          regulator-max-microvolt = <1900000>;
+          regulator-boot-on;
+
+          enable-mask = <0x01>;
+          idle-mode-mask = <0x10>;
+          eco-microamp = <10000>;
+
+          hi6421-vsel = <0x52 0x07>;
+          voltage-table = <1725000>, <1750000>, <1775000>, <1800000>,
+                          <1825000>, <1850000>, <1875000>, <1900000>;
+          off-on-delay-us = <20000>;
+          startup-delay-us = <120>;
+        };
+      };
+    };
drivers/staging/hikey9xx/hisilicon,hisi-spmi-controller.yaml new file +62 -0

62 lines not on this page · raw message

Signature · 1 line
2.26.2
#9 lore raw

PATCH 6/6 MAINTAINERS: add an entry for HiSilicon 6421v600 drivers

In reply to Mauro Carvalho Chehab

Add an entry for the SPMI, MFD and PMIC parts of the HiSilicon 6421v600 support.

---
 MAINTAINERS | 6 ++++++
 1 file changed, 6 insertions(+)
MAINTAINERS +6 -0
index 956ecd5ba426..2f497c7d659c 100644
@@ -7824,6 +7824,12 @@ F:	drivers/crypto/hisilicon/sec2/sec_crypto.c
 F:	drivers/crypto/hisilicon/sec2/sec_crypto.h
 F:	drivers/crypto/hisilicon/sec2/sec_main.c
 
+HISILICON STAGING DRIVERS FOR HIKEY 960/970
+M:	Mauro Carvalho Chehab <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	drivers/staging/hikey9xx/
+
 HISILICON TRUE RANDOM NUMBER GENERATOR V2 SUPPORT
 M:	Zaibo Xu <[email protected]>
 S:	Maintained
Signature · 1 line
2.26.2
#7 lore raw

PATCH 4/6 staging: mfd: hi6421-spmi-pmic: Simplify the compatible string

In reply to Mauro Carvalho Chehab

It is clear that this driver is for PMIC. So, get rid of it at the compatible.

---
 drivers/staging/hikey9xx/hi6421-spmi-pmic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/hikey9xx/hi6421-spmi-pmic.c +1 -1
index 7817c0637737..64b30d263c8d 100644
@@ -323,7 +323,7 @@ static void hi6421_spmi_pmic_remove(struct spmi_device *pdev)
 }
 
 static const struct of_device_id pmic_spmi_id_table[] = {
-	{ .compatible = "hisilicon,hi6421-spmi-pmic" },
+	{ .compatible = "hisilicon,hi6421-spmi" },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, pmic_spmi_id_table);
Signature · 1 line
2.26.2
#0 lore raw

cover Do some cleanups at the HiSilicon 6421 regulator

Hi Greg,

Patch 1 contains a Kconfig fixup, addressing the problem you noticed when building those drivers;

Patches 2 to 4 addresses some issues at the device tree, pointed by Rob's review.

Patch 5 adds the DT documentation. As requested, I moved those also to the staging dir.

Patch 6 adds an entry at MAINTAINERS. I changed the ML to point to the devel ML.

Thanks!
Mauro

Mauro Carvalho Chehab (6):
staging: hikey9xx: fix Kconfig dependency chain
staging: mfd: hi6421-spmi-pmic: get rid of interrupt properties
staging: spmi: hisi-spmi-controller: change compatible string
staging: mfd: hi6421-spmi-pmic: Simplify the compatible string
dt: document HiSilicon SPMI controller and mfd/regulator properties
MAINTAINERS: add an entry for HiSilicon 6421v600 drivers

 MAINTAINERS                                   |   6 +
 drivers/staging/hikey9xx/Kconfig              |   4 +-
 drivers/staging/hikey9xx/hi6421-spmi-pmic.c   |  82 +++------
 .../staging/hikey9xx/hisi-spmi-controller.c   |   3 +-
 .../hikey9xx/hisilicon,hi6421-spmi-pmic.yaml  | 159 ++++++++++++++++++
 .../hisilicon,hisi-spmi-controller.yaml       |  62 +++++++
 include/linux/mfd/hi6421-spmi-pmic.h          |  15 --
 7 files changed, 253 insertions(+), 78 deletions(-)
 create mode 100644 drivers/staging/hikey9xx/hisilicon,hi6421-spmi-pmic.yaml
 create mode 100644 drivers/staging/hikey9xx/hisilicon,hisi-spmi-controller.yaml
Signature · 1 line
2.26.2
#5 lore raw

PATCH 2/6 staging: mfd: hi6421-spmi-pmic: get rid of interrupt properties

Both irqnum and irqarray properties reflect the same thing:
the number of bits and bytes for interrupts at this chipset. E. g.:

irqnum = 8 x irqarray

This can be seen by the way pending interrupts are handled:

	/* During probe time */
	pmic->irqs = devm_kzalloc(dev, pmic->irqnum * sizeof(int), GFP_KERNEL);

	/* While handling IRQs */
	for (i = 0; i < pmic->irqarray; i++) {
		pending = hi6421_spmi_pmic_read(pmic, (i + pmic->irq_addr));
		pending &= 0xff;

		for_each_set_bit(offset, &pending, 8)
			generic_handle_irq(pmic->irqs[offset + i * 8]);

	}

Going further, there are some logic at the driver which assumes that irqarray is 2:

	/* solve powerkey order */
	if ((i == HISI_IRQ_KEY_NUM) &&
	    ((pending & HISI_IRQ_KEY_VALUE) == HISI_IRQ_KEY_VALUE)) {
		generic_handle_irq(pmic->irqs[HISI_IRQ_KEY_DOWN]);
		generic_handle_irq(pmic->irqs[HISI_IRQ_KEY_UP]);
		pending &= (~HISI_IRQ_KEY_VALUE);
	}

As HISI_IRQ_KEY_DOWN and HISI_IRQ_KEY_UP are fixed values and don't depend on irqnum/irqarray.

The IRQ addr and mask addr seem to be also fixed, based on some comments at the OF parsing code. So, get rid of them too, removing the of parsing function completely.

---
 drivers/staging/hikey9xx/hi6421-spmi-pmic.c | 80 ++++++---------------
 include/linux/mfd/hi6421-spmi-pmic.h        | 15 ----
 2 files changed, 20 insertions(+), 75 deletions(-)
drivers/staging/hikey9xx/hi6421-spmi-pmic.c +20 -60
index 9d73458ca65a..7817c0637737 100644
@@ -38,6 +38,12 @@
 /* 8-bit register offset in PMIC */
 #define HISI_MASK_STATE			0xff
 
+#define HISI_IRQ_ARRAY			2
+#define HISI_IRQ_NUM			(HISI_IRQ_ARRAY * 8)
+
+#define SOC_PMIC_IRQ_MASK_0_ADDR	0x0202
+#define SOC_PMIC_IRQ0_ADDR		0x0212
+
 #define HISI_IRQ_KEY_NUM		0
 #define HISI_IRQ_KEY_VALUE		0xc0
 #define HISI_IRQ_KEY_DOWN		7
@@ -121,13 +127,13 @@ static irqreturn_t hi6421_spmi_irq_handler(int irq, void *data)
 	unsigned long pending;
 	int i, offset;
 
-	for (i = 0; i < pmic->irqarray; i++) {
-		pending = hi6421_spmi_pmic_read(pmic, (i + pmic->irq_addr));
+	for (i = 0; i < HISI_IRQ_ARRAY; i++) {
+		pending = hi6421_spmi_pmic_read(pmic, (i + SOC_PMIC_IRQ0_ADDR));
 		pending &= HISI_MASK_FIELD;
 		if (pending != 0)
 			pr_debug("pending[%d]=0x%lx\n\r", i, pending);
 
-		hi6421_spmi_pmic_write(pmic, (i + pmic->irq_addr), pending);
+		hi6421_spmi_pmic_write(pmic, (i + SOC_PMIC_IRQ0_ADDR), pending);
 
 		/* solve powerkey order */
 		if ((i == HISI_IRQ_KEY_NUM) &&
@@ -153,7 +159,7 @@ static void hi6421_spmi_irq_mask(struct irq_data *d)
 	unsigned long flags;
 
 	offset = (irqd_to_hwirq(d) >> 3);
-	offset += pmic->irq_mask_addr;
+	offset += SOC_PMIC_IRQ_MASK_0_ADDR;
 
 	spin_lock_irqsave(&pmic->lock, flags);
 	data = hi6421_spmi_pmic_read(pmic, offset);
@@ -169,7 +175,7 @@ static void hi6421_spmi_irq_unmask(struct irq_data *d)
 	unsigned long flags;
 
 	offset = (irqd_to_hwirq(d) >> 3);
-	offset += pmic->irq_mask_addr;
+	offset += SOC_PMIC_IRQ_MASK_0_ADDR;
 
 	spin_lock_irqsave(&pmic->lock, flags);
 	data = hi6421_spmi_pmic_read(pmic, offset);
@@ -204,60 +210,20 @@ static const struct irq_domain_ops hi6421_spmi_domain_ops = {
 	.xlate	= irq_domain_xlate_twocell,
 };
 
-static int get_pmic_device_tree_data(struct device_node *np,
-				     struct hi6421_spmi_pmic *pmic)
-{
-	int ret = 0;
-
-	/* IRQ number */
-	ret = of_property_read_u32(np, "irq-num", &pmic->irqnum);
-	if (ret) {
-		pr_err("no irq-num property set\n");
-		ret = -ENODEV;
-		return ret;
-	}
-
-	/* Size of IRQ array */
-	ret = of_property_read_u32(np, "irq-array", &pmic->irqarray);
-	if (ret) {
-		pr_err("no irq-array property set\n");
-		ret = -ENODEV;
-		return ret;
-	}
-
-	/* SOC_PMIC_IRQ_MASK_0_ADDR */
-	ret = of_property_read_u32(np, "irq-mask-addr", &pmic->irq_mask_addr);
-	if (ret) {
-		pr_err("no irq-mask-addr property set\n");
-		ret = -ENODEV;
-		return ret;
-	}
-
-	/* SOC_PMIC_IRQ0_ADDR */
-	ret = of_property_read_u32(np, "irq-addr", &pmic->irq_addr);
-	if (ret) {
-		pr_err("no irq-addr property set\n");
-		ret = -ENODEV;
-		return ret;
-	}
-
-	return ret;
-}
-
 static void hi6421_spmi_pmic_irq_prc(struct hi6421_spmi_pmic *pmic)
 {
 	int i, pending;
 
-	for (i = 0 ; i < pmic->irqarray; i++)
-		hi6421_spmi_pmic_write(pmic, pmic->irq_mask_addr + i,
+	for (i = 0 ; i < HISI_IRQ_ARRAY; i++)
+		hi6421_spmi_pmic_write(pmic, SOC_PMIC_IRQ_MASK_0_ADDR + i,
 				       HISI_MASK_STATE);
 
-	for (i = 0 ; i < pmic->irqarray; i++) {
-		pending = hi6421_spmi_pmic_read(pmic, pmic->irq_addr + i);
+	for (i = 0 ; i < HISI_IRQ_ARRAY; i++) {
+		pending = hi6421_spmi_pmic_read(pmic, SOC_PMIC_IRQ0_ADDR + i);
 
 		pr_debug("PMU IRQ address value:irq[0x%x] = 0x%x\n",
-			 pmic->irq_addr + i, pending);
-		hi6421_spmi_pmic_write(pmic, pmic->irq_addr + i,
+			 SOC_PMIC_IRQ0_ADDR + i, pending);
+		hi6421_spmi_pmic_write(pmic, SOC_PMIC_IRQ0_ADDR + i,
 				       HISI_MASK_STATE);
 	}
 }
@@ -274,12 +240,6 @@ static int hi6421_spmi_pmic_probe(struct spmi_device *pdev)
 	if (!pmic)
 		return -ENOMEM;
 
-	ret = get_pmic_device_tree_data(np, pmic);
-	if (ret) {
-		dev_err(dev, "Error reading hisi pmic dts\n");
-		return ret;
-	}
-
 	spin_lock_init(&pmic->lock);
 
 	pmic->dev = dev;
@@ -301,11 +261,11 @@ static int hi6421_spmi_pmic_probe(struct spmi_device *pdev)
 
 	hi6421_spmi_pmic_irq_prc(pmic);
 
-	pmic->irqs = devm_kzalloc(dev, pmic->irqnum * sizeof(int), GFP_KERNEL);
+	pmic->irqs = devm_kzalloc(dev, HISI_IRQ_NUM * sizeof(int), GFP_KERNEL);
 	if (!pmic->irqs)
 		goto irq_malloc;
 
-	pmic->domain = irq_domain_add_simple(np, pmic->irqnum, 0,
+	pmic->domain = irq_domain_add_simple(np, HISI_IRQ_NUM, 0,
 					     &hi6421_spmi_domain_ops, pmic);
 	if (!pmic->domain) {
 		dev_err(dev, "failed irq domain add simple!\n");
@@ -313,7 +273,7 @@ static int hi6421_spmi_pmic_probe(struct spmi_device *pdev)
 		goto irq_malloc;
 	}
 
-	for (i = 0; i < pmic->irqnum; i++) {
+	for (i = 0; i < HISI_IRQ_NUM; i++) {
 		virq = irq_create_mapping(pmic->domain, i);
 		if (!virq) {
 			dev_err(dev, "Failed mapping hwirq\n");
include/linux/mfd/hi6421-spmi-pmic.h +0 -15
index ff3adfa7b3ec..2c8896fd852e 100644
@@ -17,16 +17,6 @@
 #define HISI_ECO_MODE_ENABLE		(1)
 #define HISI_ECO_MODE_DISABLE		(0)
 
-struct hi6421_spmi_irq_mask_info {
-	int start_addr;
-	int array;
-};
-
-struct hi6421_spmi_irq_info {
-	int start_addr;
-	int array;
-};
-
 struct hi6421_spmi_pmic {
 	struct resource				*res;
 	struct device				*dev;
@@ -36,11 +26,6 @@ struct hi6421_spmi_pmic {
 	int					irq;
 	int					gpio;
 	unsigned int				*irqs;
-
-	int					irqnum;
-	int					irqarray;
-	int					irq_mask_addr;
-	int					irq_addr;
 };
 
 int hi6421_spmi_pmic_read(struct hi6421_spmi_pmic *pmic, int reg);
Signature · 1 line
2.26.2
#2 lore raw

Re: [PATCH 1/6] staging: hikey9xx: fix Kconfig dependency chain

In reply to Mauro Carvalho Chehab
Quoted 33 lines · Mauro Carvalho Chehab

Both the SPMI controller and the SPMI PMIC driver
depends on the SPMI bus support.

The dependency for the regulator is also wrong:
it should depends on the SPMI version of the HiSilicon 6421, and not on the normal one.

---
 drivers/staging/hikey9xx/Kconfig | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/hikey9xx/Kconfig +2 -0
index 76267b9be562..a004839e8fa9 100644
@@ -5,6 +5,7 @@ config SPMI_HISI3670
 	tristate "Hisilicon 3670 SPMI Controller"
 	select IRQ_DOMAIN_HIERARCHY
 	depends on HAS_IOMEM
+	depends on SPMI
 	help
 	  If you say yes to this option, support will be included for the
 	  built-in SPMI PMIC Arbiter interface on Hisilicon 3670
@@ -14,6 +15,7 @@ config SPMI_HISI3670
 config MFD_HI6421_SPMI
 	tristate "HiSilicon Hi6421v600 SPMI PMU/Codec IC"
 	depends on OF
+	depends on SPMI
 	select MFD_CORE
 	help
 	  Add support for HiSilicon Hi6421v600 SPMI PMIC. Hi6421 includes

drivers/staging/hikey9xx/Kconfig config MFD_HI6421_SPMI · line 36

Quoted 8 lines
drivers/staging/hikey9xx/Kconfig +1 -1
@@ -28,7 +30,7 @@ config MFD_HI6421_SPMI
 # to be placed at drivers/regulator
 config REGULATOR_HI6421V600
 	tristate "HiSilicon Hi6421v600 PMIC voltage regulator support"
-	depends on MFD_HI6421_PMIC && OF
+	depends on MFD_HI6421_SPMI && OF
 	help
 	  This driver provides support for the voltage regulators on
 	  HiSilicon Hi6421v600 PMU / Codec IC.

Better, but now I get the following build error:

ERROR: modpost: "regulator_map_voltage_iterate" [drivers/staging/hikey9xx/hi6421v600-regulator.ko] undefined!
ERROR: modpost: "regulator_list_voltage_table" [drivers/staging/hikey9xx/hi6421v600-regulator.ko] undefined!
ERROR: modpost: "of_get_regulator_init_data" [drivers/staging/hikey9xx/hi6421v600-regulator.ko] undefined!
ERROR: modpost: "regulator_register" [drivers/staging/hikey9xx/hi6421v600-regulator.ko] undefined!
ERROR: modpost: "regulator_unregister" [drivers/staging/hikey9xx/hi6421v600-regulator.ko] undefined!
ERROR: modpost: "rdev_get_drvdata" [drivers/staging/hikey9xx/hi6421v600-regulator.ko] undefined!

Someone need CONFIG_REGULATOR enabled?

Another follow-on patch? :)

thanks,

greg k-h

#3 lore raw

Re: [PATCH 1/6] staging: hikey9xx: fix Kconfig dependency chain

Em Tue, 18 Aug 2020 17:07:04 +0200
Greg Kroah-Hartman <[email protected]> escreveu:

Quoted 45 lines · Mauro Carvalho Chehab
Quoted 33 lines

Both the SPMI controller and the SPMI PMIC driver
depends on the SPMI bus support.

The dependency for the regulator is also wrong:
it should depends on the SPMI version of the HiSilicon 6421, and not on the normal one.

---
 drivers/staging/hikey9xx/Kconfig | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/hikey9xx/Kconfig +2 -0
index 76267b9be562..a004839e8fa9 100644
@@ -5,6 +5,7 @@ config SPMI_HISI3670
 	tristate "Hisilicon 3670 SPMI Controller"
 	select IRQ_DOMAIN_HIERARCHY
 	depends on HAS_IOMEM
+	depends on SPMI
 	help
 	  If you say yes to this option, support will be included for the
 	  built-in SPMI PMIC Arbiter interface on Hisilicon 3670
@@ -14,6 +15,7 @@ config SPMI_HISI3670
 config MFD_HI6421_SPMI
 	tristate "HiSilicon Hi6421v600 SPMI PMU/Codec IC"
 	depends on OF
+	depends on SPMI
 	select MFD_CORE
 	help
 	  Add support for HiSilicon Hi6421v600 SPMI PMIC. Hi6421 includes

drivers/staging/hikey9xx/Kconfig config MFD_HI6421_SPMI · line 36

Quoted 8 lines
drivers/staging/hikey9xx/Kconfig +1 -1
@@ -28,7 +30,7 @@ config MFD_HI6421_SPMI
 # to be placed at drivers/regulator
 config REGULATOR_HI6421V600
 	tristate "HiSilicon Hi6421v600 PMIC voltage regulator support"
-	depends on MFD_HI6421_PMIC && OF
+	depends on MFD_HI6421_SPMI && OF
 	help
 	  This driver provides support for the voltage regulators on
 	  HiSilicon Hi6421v600 PMU / Codec IC.  

Better, but now I get the following build error:

Quoted 8 lines

ERROR: modpost: "regulator_map_voltage_iterate" [drivers/staging/hikey9xx/hi6421v600-regulator.ko] undefined!
ERROR: modpost: "regulator_list_voltage_table" [drivers/staging/hikey9xx/hi6421v600-regulator.ko] undefined!
ERROR: modpost: "of_get_regulator_init_data" [drivers/staging/hikey9xx/hi6421v600-regulator.ko] undefined!
ERROR: modpost: "regulator_register" [drivers/staging/hikey9xx/hi6421v600-regulator.ko] undefined!
ERROR: modpost: "regulator_unregister" [drivers/staging/hikey9xx/hi6421v600-regulator.ko] undefined!
ERROR: modpost: "rdev_get_drvdata" [drivers/staging/hikey9xx/hi6421v600-regulator.ko] undefined!

Someone need CONFIG_REGULATOR enabled?

Yep. Sorry for that!

Quoted 2 lines

Another follow-on patch? :)

:)

Just to make sure, I did a clean compilation here, starting from nomodconfig, and adding just CONFIG_ARCH* and the dependencies needed by those symbols. It build fine here. So, I guess it should be ok this time (famous last words...)

Thanks,
Mauro

#4 lore raw

Re: [PATCH 1/6] staging: hikey9xx: fix Kconfig dependency chain

Quoted 59 lines · Mauro Carvalho Chehab

Em Tue, 18 Aug 2020 17:07:04 +0200
Greg Kroah-Hartman <[email protected]> escreveu:

Quoted 45 lines · Mauro Carvalho Chehab
Quoted 33 lines

Both the SPMI controller and the SPMI PMIC driver
depends on the SPMI bus support.

The dependency for the regulator is also wrong:
it should depends on the SPMI version of the HiSilicon 6421, and not on the normal one.

---
 drivers/staging/hikey9xx/Kconfig | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/hikey9xx/Kconfig +2 -0
index 76267b9be562..a004839e8fa9 100644
@@ -5,6 +5,7 @@ config SPMI_HISI3670
 	tristate "Hisilicon 3670 SPMI Controller"
 	select IRQ_DOMAIN_HIERARCHY
 	depends on HAS_IOMEM
+	depends on SPMI
 	help
 	  If you say yes to this option, support will be included for the
 	  built-in SPMI PMIC Arbiter interface on Hisilicon 3670
@@ -14,6 +15,7 @@ config SPMI_HISI3670
 config MFD_HI6421_SPMI
 	tristate "HiSilicon Hi6421v600 SPMI PMU/Codec IC"
 	depends on OF
+	depends on SPMI
 	select MFD_CORE
 	help
 	  Add support for HiSilicon Hi6421v600 SPMI PMIC. Hi6421 includes

drivers/staging/hikey9xx/Kconfig config MFD_HI6421_SPMI · line 36

Quoted 8 lines
drivers/staging/hikey9xx/Kconfig +1 -1
@@ -28,7 +30,7 @@ config MFD_HI6421_SPMI
 # to be placed at drivers/regulator
 config REGULATOR_HI6421V600
 	tristate "HiSilicon Hi6421v600 PMIC voltage regulator support"
-	depends on MFD_HI6421_PMIC && OF
+	depends on MFD_HI6421_SPMI && OF
 	help
 	  This driver provides support for the voltage regulators on
 	  HiSilicon Hi6421v600 PMU / Codec IC.  

Better, but now I get the following build error:

Quoted 8 lines

ERROR: modpost: "regulator_map_voltage_iterate" [drivers/staging/hikey9xx/hi6421v600-regulator.ko] undefined!
ERROR: modpost: "regulator_list_voltage_table" [drivers/staging/hikey9xx/hi6421v600-regulator.ko] undefined!
ERROR: modpost: "of_get_regulator_init_data" [drivers/staging/hikey9xx/hi6421v600-regulator.ko] undefined!
ERROR: modpost: "regulator_register" [drivers/staging/hikey9xx/hi6421v600-regulator.ko] undefined!
ERROR: modpost: "regulator_unregister" [drivers/staging/hikey9xx/hi6421v600-regulator.ko] undefined!
ERROR: modpost: "rdev_get_drvdata" [drivers/staging/hikey9xx/hi6421v600-regulator.ko] undefined!

Someone need CONFIG_REGULATOR enabled?

Yep. Sorry for that!

Quoted 1 line
Quoted 8 lines
Quoted 1 line

Another follow-on patch? :)

:)

Just to make sure, I did a clean compilation here, starting from nomodconfig, and adding just CONFIG_ARCH* and the dependencies needed by those symbols. It build fine here. So, I guess it should be ok this time (famous last words...)

Let's see what falls out in linux-next, that's the best test :)