devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Add support for mpq2286 PMIC IC
@ 2023-09-27  3:39 Saravanan Sekar
  2023-09-27  3:39 ` [PATCH v2 1/3] hwmon: (pmbus/mpq7932) Get page count based on chip info Saravanan Sekar
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Saravanan Sekar @ 2023-09-27  3:39 UTC (permalink / raw)
  To: sravanhome, lgirdwood, broonie, robh+dt, krzysztof.kozlowski+dt,
	conor+dt, linux, jdelvare
  Cc: linux-kernel, devicetree, linux-hwmon, Saravanan Sekar

changes in v2:
 - fix dt check warnings
 - fix compiler warning on cast device_get_match_data and lexicological order of compatible



The MPQ2286 is a programmable, high frequency synchronous buck regulator with
integrated internal high side and low side power MOSFET. Application in
Automotive compenents such as ADAS, Infotainment, SOC System core, DDR memory.

Saravanan Sekar (3):
  hwmon: (pmbus/mpq7932) Get page count based on chip info
  regulator: dt-bindings: Add mps,mpq2286 power-management IC
  hwmon: (pmbus/mpq2286) Add a support for mpq2286 Power Management IC

 .../bindings/regulator/mps,mpq2286.yaml       | 59 +++++++++++++++++++
 drivers/hwmon/pmbus/mpq7932.c                 |  9 ++-
 2 files changed, 65 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/regulator/mps,mpq2286.yaml

-- 
2.34.1


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

* [PATCH v2 1/3] hwmon: (pmbus/mpq7932) Get page count based on chip info
  2023-09-27  3:39 [PATCH v2 0/3] Add support for mpq2286 PMIC IC Saravanan Sekar
@ 2023-09-27  3:39 ` Saravanan Sekar
  2023-09-27  3:39 ` [PATCH v2 2/3] regulator: dt-bindings: Add mps,mpq2286 power-management IC Saravanan Sekar
  2023-09-27  3:39 ` [PATCH v2 3/3] hwmon: (pmbus/mpq2286) Add a support for mpq2286 Power Management IC Saravanan Sekar
  2 siblings, 0 replies; 8+ messages in thread
From: Saravanan Sekar @ 2023-09-27  3:39 UTC (permalink / raw)
  To: sravanhome, lgirdwood, broonie, robh+dt, krzysztof.kozlowski+dt,
	conor+dt, linux, jdelvare
  Cc: linux-kernel, devicetree, linux-hwmon, Saravanan Sekar

Get page count using compatible match to support the series of chipsets
which differs in number of regualator/page.

Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
---
 drivers/hwmon/pmbus/mpq7932.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/hwmon/pmbus/mpq7932.c b/drivers/hwmon/pmbus/mpq7932.c
index 6c62f01da7c6..723c314a57a2 100644
--- a/drivers/hwmon/pmbus/mpq7932.c
+++ b/drivers/hwmon/pmbus/mpq7932.c
@@ -105,7 +105,7 @@ static int mpq7932_probe(struct i2c_client *client)
 		return -ENOMEM;
 
 	info = &data->info;
-	info->pages = MPQ7932_NUM_PAGES;
+	info->pages = (int)(unsigned long)device_get_match_data(&client->dev);
 	info->format[PSC_VOLTAGE_OUT] = direct;
 	info->m[PSC_VOLTAGE_OUT] = 160;
 	info->b[PSC_VOLTAGE_OUT] = -33;
@@ -115,7 +115,7 @@ static int mpq7932_probe(struct i2c_client *client)
 	}
 
 #if IS_ENABLED(CONFIG_SENSORS_MPQ7932_REGULATOR)
-	info->num_regulators = ARRAY_SIZE(mpq7932_regulators_desc);
+	info->num_regulators = info->pages;
 	info->reg_desc = mpq7932_regulators_desc;
 #endif
 
@@ -129,7 +129,7 @@ static int mpq7932_probe(struct i2c_client *client)
 }
 
 static const struct of_device_id mpq7932_of_match[] = {
-	{ .compatible = "mps,mpq7932"},
+	{ .compatible = "mps,mpq7932", .data = (void *)MPQ7932_NUM_PAGES },
 	{},
 };
 MODULE_DEVICE_TABLE(of, mpq7932_of_match);
-- 
2.34.1


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

* [PATCH v2 2/3] regulator: dt-bindings: Add mps,mpq2286 power-management IC
  2023-09-27  3:39 [PATCH v2 0/3] Add support for mpq2286 PMIC IC Saravanan Sekar
  2023-09-27  3:39 ` [PATCH v2 1/3] hwmon: (pmbus/mpq7932) Get page count based on chip info Saravanan Sekar
@ 2023-09-27  3:39 ` Saravanan Sekar
  2023-09-27  8:06   ` Krzysztof Kozlowski
  2023-09-27 12:45   ` Mark Brown
  2023-09-27  3:39 ` [PATCH v2 3/3] hwmon: (pmbus/mpq2286) Add a support for mpq2286 Power Management IC Saravanan Sekar
  2 siblings, 2 replies; 8+ messages in thread
From: Saravanan Sekar @ 2023-09-27  3:39 UTC (permalink / raw)
  To: sravanhome, lgirdwood, broonie, robh+dt, krzysztof.kozlowski+dt,
	conor+dt, linux, jdelvare
  Cc: linux-kernel, devicetree, linux-hwmon, Saravanan Sekar

Document mpq2286 power-management IC

Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
---
 .../bindings/regulator/mps,mpq2286.yaml       | 59 +++++++++++++++++++
 1 file changed, 59 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/mps,mpq2286.yaml

diff --git a/Documentation/devicetree/bindings/regulator/mps,mpq2286.yaml b/Documentation/devicetree/bindings/regulator/mps,mpq2286.yaml
new file mode 100644
index 000000000000..594b929fe4b8
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/mps,mpq2286.yaml
@@ -0,0 +1,59 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/mps,mpq2286.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Monolithic Power System MPQ2286 PMIC
+
+maintainers:
+  - Saravanan Sekar <saravanan@linumiz.com>
+
+properties:
+  compatible:
+    enum:
+      - mps,mpq2286
+
+  reg:
+    maxItems: 1
+
+  regulators:
+    type: object
+
+    properties:
+      buck0:
+        type: object
+        $ref: regulator.yaml#
+
+        unevaluatedProperties: false
+
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - regulators
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        pmic@3 {
+            compatible = "mps,mpq2286";
+            reg = <0x3>;
+
+            regulators {
+                buck0 {
+                    regulator-name = "buck0";
+                    regulator-min-microvolt = <1600000>;
+                    regulator-max-microvolt = <1800000>;
+                    regulator-boot-on;
+                };
+            };
+        };
+    };
+...
-- 
2.34.1


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

* [PATCH v2 3/3] hwmon: (pmbus/mpq2286) Add a support for mpq2286 Power Management IC
  2023-09-27  3:39 [PATCH v2 0/3] Add support for mpq2286 PMIC IC Saravanan Sekar
  2023-09-27  3:39 ` [PATCH v2 1/3] hwmon: (pmbus/mpq7932) Get page count based on chip info Saravanan Sekar
  2023-09-27  3:39 ` [PATCH v2 2/3] regulator: dt-bindings: Add mps,mpq2286 power-management IC Saravanan Sekar
@ 2023-09-27  3:39 ` Saravanan Sekar
  2 siblings, 0 replies; 8+ messages in thread
From: Saravanan Sekar @ 2023-09-27  3:39 UTC (permalink / raw)
  To: sravanhome, lgirdwood, broonie, robh+dt, krzysztof.kozlowski+dt,
	conor+dt, linux, jdelvare
  Cc: linux-kernel, devicetree, linux-hwmon, Saravanan Sekar

The MPQ2286 is a programmable, high frequency synchronous buck regulator
designed to power a variety of Automotive system peripherals. Single buck
converters with hardware monitoring capability is configurable over PMBus
interface.

Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
---
 drivers/hwmon/pmbus/mpq7932.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/hwmon/pmbus/mpq7932.c b/drivers/hwmon/pmbus/mpq7932.c
index 723c314a57a2..60d7b8aec05a 100644
--- a/drivers/hwmon/pmbus/mpq7932.c
+++ b/drivers/hwmon/pmbus/mpq7932.c
@@ -21,6 +21,7 @@
 #define MPQ7932_N_VOLTAGES		256
 #define MPQ7932_VOUT_MAX		0xFF
 #define MPQ7932_NUM_PAGES		6
+#define MPQ2286_NUM_PAGES		1
 
 #define MPQ7932_TON_DELAY		0x60
 #define MPQ7932_VOUT_STARTUP_SLEW	0xA3
@@ -129,12 +130,14 @@ static int mpq7932_probe(struct i2c_client *client)
 }
 
 static const struct of_device_id mpq7932_of_match[] = {
+	{ .compatible = "mps,mpq2286", .data = (void *)MPQ2286_NUM_PAGES },
 	{ .compatible = "mps,mpq7932", .data = (void *)MPQ7932_NUM_PAGES },
 	{},
 };
 MODULE_DEVICE_TABLE(of, mpq7932_of_match);
 
 static const struct i2c_device_id mpq7932_id[] = {
+	{ "mpq2286", },
 	{ "mpq7932", },
 	{ },
 };
-- 
2.34.1


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

* Re: [PATCH v2 2/3] regulator: dt-bindings: Add mps,mpq2286 power-management IC
  2023-09-27  3:39 ` [PATCH v2 2/3] regulator: dt-bindings: Add mps,mpq2286 power-management IC Saravanan Sekar
@ 2023-09-27  8:06   ` Krzysztof Kozlowski
  2023-09-27  8:51     ` Saravanan Sekar
  2023-09-27 12:45   ` Mark Brown
  1 sibling, 1 reply; 8+ messages in thread
From: Krzysztof Kozlowski @ 2023-09-27  8:06 UTC (permalink / raw)
  To: Saravanan Sekar, sravanhome, lgirdwood, broonie, robh+dt,
	krzysztof.kozlowski+dt, conor+dt, linux, jdelvare
  Cc: linux-kernel, devicetree, linux-hwmon

On 27/09/2023 05:39, Saravanan Sekar wrote:
> Document mpq2286 power-management IC
> 
> Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
> ---
>  .../bindings/regulator/mps,mpq2286.yaml       | 59 +++++++++++++++++++
>  1 file changed, 59 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/regulator/mps,mpq2286.yaml
> 
> diff --git a/Documentation/devicetree/bindings/regulator/mps,mpq2286.yaml b/Documentation/devicetree/bindings/regulator/mps,mpq2286.yaml
> new file mode 100644
> index 000000000000..594b929fe4b8
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/regulator/mps,mpq2286.yaml
> @@ -0,0 +1,59 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/regulator/mps,mpq2286.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Monolithic Power System MPQ2286 PMIC
> +
> +maintainers:
> +  - Saravanan Sekar <saravanan@linumiz.com>
> +
> +properties:
> +  compatible:
> +    enum:
> +      - mps,mpq2286
> +
> +  reg:
> +    maxItems: 1
> +
> +  regulators:
> +    type: object
> +
> +    properties:
> +      buck0:

If you have just one buck, it should be "buck".


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


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

* Re: [PATCH v2 2/3] regulator: dt-bindings: Add mps,mpq2286 power-management IC
  2023-09-27  8:06   ` Krzysztof Kozlowski
@ 2023-09-27  8:51     ` Saravanan Sekar
  2023-10-06 14:18       ` Rob Herring
  0 siblings, 1 reply; 8+ messages in thread
From: Saravanan Sekar @ 2023-09-27  8:51 UTC (permalink / raw)
  To: Krzysztof Kozlowski, krzysztof.kozlowski+dt
  Cc: linux-kernel, devicetree, lgirdwood, conor+dt, linux, linux-hwmon,
	broonie, sravanhome, robh+dt, jdelvare

On 27/09/23 13:36, Krzysztof Kozlowski wrote:
> On 27/09/2023 05:39, Saravanan Sekar wrote:
>> Document mpq2286 power-management IC
>>
>> Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
>> ---
>>   .../bindings/regulator/mps,mpq2286.yaml       | 59 +++++++++++++++++++
>>   1 file changed, 59 insertions(+)
>>   create mode 100644 Documentation/devicetree/bindings/regulator/mps,mpq2286.yaml
>>
>> diff --git a/Documentation/devicetree/bindings/regulator/mps,mpq2286.yaml b/Documentation/devicetree/bindings/regulator/mps,mpq2286.yaml
>> new file mode 100644
>> index 000000000000..594b929fe4b8
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/regulator/mps,mpq2286.yaml
>> @@ -0,0 +1,59 @@
>> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/regulator/mps,mpq2286.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Monolithic Power System MPQ2286 PMIC
>> +
>> +maintainers:
>> +  - Saravanan Sekar <saravanan@linumiz.com>
>> +
>> +properties:
>> +  compatible:
>> +    enum:
>> +      - mps,mpq2286
>> +
>> +  reg:
>> +    maxItems: 1
>> +
>> +  regulators:
>> +    type: object
>> +
>> +    properties:
>> +      buck0:
> 
> If you have just one buck, it should be "buck".
> 

As replied in v1 review comments, other chipset has multiple regulator 
so buck0 used to keep the driver common

> 
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> 
> Best regards,
> Krzysztof
> 

Thanks,
Saravanan

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

* Re: [PATCH v2 2/3] regulator: dt-bindings: Add mps,mpq2286 power-management IC
  2023-09-27  3:39 ` [PATCH v2 2/3] regulator: dt-bindings: Add mps,mpq2286 power-management IC Saravanan Sekar
  2023-09-27  8:06   ` Krzysztof Kozlowski
@ 2023-09-27 12:45   ` Mark Brown
  1 sibling, 0 replies; 8+ messages in thread
From: Mark Brown @ 2023-09-27 12:45 UTC (permalink / raw)
  To: Saravanan Sekar
  Cc: sravanhome, lgirdwood, robh+dt, krzysztof.kozlowski+dt, conor+dt,
	linux, jdelvare, linux-kernel, devicetree, linux-hwmon

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

On Wed, Sep 27, 2023 at 09:09:52AM +0530, Saravanan Sekar wrote:
> Document mpq2286 power-management IC

Acked-by: Mark Brown <broonie@kernel.org>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v2 2/3] regulator: dt-bindings: Add mps,mpq2286 power-management IC
  2023-09-27  8:51     ` Saravanan Sekar
@ 2023-10-06 14:18       ` Rob Herring
  0 siblings, 0 replies; 8+ messages in thread
From: Rob Herring @ 2023-10-06 14:18 UTC (permalink / raw)
  To: Saravanan Sekar
  Cc: Krzysztof Kozlowski, krzysztof.kozlowski+dt, linux-kernel,
	devicetree, lgirdwood, conor+dt, linux, linux-hwmon, broonie,
	sravanhome, jdelvare

On Wed, Sep 27, 2023 at 02:21:18PM +0530, Saravanan Sekar wrote:
> On 27/09/23 13:36, Krzysztof Kozlowski wrote:
> > On 27/09/2023 05:39, Saravanan Sekar wrote:
> > > Document mpq2286 power-management IC
> > > 
> > > Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
> > > ---
> > >   .../bindings/regulator/mps,mpq2286.yaml       | 59 +++++++++++++++++++
> > >   1 file changed, 59 insertions(+)
> > >   create mode 100644 Documentation/devicetree/bindings/regulator/mps,mpq2286.yaml
> > > 
> > > diff --git a/Documentation/devicetree/bindings/regulator/mps,mpq2286.yaml b/Documentation/devicetree/bindings/regulator/mps,mpq2286.yaml
> > > new file mode 100644
> > > index 000000000000..594b929fe4b8
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/regulator/mps,mpq2286.yaml
> > > @@ -0,0 +1,59 @@
> > > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> > > +%YAML 1.2
> > > +---
> > > +$id: http://devicetree.org/schemas/regulator/mps,mpq2286.yaml#
> > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > +
> > > +title: Monolithic Power System MPQ2286 PMIC
> > > +
> > > +maintainers:
> > > +  - Saravanan Sekar <saravanan@linumiz.com>
> > > +
> > > +properties:
> > > +  compatible:
> > > +    enum:
> > > +      - mps,mpq2286
> > > +
> > > +  reg:
> > > +    maxItems: 1
> > > +
> > > +  regulators:
> > > +    type: object
> > > +
> > > +    properties:
> > > +      buck0:
> > 
> > If you have just one buck, it should be "buck".
> > 
> 
> As replied in v1 review comments, other chipset has multiple regulator so
> buck0 used to keep the driver common

This patch needs to stand on its own with explanations/justifications. 
No one reviewing this remembers what was said in some reply. The 
explanation may be in the commit msg, under the '---', or in 
'description' here. Depends on the situation.

I don't see why the driver can't handle 'buck' and 'buckN'.

Rob

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

end of thread, other threads:[~2023-10-06 14:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-27  3:39 [PATCH v2 0/3] Add support for mpq2286 PMIC IC Saravanan Sekar
2023-09-27  3:39 ` [PATCH v2 1/3] hwmon: (pmbus/mpq7932) Get page count based on chip info Saravanan Sekar
2023-09-27  3:39 ` [PATCH v2 2/3] regulator: dt-bindings: Add mps,mpq2286 power-management IC Saravanan Sekar
2023-09-27  8:06   ` Krzysztof Kozlowski
2023-09-27  8:51     ` Saravanan Sekar
2023-10-06 14:18       ` Rob Herring
2023-09-27 12:45   ` Mark Brown
2023-09-27  3:39 ` [PATCH v2 3/3] hwmon: (pmbus/mpq2286) Add a support for mpq2286 Power Management IC Saravanan Sekar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).