Re: [PATCH 5/5] regulator: tps65917: Add Regulator driver for tps65917 PMIC

2014-05-27 Thread Lee Jones
> >>This patch adds support for TPS65917 PMIC regulators.
> >>
> >>The regulators set consists of 5 SMPSs and 5 LDOs. The output
> >>voltages are configurable and are meant to supply power to the
> >>main processor and other components.
> >This appears to look *very* like the Palmas driver, should it not be
> >sharing code with that?  If it were just data tables it'd be less of a
> >concern but there's quite a bit of actual code here.
> Yes it is. The difference is in the entire register space of the regulators
> between the two. There are other differences in how the ramp delay
> is configured and SMPS ordering. The difference is also a bit in the
> programming
> sequence. I agree that largely it is Palmas based. I did not want to
> add more
> checks in the probe of the palmas driver. Hence came up with a new one.
> 
> Coming to sharing the code, can we have 2 drivers which share the common
> functions with separate data and specific functions?

Yes, that is what the match functionality is for.  Once you know which
driver you're dealing with, you can call specific initialisation
functions and/or supplement generic generic data structures with device
specific ones.

> I just simply do not want to add anything more to the palmas driver
> probe function.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 5/5] regulator: tps65917: Add Regulator driver for tps65917 PMIC

2014-05-27 Thread Lee Jones
 This patch adds support for TPS65917 PMIC regulators.
 
 The regulators set consists of 5 SMPSs and 5 LDOs. The output
 voltages are configurable and are meant to supply power to the
 main processor and other components.
 This appears to look *very* like the Palmas driver, should it not be
 sharing code with that?  If it were just data tables it'd be less of a
 concern but there's quite a bit of actual code here.
 Yes it is. The difference is in the entire register space of the regulators
 between the two. There are other differences in how the ramp delay
 is configured and SMPS ordering. The difference is also a bit in the
 programming
 sequence. I agree that largely it is Palmas based. I did not want to
 add more
 checks in the probe of the palmas driver. Hence came up with a new one.
 
 Coming to sharing the code, can we have 2 drivers which share the common
 functions with separate data and specific functions?

Yes, that is what the match functionality is for.  Once you know which
driver you're dealing with, you can call specific initialisation
functions and/or supplement generic generic data structures with device
specific ones.

 I just simply do not want to add anything more to the palmas driver
 probe function.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 5/5] regulator: tps65917: Add Regulator driver for tps65917 PMIC

2014-05-26 Thread Keerthy

Hi Mark,

On Monday 26 May 2014 08:30 PM, Mark Brown wrote:

On Mon, May 26, 2014 at 03:26:37PM +0530, Keerthy wrote:

This patch adds support for TPS65917 PMIC regulators.

The regulators set consists of 5 SMPSs and 5 LDOs. The output
voltages are configurable and are meant to supply power to the
main processor and other components.

This appears to look *very* like the Palmas driver, should it not be
sharing code with that?  If it were just data tables it'd be less of a
concern but there's quite a bit of actual code here.

Yes it is. The difference is in the entire register space of the regulators
between the two. There are other differences in how the ramp delay
is configured and SMPS ordering. The difference is also a bit in the 
programming
sequence. I agree that largely it is Palmas based. I did not want to add 
more

checks in the probe of the palmas driver. Hence came up with a new one.

Coming to sharing the code, can we have 2 drivers which share the common
functions with separate data and specific functions?

I just simply do not want to add anything more to the palmas driver 
probe function.


Kind Regards,
Keerthy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 5/5] regulator: tps65917: Add Regulator driver for tps65917 PMIC

2014-05-26 Thread Mark Brown
On Mon, May 26, 2014 at 03:26:37PM +0530, Keerthy wrote:
> This patch adds support for TPS65917 PMIC regulators.
> 
> The regulators set consists of 5 SMPSs and 5 LDOs. The output
> voltages are configurable and are meant to supply power to the
> main processor and other components.

This appears to look *very* like the Palmas driver, should it not be
sharing code with that?  If it were just data tables it'd be less of a
concern but there's quite a bit of actual code here.


signature.asc
Description: Digital signature


[PATCH 5/5] regulator: tps65917: Add Regulator driver for tps65917 PMIC

2014-05-26 Thread Keerthy
This patch adds support for TPS65917 PMIC regulators.

The regulators set consists of 5 SMPSs and 5 LDOs. The output
voltages are configurable and are meant to supply power to the
main processor and other components.

Signed-off-by: Keerthy 
---
 drivers/regulator/Kconfig  |   12 +
 drivers/regulator/Makefile |1 +
 drivers/regulator/tps65917-regulator.c |  815 
 3 files changed, 828 insertions(+)
 create mode 100644 drivers/regulator/tps65917-regulator.c

Index: linux/drivers/regulator/Kconfig
===
--- linux.orig/drivers/regulator/Kconfig2014-05-26 15:21:12.269247638 
+0530
+++ linux/drivers/regulator/Kconfig 2014-05-26 15:21:46.956121138 +0530
@@ -581,6 +581,18 @@
help
This driver supports TPS65912 voltage regulator chip.
 
+config REGULATOR_TPS65917
+   tristate "TI TPS65917 PMIC Regulators"
+   depends on MFD_PALMAS
+   help
+ If you wish to control the regulators on the TPS65917 series of
+ chips say Y here. This will enable support for all the software
+ controllable SMPS/LDO regulators.
+
+ The regulators available on TPS65917 series chips vary depending
+ on the muxing. This is handled automatically in the driver by
+ reading the mux info from OTP.
+
 config REGULATOR_TPS80031
tristate "TI TPS80031/TPS80032 power regualtor driver"
depends on MFD_TPS80031
Index: linux/drivers/regulator/Makefile
===
--- linux.orig/drivers/regulator/Makefile   2014-05-26 15:21:12.269247638 
+0530
+++ linux/drivers/regulator/Makefile2014-05-26 15:21:46.956121138 +0530
@@ -76,6 +76,7 @@
 obj-$(CONFIG_REGULATOR_TPS6586X) += tps6586x-regulator.o
 obj-$(CONFIG_REGULATOR_TPS65910) += tps65910-regulator.o
 obj-$(CONFIG_REGULATOR_TPS65912) += tps65912-regulator.o
+obj-$(CONFIG_REGULATOR_TPS65917) += tps65917-regulator.o
 obj-$(CONFIG_REGULATOR_TPS80031) += tps80031-regulator.o
 obj-$(CONFIG_REGULATOR_TWL4030) += twl-regulator.o
 obj-$(CONFIG_REGULATOR_VEXPRESS) += vexpress.o
Index: linux/drivers/regulator/tps65917-regulator.c
===
--- /dev/null   1970-01-01 00:00:00.0 +
+++ linux/drivers/regulator/tps65917-regulator.c2014-05-26 
15:22:25.994853307 +0530
@@ -0,0 +1,814 @@
+/*
+ * Driver for Regulator part of TPS65917 PMIC
+ *
+ * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether expressed or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License version 2 for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static const struct regulator_linear_range smps_low_ranges[] = {
+   REGULATOR_LINEAR_RANGE(50, 0x1, 0x6, 0),
+   REGULATOR_LINEAR_RANGE(51, 0x7, 0x79, 1),
+   REGULATOR_LINEAR_RANGE(165, 0x7A, 0x7f, 0),
+};
+
+static const struct regulator_linear_range smps_high_ranges[] = {
+   REGULATOR_LINEAR_RANGE(100, 0x1, 0x6, 0),
+   REGULATOR_LINEAR_RANGE(102, 0x7, 0x79, 2),
+   REGULATOR_LINEAR_RANGE(330, 0x7A, 0x7f, 0),
+};
+
+struct regs_info {
+   char*name;
+   char*sname;
+   u8  vsel_addr;
+   u8  ctrl_addr;
+   int sleep_id;
+};
+
+static const struct regs_info tps65917_regs_info[] = {
+   {
+   .name   = "SMPS1",
+   .sname  = "smps1-in",
+   .vsel_addr  = TPS65917_SMPS1_VOLTAGE,
+   .ctrl_addr  = TPS65917_SMPS1_CTRL,
+   .sleep_id   = TPS65917_EXTERNAL_REQSTR_ID_SMPS1,
+   },
+   {
+   .name   = "SMPS2",
+   .sname  = "smps2-in",
+   .vsel_addr  = TPS65917_SMPS2_VOLTAGE,
+   .ctrl_addr  = TPS65917_SMPS2_CTRL,
+   .sleep_id   = TPS65917_EXTERNAL_REQSTR_ID_SMPS2,
+   },
+   {
+   .name   = "SMPS3",
+   .sname  = "smps3-in",
+   .vsel_addr  = TPS65917_SMPS3_VOLTAGE,
+   .ctrl_addr  = TPS65917_SMPS3_CTRL,
+   .sleep_id   = TPS65917_EXTERNAL_REQSTR_ID_SMPS3,
+   },
+   {
+   .name   = "SMPS4",
+   .sname  = "smps4-in",
+   .vsel_addr  = TPS65917_SMPS4_VOLTAGE,
+   .ctrl_addr  = 

[PATCH 5/5] regulator: tps65917: Add Regulator driver for tps65917 PMIC

2014-05-26 Thread Keerthy
This patch adds support for TPS65917 PMIC regulators.

The regulators set consists of 5 SMPSs and 5 LDOs. The output
voltages are configurable and are meant to supply power to the
main processor and other components.

Signed-off-by: Keerthy j-keer...@ti.com
---
 drivers/regulator/Kconfig  |   12 +
 drivers/regulator/Makefile |1 +
 drivers/regulator/tps65917-regulator.c |  815 
 3 files changed, 828 insertions(+)
 create mode 100644 drivers/regulator/tps65917-regulator.c

Index: linux/drivers/regulator/Kconfig
===
--- linux.orig/drivers/regulator/Kconfig2014-05-26 15:21:12.269247638 
+0530
+++ linux/drivers/regulator/Kconfig 2014-05-26 15:21:46.956121138 +0530
@@ -581,6 +581,18 @@
help
This driver supports TPS65912 voltage regulator chip.
 
+config REGULATOR_TPS65917
+   tristate TI TPS65917 PMIC Regulators
+   depends on MFD_PALMAS
+   help
+ If you wish to control the regulators on the TPS65917 series of
+ chips say Y here. This will enable support for all the software
+ controllable SMPS/LDO regulators.
+
+ The regulators available on TPS65917 series chips vary depending
+ on the muxing. This is handled automatically in the driver by
+ reading the mux info from OTP.
+
 config REGULATOR_TPS80031
tristate TI TPS80031/TPS80032 power regualtor driver
depends on MFD_TPS80031
Index: linux/drivers/regulator/Makefile
===
--- linux.orig/drivers/regulator/Makefile   2014-05-26 15:21:12.269247638 
+0530
+++ linux/drivers/regulator/Makefile2014-05-26 15:21:46.956121138 +0530
@@ -76,6 +76,7 @@
 obj-$(CONFIG_REGULATOR_TPS6586X) += tps6586x-regulator.o
 obj-$(CONFIG_REGULATOR_TPS65910) += tps65910-regulator.o
 obj-$(CONFIG_REGULATOR_TPS65912) += tps65912-regulator.o
+obj-$(CONFIG_REGULATOR_TPS65917) += tps65917-regulator.o
 obj-$(CONFIG_REGULATOR_TPS80031) += tps80031-regulator.o
 obj-$(CONFIG_REGULATOR_TWL4030) += twl-regulator.o
 obj-$(CONFIG_REGULATOR_VEXPRESS) += vexpress.o
Index: linux/drivers/regulator/tps65917-regulator.c
===
--- /dev/null   1970-01-01 00:00:00.0 +
+++ linux/drivers/regulator/tps65917-regulator.c2014-05-26 
15:22:25.994853307 +0530
@@ -0,0 +1,814 @@
+/*
+ * Driver for Regulator part of TPS65917 PMIC
+ *
+ * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed as is WITHOUT ANY WARRANTY of any
+ * kind, whether expressed or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License version 2 for more details.
+ */
+
+#include linux/kernel.h
+#include linux/module.h
+#include linux/init.h
+#include linux/err.h
+#include linux/platform_device.h
+#include linux/regulator/driver.h
+#include linux/regulator/machine.h
+#include linux/slab.h
+#include linux/regmap.h
+#include linux/mfd/palmas.h
+#include linux/of.h
+#include linux/of_platform.h
+#include linux/regulator/of_regulator.h
+
+static const struct regulator_linear_range smps_low_ranges[] = {
+   REGULATOR_LINEAR_RANGE(50, 0x1, 0x6, 0),
+   REGULATOR_LINEAR_RANGE(51, 0x7, 0x79, 1),
+   REGULATOR_LINEAR_RANGE(165, 0x7A, 0x7f, 0),
+};
+
+static const struct regulator_linear_range smps_high_ranges[] = {
+   REGULATOR_LINEAR_RANGE(100, 0x1, 0x6, 0),
+   REGULATOR_LINEAR_RANGE(102, 0x7, 0x79, 2),
+   REGULATOR_LINEAR_RANGE(330, 0x7A, 0x7f, 0),
+};
+
+struct regs_info {
+   char*name;
+   char*sname;
+   u8  vsel_addr;
+   u8  ctrl_addr;
+   int sleep_id;
+};
+
+static const struct regs_info tps65917_regs_info[] = {
+   {
+   .name   = SMPS1,
+   .sname  = smps1-in,
+   .vsel_addr  = TPS65917_SMPS1_VOLTAGE,
+   .ctrl_addr  = TPS65917_SMPS1_CTRL,
+   .sleep_id   = TPS65917_EXTERNAL_REQSTR_ID_SMPS1,
+   },
+   {
+   .name   = SMPS2,
+   .sname  = smps2-in,
+   .vsel_addr  = TPS65917_SMPS2_VOLTAGE,
+   .ctrl_addr  = TPS65917_SMPS2_CTRL,
+   .sleep_id   = TPS65917_EXTERNAL_REQSTR_ID_SMPS2,
+   },
+   {
+   .name   = SMPS3,
+   .sname  = smps3-in,
+   .vsel_addr  = TPS65917_SMPS3_VOLTAGE,
+   .ctrl_addr  = TPS65917_SMPS3_CTRL,
+   .sleep_id   = 

Re: [PATCH 5/5] regulator: tps65917: Add Regulator driver for tps65917 PMIC

2014-05-26 Thread Mark Brown
On Mon, May 26, 2014 at 03:26:37PM +0530, Keerthy wrote:
 This patch adds support for TPS65917 PMIC regulators.
 
 The regulators set consists of 5 SMPSs and 5 LDOs. The output
 voltages are configurable and are meant to supply power to the
 main processor and other components.

This appears to look *very* like the Palmas driver, should it not be
sharing code with that?  If it were just data tables it'd be less of a
concern but there's quite a bit of actual code here.


signature.asc
Description: Digital signature


Re: [PATCH 5/5] regulator: tps65917: Add Regulator driver for tps65917 PMIC

2014-05-26 Thread Keerthy

Hi Mark,

On Monday 26 May 2014 08:30 PM, Mark Brown wrote:

On Mon, May 26, 2014 at 03:26:37PM +0530, Keerthy wrote:

This patch adds support for TPS65917 PMIC regulators.

The regulators set consists of 5 SMPSs and 5 LDOs. The output
voltages are configurable and are meant to supply power to the
main processor and other components.

This appears to look *very* like the Palmas driver, should it not be
sharing code with that?  If it were just data tables it'd be less of a
concern but there's quite a bit of actual code here.

Yes it is. The difference is in the entire register space of the regulators
between the two. There are other differences in how the ramp delay
is configured and SMPS ordering. The difference is also a bit in the 
programming
sequence. I agree that largely it is Palmas based. I did not want to add 
more

checks in the probe of the palmas driver. Hence came up with a new one.

Coming to sharing the code, can we have 2 drivers which share the common
functions with separate data and specific functions?

I just simply do not want to add anything more to the palmas driver 
probe function.


Kind Regards,
Keerthy
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/