All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/4] regulator: dt-bindings: mps,mp5416: add MP5496 compatible
@ 2022-06-04 14:58 Robert Marko
  2022-06-04 14:58 ` [PATCH v2 2/4] regulator: mp5416: alphabetically sort header includes Robert Marko
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Robert Marko @ 2022-06-04 14:58 UTC (permalink / raw)
  To: sravanhome, lgirdwood, broonie, robh+dt, krzysztof.kozlowski+dt,
	linux-kernel, devicetree
  Cc: Robert Marko

MP5496 is the updated version of MP5416 with the only difference being
that now all Buck regulators have the same 0.6-2.1875V range with a 12.5mV
step.

Since there is no way to differentiate them other than using compatibles,
add compatible for the MP5496.

Signed-off-by: Robert Marko <robimarko@gmail.com>
---
Changes in v2:
* Send DT bindings as well

 Documentation/devicetree/bindings/regulator/mps,mp5416.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/regulator/mps,mp5416.yaml b/Documentation/devicetree/bindings/regulator/mps,mp5416.yaml
index 90727fdc1283..7023c597c3ed 100644
--- a/Documentation/devicetree/bindings/regulator/mps,mp5416.yaml
+++ b/Documentation/devicetree/bindings/regulator/mps,mp5416.yaml
@@ -15,6 +15,7 @@ properties:
   compatible:
     enum:
       - mps,mp5416
+      - mps,mp5496
 
   reg:
     maxItems: 1
-- 
2.36.1


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

* [PATCH v2 2/4] regulator: mp5416: alphabetically sort header includes
  2022-06-04 14:58 [PATCH v2 1/4] regulator: dt-bindings: mps,mp5416: add MP5496 compatible Robert Marko
@ 2022-06-04 14:58 ` Robert Marko
  2022-06-04 14:58 ` [PATCH v2 3/4] regulator: mp5416: use OF match data Robert Marko
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Robert Marko @ 2022-06-04 14:58 UTC (permalink / raw)
  To: sravanhome, lgirdwood, broonie, robh+dt, krzysztof.kozlowski+dt,
	linux-kernel, devicetree
  Cc: Robert Marko

Sort the header include list alphabetically.

Signed-off-by: Robert Marko <robimarko@gmail.com>
---
 drivers/regulator/mp5416.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/mp5416.c b/drivers/regulator/mp5416.c
index 39cebec0edb6..d8245080df03 100644
--- a/drivers/regulator/mp5416.c
+++ b/drivers/regulator/mp5416.c
@@ -6,14 +6,14 @@
 //
 // Author: Saravanan Sekar <sravanhome@gmail.com>
 
+#include <linux/err.h>
+#include <linux/i2c.h>
+#include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/init.h>
-#include <linux/err.h>
 #include <linux/platform_device.h>
 #include <linux/regmap.h>
 #include <linux/regulator/driver.h>
-#include <linux/i2c.h>
 
 #define MP5416_REG_CTL0			0x00
 #define MP5416_REG_CTL1			0x01
-- 
2.36.1


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

* [PATCH v2 3/4] regulator: mp5416: use OF match data
  2022-06-04 14:58 [PATCH v2 1/4] regulator: dt-bindings: mps,mp5416: add MP5496 compatible Robert Marko
  2022-06-04 14:58 ` [PATCH v2 2/4] regulator: mp5416: alphabetically sort header includes Robert Marko
@ 2022-06-04 14:58 ` Robert Marko
  2022-06-05 10:10   ` saravanan sekar
  2022-06-04 14:58 ` [PATCH v2 4/4] regulator: mp5416: add support for MP5496 Robert Marko
  2022-06-06 17:28 ` [PATCH v2 1/4] regulator: dt-bindings: mps,mp5416: add MP5496 compatible Mark Brown
  3 siblings, 1 reply; 7+ messages in thread
From: Robert Marko @ 2022-06-04 14:58 UTC (permalink / raw)
  To: sravanhome, lgirdwood, broonie, robh+dt, krzysztof.kozlowski+dt,
	linux-kernel, devicetree
  Cc: Robert Marko

In preparation for adding support for MP5496 which slightly differs from
MP5416 convert the driver to use OF match data instead of always using the
MP5416 regulator_desc for regulator registration.

Signed-off-by: Robert Marko <robimarko@gmail.com>
---
 drivers/regulator/mp5416.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/mp5416.c b/drivers/regulator/mp5416.c
index d8245080df03..011a825570ea 100644
--- a/drivers/regulator/mp5416.c
+++ b/drivers/regulator/mp5416.c
@@ -11,6 +11,7 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/regmap.h>
 #include <linux/regulator/driver.h>
@@ -178,6 +179,7 @@ static int mp5416_i2c_probe(struct i2c_client *client)
 {
 	struct device *dev = &client->dev;
 	struct regulator_config config = { NULL, };
+	static const struct regulator_desc *desc;
 	struct regulator_dev *rdev;
 	struct regmap *regmap;
 	int i;
@@ -188,12 +190,16 @@ static int mp5416_i2c_probe(struct i2c_client *client)
 		return PTR_ERR(regmap);
 	}
 
+	desc = of_device_get_match_data(dev);
+	if (!desc)
+		return -ENODEV;
+
 	config.dev = dev;
 	config.regmap = regmap;
 
 	for (i = 0; i < MP5416_MAX_REGULATORS; i++) {
 		rdev = devm_regulator_register(dev,
-					       &mp5416_regulators_desc[i],
+					       &desc[i],
 					       &config);
 		if (IS_ERR(rdev)) {
 			dev_err(dev, "Failed to register regulator!\n");
@@ -205,7 +211,7 @@ static int mp5416_i2c_probe(struct i2c_client *client)
 }
 
 static const struct of_device_id mp5416_of_match[] = {
-	{ .compatible = "mps,mp5416" },
+	{ .compatible = "mps,mp5416", .data = &mp5416_regulators_desc },
 	{},
 };
 MODULE_DEVICE_TABLE(of, mp5416_of_match);
-- 
2.36.1


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

* [PATCH v2 4/4] regulator: mp5416: add support for MP5496
  2022-06-04 14:58 [PATCH v2 1/4] regulator: dt-bindings: mps,mp5416: add MP5496 compatible Robert Marko
  2022-06-04 14:58 ` [PATCH v2 2/4] regulator: mp5416: alphabetically sort header includes Robert Marko
  2022-06-04 14:58 ` [PATCH v2 3/4] regulator: mp5416: use OF match data Robert Marko
@ 2022-06-04 14:58 ` Robert Marko
  2022-06-05 10:10   ` saravanan sekar
  2022-06-06 17:28 ` [PATCH v2 1/4] regulator: dt-bindings: mps,mp5416: add MP5496 compatible Mark Brown
  3 siblings, 1 reply; 7+ messages in thread
From: Robert Marko @ 2022-06-04 14:58 UTC (permalink / raw)
  To: sravanhome, lgirdwood, broonie, robh+dt, krzysztof.kozlowski+dt,
	linux-kernel, devicetree
  Cc: Robert Marko

MP5496 is the updated version of MP5416 with the only difference being
that now all Buck regulators have the same 0.6-2.1875V range with a 12.5mV
step.

Signed-off-by: Robert Marko <robimarko@gmail.com>
---
 drivers/regulator/mp5416.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/regulator/mp5416.c b/drivers/regulator/mp5416.c
index 011a825570ea..71e20e8d78ac 100644
--- a/drivers/regulator/mp5416.c
+++ b/drivers/regulator/mp5416.c
@@ -175,6 +175,17 @@ static struct regulator_desc mp5416_regulators_desc[MP5416_MAX_REGULATORS] = {
 	MP5416LDO("ldo4", 4, BIT(1)),
 };
 
+static struct regulator_desc mp5496_regulators_desc[MP5416_MAX_REGULATORS] = {
+	MP5416BUCK("buck1", 1, mp5416_I_limits1, MP5416_REG_CTL1, BIT(0), 1),
+	MP5416BUCK("buck2", 2, mp5416_I_limits2, MP5416_REG_CTL1, BIT(1), 1),
+	MP5416BUCK("buck3", 3, mp5416_I_limits1, MP5416_REG_CTL1, BIT(2), 1),
+	MP5416BUCK("buck4", 4, mp5416_I_limits2, MP5416_REG_CTL2, BIT(5), 1),
+	MP5416LDO("ldo1", 1, BIT(4)),
+	MP5416LDO("ldo2", 2, BIT(3)),
+	MP5416LDO("ldo3", 3, BIT(2)),
+	MP5416LDO("ldo4", 4, BIT(1)),
+};
+
 static int mp5416_i2c_probe(struct i2c_client *client)
 {
 	struct device *dev = &client->dev;
@@ -212,12 +223,14 @@ static int mp5416_i2c_probe(struct i2c_client *client)
 
 static const struct of_device_id mp5416_of_match[] = {
 	{ .compatible = "mps,mp5416", .data = &mp5416_regulators_desc },
+	{ .compatible = "mps,mp5496", .data = &mp5496_regulators_desc },
 	{},
 };
 MODULE_DEVICE_TABLE(of, mp5416_of_match);
 
 static const struct i2c_device_id mp5416_id[] = {
 	{ "mp5416", },
+	{ "mp5496", },
 	{ },
 };
 MODULE_DEVICE_TABLE(i2c, mp5416_id);
-- 
2.36.1


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

* Re: [PATCH v2 3/4] regulator: mp5416: use OF match data
  2022-06-04 14:58 ` [PATCH v2 3/4] regulator: mp5416: use OF match data Robert Marko
@ 2022-06-05 10:10   ` saravanan sekar
  0 siblings, 0 replies; 7+ messages in thread
From: saravanan sekar @ 2022-06-05 10:10 UTC (permalink / raw)
  To: Robert Marko, lgirdwood, broonie, robh+dt,
	krzysztof.kozlowski+dt, linux-kernel, devicetree

On 04/06/22 16:58, Robert Marko wrote:
> In preparation for adding support for MP5496 which slightly differs from
> MP5416 convert the driver to use OF match data instead of always using the
> MP5416 regulator_desc for regulator registration.
> 
> Signed-off-by: Robert Marko <robimarko@gmail.com>
> ---
>   drivers/regulator/mp5416.c | 10 ++++++++--
>   1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/regulator/mp5416.c b/drivers/regulator/mp5416.c
> index d8245080df03..011a825570ea 100644
> --- a/drivers/regulator/mp5416.c
> +++ b/drivers/regulator/mp5416.c
> @@ -11,6 +11,7 @@
>   #include <linux/init.h>
>   #include <linux/kernel.h>
>   #include <linux/module.h>
> +#include <linux/of_device.h>
>   #include <linux/platform_device.h>
>   #include <linux/regmap.h>
>   #include <linux/regulator/driver.h>
> @@ -178,6 +179,7 @@ static int mp5416_i2c_probe(struct i2c_client *client)
>   {
>   	struct device *dev = &client->dev;
>   	struct regulator_config config = { NULL, };
> +	static const struct regulator_desc *desc;
>   	struct regulator_dev *rdev;
>   	struct regmap *regmap;
>   	int i;
> @@ -188,12 +190,16 @@ static int mp5416_i2c_probe(struct i2c_client *client)
>   		return PTR_ERR(regmap);
>   	}
>   
> +	desc = of_device_get_match_data(dev);
> +	if (!desc)
> +		return -ENODEV;
> +
>   	config.dev = dev;
>   	config.regmap = regmap;
>   
>   	for (i = 0; i < MP5416_MAX_REGULATORS; i++) {
>   		rdev = devm_regulator_register(dev,
> -					       &mp5416_regulators_desc[i],
> +					       &desc[i],
>   					       &config);
>   		if (IS_ERR(rdev)) {
>   			dev_err(dev, "Failed to register regulator!\n");
> @@ -205,7 +211,7 @@ static int mp5416_i2c_probe(struct i2c_client *client)
>   }
>   
>   static const struct of_device_id mp5416_of_match[] = {
> -	{ .compatible = "mps,mp5416" },
> +	{ .compatible = "mps,mp5416", .data = &mp5416_regulators_desc },
>   	{},
>   };
>   MODULE_DEVICE_TABLE(of, mp5416_of_match);

Acked-by: Saravanan Sekar <sravanhome@gmail.com>

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

* Re: [PATCH v2 4/4] regulator: mp5416: add support for MP5496
  2022-06-04 14:58 ` [PATCH v2 4/4] regulator: mp5416: add support for MP5496 Robert Marko
@ 2022-06-05 10:10   ` saravanan sekar
  0 siblings, 0 replies; 7+ messages in thread
From: saravanan sekar @ 2022-06-05 10:10 UTC (permalink / raw)
  To: Robert Marko, lgirdwood, broonie, robh+dt,
	krzysztof.kozlowski+dt, linux-kernel, devicetree

On 04/06/22 16:58, Robert Marko wrote:
> MP5496 is the updated version of MP5416 with the only difference being
> that now all Buck regulators have the same 0.6-2.1875V range with a 12.5mV
> step.
> 
> Signed-off-by: Robert Marko <robimarko@gmail.com>
> ---
>   drivers/regulator/mp5416.c | 13 +++++++++++++
>   1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/regulator/mp5416.c b/drivers/regulator/mp5416.c
> index 011a825570ea..71e20e8d78ac 100644
> --- a/drivers/regulator/mp5416.c
> +++ b/drivers/regulator/mp5416.c
> @@ -175,6 +175,17 @@ static struct regulator_desc mp5416_regulators_desc[MP5416_MAX_REGULATORS] = {
>   	MP5416LDO("ldo4", 4, BIT(1)),
>   };
>   
> +static struct regulator_desc mp5496_regulators_desc[MP5416_MAX_REGULATORS] = {
> +	MP5416BUCK("buck1", 1, mp5416_I_limits1, MP5416_REG_CTL1, BIT(0), 1),
> +	MP5416BUCK("buck2", 2, mp5416_I_limits2, MP5416_REG_CTL1, BIT(1), 1),
> +	MP5416BUCK("buck3", 3, mp5416_I_limits1, MP5416_REG_CTL1, BIT(2), 1),
> +	MP5416BUCK("buck4", 4, mp5416_I_limits2, MP5416_REG_CTL2, BIT(5), 1),
> +	MP5416LDO("ldo1", 1, BIT(4)),
> +	MP5416LDO("ldo2", 2, BIT(3)),
> +	MP5416LDO("ldo3", 3, BIT(2)),
> +	MP5416LDO("ldo4", 4, BIT(1)),
> +};
> +
>   static int mp5416_i2c_probe(struct i2c_client *client)
>   {
>   	struct device *dev = &client->dev;
> @@ -212,12 +223,14 @@ static int mp5416_i2c_probe(struct i2c_client *client)
>   
>   static const struct of_device_id mp5416_of_match[] = {
>   	{ .compatible = "mps,mp5416", .data = &mp5416_regulators_desc },
> +	{ .compatible = "mps,mp5496", .data = &mp5496_regulators_desc },
>   	{},
>   };
>   MODULE_DEVICE_TABLE(of, mp5416_of_match);
>   
>   static const struct i2c_device_id mp5416_id[] = {
>   	{ "mp5416", },
> +	{ "mp5496", },
>   	{ },
>   };
>   MODULE_DEVICE_TABLE(i2c, mp5416_id);

Acked-by: Saravanan Sekar <sravanhome@gmail.com>

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

* Re: [PATCH v2 1/4] regulator: dt-bindings: mps,mp5416: add MP5496 compatible
  2022-06-04 14:58 [PATCH v2 1/4] regulator: dt-bindings: mps,mp5416: add MP5496 compatible Robert Marko
                   ` (2 preceding siblings ...)
  2022-06-04 14:58 ` [PATCH v2 4/4] regulator: mp5416: add support for MP5496 Robert Marko
@ 2022-06-06 17:28 ` Mark Brown
  3 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2022-06-06 17:28 UTC (permalink / raw)
  To: robimarko, linux-kernel, lgirdwood, devicetree, robh+dt,
	krzysztof.kozlowski+dt, sravanhome

On Sat, 4 Jun 2022 16:58:13 +0200, Robert Marko wrote:
> MP5496 is the updated version of MP5416 with the only difference being
> that now all Buck regulators have the same 0.6-2.1875V range with a 12.5mV
> step.
> 
> Since there is no way to differentiate them other than using compatibles,
> add compatible for the MP5496.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/4] regulator: dt-bindings: mps,mp5416: add MP5496 compatible
      commit: 423156b3d37ba051e72e87a8b4791a2a0ea40592
[2/4] regulator: mp5416: alphabetically sort header includes
      commit: b9dea0184b2641fb3937162a617289b23d52a587
[3/4] regulator: mp5416: use OF match data
      commit: df43c245dd0535f6e2256e0261d43a4dd72b8b28
[4/4] regulator: mp5416: add support for MP5496
      commit: fcdaf74a0abb6a4410b69dd80b525562457daafd

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

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

end of thread, other threads:[~2022-06-06 17:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-04 14:58 [PATCH v2 1/4] regulator: dt-bindings: mps,mp5416: add MP5496 compatible Robert Marko
2022-06-04 14:58 ` [PATCH v2 2/4] regulator: mp5416: alphabetically sort header includes Robert Marko
2022-06-04 14:58 ` [PATCH v2 3/4] regulator: mp5416: use OF match data Robert Marko
2022-06-05 10:10   ` saravanan sekar
2022-06-04 14:58 ` [PATCH v2 4/4] regulator: mp5416: add support for MP5496 Robert Marko
2022-06-05 10:10   ` saravanan sekar
2022-06-06 17:28 ` [PATCH v2 1/4] regulator: dt-bindings: mps,mp5416: add MP5496 compatible Mark Brown

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