Re: [U-Boot] [PATCH v4 11/16] dm: regulator: add fixed voltage regulator driver

2015-04-24 Thread Simon Glass
Hi Przemyslaw,

On 23 April 2015 at 06:31, Przemyslaw Marczak p.marc...@samsung.com wrote:
 Hello Simon,

 On 04/20/2015 08:07 PM, Przemyslaw Marczak wrote:

 This driver implements regulator operations for fixed Voltage/Current
 value regulators. beside the standard regulator constraints, which are
 put into the uclass platform data, a typical fixed regulator node provides
 few additional properties like:
 - gpio
 - gpio-open-drain
 - enable-active-high
 - startup-delay-us
 The only 'gpio' is used by this driver and is kept in structure of type
 'fixed_regulator_platdata', as a device platform data (dev-platdata).

 The driver implements:
 - get_value
 - get_current
 - get_enable
 - set_enable

 The regulator calls and commands can be used for fixed-regulator devices,
 and the proper error will be returned for prohibited.

 Signed-off-by: Przemyslaw Marczak p.marc...@samsung.com


 I missed the separation (---) here and I see that you add ACK below the
 changes.
 Could you remove them from the tree?

OK, done. You could try patman which handles this automatically.

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v4 11/16] dm: regulator: add fixed voltage regulator driver

2015-04-23 Thread Przemyslaw Marczak

Hello Simon,

On 04/20/2015 08:07 PM, Przemyslaw Marczak wrote:

This driver implements regulator operations for fixed Voltage/Current
value regulators. beside the standard regulator constraints, which are
put into the uclass platform data, a typical fixed regulator node provides
few additional properties like:
- gpio
- gpio-open-drain
- enable-active-high
- startup-delay-us
The only 'gpio' is used by this driver and is kept in structure of type
'fixed_regulator_platdata', as a device platform data (dev-platdata).

The driver implements:
- get_value
- get_current
- get_enable
- set_enable

The regulator calls and commands can be used for fixed-regulator devices,
and the proper error will be returned for prohibited.

Signed-off-by: Przemyslaw Marczak p.marc...@samsung.com



I missed the separation (---) here and I see that you add ACK below the 
changes.

Could you remove them from the tree?


Changes v3:
- new file
- Kconfig add fixed-regulator entry

Changes V4:
- move DM_REGULATOR_FIXED Kconfig entry from: drivers/power/Kconfig to
   drivers/power/regulator/Kconfig
- regulator/fixed.c: adjust to use of uclass platdata and device platdata
- regulator/fixed.c: includes cleanup
- regulator/fixed.c: fix gpio request
- add binding info
---
  doc/device-tree-bindings/regulator/fixed.txt |  38 
  drivers/power/regulator/Kconfig  |   8 ++
  drivers/power/regulator/Makefile |   1 +
  drivers/power/regulator/fixed.c  | 126 +++
  4 files changed, 173 insertions(+)
  create mode 100644 doc/device-tree-bindings/regulator/fixed.txt
  create mode 100644 drivers/power/regulator/fixed.c


Best regards,
--
Przemyslaw Marczak
Samsung RD Institute Poland
Samsung Electronics
p.marc...@samsung.com
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v4 11/16] dm: regulator: add fixed voltage regulator driver

2015-04-23 Thread Przemyslaw Marczak

+CC Simon

On 04/23/2015 02:31 PM, Przemyslaw Marczak wrote:

Hello Simon,

On 04/20/2015 08:07 PM, Przemyslaw Marczak wrote:

This driver implements regulator operations for fixed Voltage/Current
value regulators. beside the standard regulator constraints, which are
put into the uclass platform data, a typical fixed regulator node
provides
few additional properties like:
- gpio
- gpio-open-drain
- enable-active-high
- startup-delay-us
The only 'gpio' is used by this driver and is kept in structure of type
'fixed_regulator_platdata', as a device platform data (dev-platdata).

The driver implements:
- get_value
- get_current
- get_enable
- set_enable

The regulator calls and commands can be used for fixed-regulator devices,
and the proper error will be returned for prohibited.

Signed-off-by: Przemyslaw Marczak p.marc...@samsung.com



I missed the separation (---) here and I see that you add ACK below the
changes.
Could you remove them from the tree?



[...]

Best regards,
--
Przemyslaw Marczak
Samsung RD Institute Poland
Samsung Electronics
p.marc...@samsung.com
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v4 11/16] dm: regulator: add fixed voltage regulator driver

2015-04-22 Thread Simon Glass
On 20 April 2015 at 12:07, Przemyslaw Marczak p.marc...@samsung.com wrote:
 This driver implements regulator operations for fixed Voltage/Current
 value regulators. beside the standard regulator constraints, which are
 put into the uclass platform data, a typical fixed regulator node provides
 few additional properties like:
 - gpio
 - gpio-open-drain
 - enable-active-high
 - startup-delay-us
 The only 'gpio' is used by this driver and is kept in structure of type
 'fixed_regulator_platdata', as a device platform data (dev-platdata).

 The driver implements:
 - get_value
 - get_current
 - get_enable
 - set_enable

 The regulator calls and commands can be used for fixed-regulator devices,
 and the proper error will be returned for prohibited.

 Signed-off-by: Przemyslaw Marczak p.marc...@samsung.com

 Changes v3:
 - new file
 - Kconfig add fixed-regulator entry

 Changes V4:
 - move DM_REGULATOR_FIXED Kconfig entry from: drivers/power/Kconfig to
   drivers/power/regulator/Kconfig
 - regulator/fixed.c: adjust to use of uclass platdata and device platdata
 - regulator/fixed.c: includes cleanup
 - regulator/fixed.c: fix gpio request
 - add binding info
 ---
  doc/device-tree-bindings/regulator/fixed.txt |  38 
  drivers/power/regulator/Kconfig  |   8 ++
  drivers/power/regulator/Makefile |   1 +
  drivers/power/regulator/fixed.c  | 126 
 +++
  4 files changed, 173 insertions(+)
  create mode 100644 doc/device-tree-bindings/regulator/fixed.txt
  create mode 100644 drivers/power/regulator/fixed.c

Acked-by: Simon Glass s...@chromium.org
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v4 11/16] dm: regulator: add fixed voltage regulator driver

2015-04-22 Thread Simon Glass
On 22 April 2015 at 10:31, Simon Glass s...@chromium.org wrote:
 On 20 April 2015 at 12:07, Przemyslaw Marczak p.marc...@samsung.com wrote:
 This driver implements regulator operations for fixed Voltage/Current
 value regulators. beside the standard regulator constraints, which are
 put into the uclass platform data, a typical fixed regulator node provides
 few additional properties like:
 - gpio
 - gpio-open-drain
 - enable-active-high
 - startup-delay-us
 The only 'gpio' is used by this driver and is kept in structure of type
 'fixed_regulator_platdata', as a device platform data (dev-platdata).

 The driver implements:
 - get_value
 - get_current
 - get_enable
 - set_enable

 The regulator calls and commands can be used for fixed-regulator devices,
 and the proper error will be returned for prohibited.

 Signed-off-by: Przemyslaw Marczak p.marc...@samsung.com

 Changes v3:
 - new file
 - Kconfig add fixed-regulator entry

 Changes V4:
 - move DM_REGULATOR_FIXED Kconfig entry from: drivers/power/Kconfig to
   drivers/power/regulator/Kconfig
 - regulator/fixed.c: adjust to use of uclass platdata and device platdata
 - regulator/fixed.c: includes cleanup
 - regulator/fixed.c: fix gpio request
 - add binding info
 ---
  doc/device-tree-bindings/regulator/fixed.txt |  38 
  drivers/power/regulator/Kconfig  |   8 ++
  drivers/power/regulator/Makefile |   1 +
  drivers/power/regulator/fixed.c  | 126 
 +++
  4 files changed, 173 insertions(+)
  create mode 100644 doc/device-tree-bindings/regulator/fixed.txt
  create mode 100644 drivers/power/regulator/fixed.c

 Acked-by: Simon Glass s...@chromium.org

Applied to u-boot-dm/next, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 11/16] dm: regulator: add fixed voltage regulator driver

2015-04-20 Thread Przemyslaw Marczak
This driver implements regulator operations for fixed Voltage/Current
value regulators. beside the standard regulator constraints, which are
put into the uclass platform data, a typical fixed regulator node provides
few additional properties like:
- gpio
- gpio-open-drain
- enable-active-high
- startup-delay-us
The only 'gpio' is used by this driver and is kept in structure of type
'fixed_regulator_platdata', as a device platform data (dev-platdata).

The driver implements:
- get_value
- get_current
- get_enable
- set_enable

The regulator calls and commands can be used for fixed-regulator devices,
and the proper error will be returned for prohibited.

Signed-off-by: Przemyslaw Marczak p.marc...@samsung.com

Changes v3:
- new file
- Kconfig add fixed-regulator entry

Changes V4:
- move DM_REGULATOR_FIXED Kconfig entry from: drivers/power/Kconfig to
  drivers/power/regulator/Kconfig
- regulator/fixed.c: adjust to use of uclass platdata and device platdata
- regulator/fixed.c: includes cleanup
- regulator/fixed.c: fix gpio request
- add binding info
---
 doc/device-tree-bindings/regulator/fixed.txt |  38 
 drivers/power/regulator/Kconfig  |   8 ++
 drivers/power/regulator/Makefile |   1 +
 drivers/power/regulator/fixed.c  | 126 +++
 4 files changed, 173 insertions(+)
 create mode 100644 doc/device-tree-bindings/regulator/fixed.txt
 create mode 100644 drivers/power/regulator/fixed.c

diff --git a/doc/device-tree-bindings/regulator/fixed.txt 
b/doc/device-tree-bindings/regulator/fixed.txt
new file mode 100644
index 000..4ff39b8
--- /dev/null
+++ b/doc/device-tree-bindings/regulator/fixed.txt
@@ -0,0 +1,38 @@
+Fixed Voltage regulator
+
+Binding:
+The binding is done by the property compatible - this is different, than for
+binding by the node prefix (doc/device-tree-bindings/regulator/regulator.txt).
+
+Required properties:
+- compatible: regulator-fixed
+- regulator-name: this is required by the regulator uclass
+
+Optional properties:
+- gpio: GPIO to use for enable control
+- regulator constraints (binding info: regulator.txt)
+
+Other kernel-style properties, are currently not used.
+
+Note:
+For the regulator constraints, driver expects that:
+- regulator-min-microvolt is equal to regulator-max-microvolt
+- regulator-min-microamp is equal to regulator-max-microamp
+
+Example:
+fixed_regulator@0 {
+   /* Mandatory */
+   compatible = regulator-fixed;
+   regulator-name = LED_3.3V;
+
+   /* Optional: */
+   gpio = gpc1 0 GPIO_ACTIVE_LOW;
+
+   /* Optional for regulator uclass */
+   regulator-min-microvolt = 330;
+   regulator-max-microvolt = 330;
+   regulator-min-microamp = 15000;
+   regulator-max-microamp = 15000;
+   regulator-always-on;
+   regulator-boot-on;
+};
diff --git a/drivers/power/regulator/Kconfig b/drivers/power/regulator/Kconfig
index 0cdfabc..54ce188 100644
--- a/drivers/power/regulator/Kconfig
+++ b/drivers/power/regulator/Kconfig
@@ -23,3 +23,11 @@ config DM_REGULATOR_MAX77686
This config enables implementation of driver-model regulator uclass
features for REGULATOR MAX77686. The driver implements get/set api for:
value, enable and mode.
+
+config DM_REGULATOR_FIXED
+   bool Enable Driver Model for REGULATOR Fixed value
+   depends on DM_REGULATOR
+   ---help---
+   This config enables implementation of driver-model regulator uclass
+   features for fixed value regulators. The driver implements get/set api
+   for enable and get only for voltage value.
diff --git a/drivers/power/regulator/Makefile b/drivers/power/regulator/Makefile
index f9c4e6d..cc8326d 100644
--- a/drivers/power/regulator/Makefile
+++ b/drivers/power/regulator/Makefile
@@ -7,3 +7,4 @@
 
 obj-$(CONFIG_DM_REGULATOR) += regulator-uclass.o
 obj-$(CONFIG_DM_REGULATOR_MAX77686) += max77686.o
+obj-$(CONFIG_DM_REGULATOR_FIXED) += fixed.o
diff --git a/drivers/power/regulator/fixed.c b/drivers/power/regulator/fixed.c
new file mode 100644
index 000..d053817
--- /dev/null
+++ b/drivers/power/regulator/fixed.c
@@ -0,0 +1,126 @@
+/*
+ *  Copyright (C) 2015 Samsung Electronics
+ *
+ *  Przemyslaw Marczak p.marc...@samsung.com
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include common.h
+#include fdtdec.h
+#include errno.h
+#include dm.h
+#include i2c.h
+#include asm/gpio.h
+#include power/pmic.h
+#include power/regulator.h
+
+DECLARE_GLOBAL_DATA_PTR;
+
+struct fixed_regulator_platdata {
+   struct gpio_desc gpio; /* GPIO for regulator enable control */
+};
+
+static int fixed_regulator_ofdata_to_platdata(struct udevice *dev)
+{
+   struct dm_regulator_uclass_platdata *uc_pdata;
+   struct fixed_regulator_platdata *dev_pdata;
+   struct gpio_desc *gpio;
+   int ret;
+
+   dev_pdata = dev_get_platdata(dev);
+   uc_pdata = dev_get_uclass_platdata(dev);
+   if (!uc_pdata)
+   return -ENXIO;
+
+   /* Set