regulator: tps62360: support dts and enable for tegra-cardhu
Subsystems (4)
v2 cover regulator: tps62360: support dts and enable for tegra-cardhu
Add support for dt on regulator device tps62360. Also enable this regulator for Nvidia's Tegra platform - cardhu.
This series:
- Make the regulator_init_data as pointer type from platform data.
- enable config variable in tegra defconfig
- add entry for tps62360 in dts file of tegra-cardhu.
Changes from V1:
Patch 2 did not compile when not defining CONFIG_OF. Fixed it.
Laxman Dewangan (4):
regulator: tps62360: make init_data of platform data to pointer.
Make the regulator init data as pointer type in platform.
regulator: tps62360: add dt support
Ad dt support.
ARM: tegra: config: enable REGULATOR_TPS62360
ARM: dt: tegra: cardhu: register core regulator tps62360
.../bindings/regulator/tps62360-regulator.txt | 45 ++++++++++++ arch/arm/boot/dts/tegra-cardhu.dts | 14 ++++ arch/arm/configs/tegra_defconfig | 1 + drivers/regulator/tps62360-regulator.c | 74 +++++++++++++++++++- include/linux/regulator/tps62360.h | 4 +- 5 files changed, 133 insertions(+), 5 deletions(-) create mode 100644 Documentation/devicetree/bindings/regulator/tps62360-regulator.txt
PATCH v2 1/4 regulator: tps62360: make init_data of platform data to pointer.
Convert platform data member regulator_init_data to pointer type. This will avoid the copy of entire regualator init data into platform data member when adding dt support and it can be achieve by simple assignment:pdata->init_data = of_get_regulator_init_data(dev, dev->of_node);
---
No change from V1.
drivers/regulator/tps62360-regulator.c | 2 +- include/linux/regulator/tps62360.h | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/regulator/tps62360-regulator.c +1 -1
@@ -408,7 +408,7 @@ static int __devinit tps62360_probe(struct i2c_client *client, } config.dev = &client->dev; - config.init_data = &pdata->reg_init_data; + config.init_data = pdata->reg_init_data; config.driver_data = tps;/* Register the regulators */
include/linux/regulator/tps62360.h +1 -3
@@ -26,8 +26,6 @@#ifndef __LINUX_REGULATOR_TPS62360_H#define __LINUX_REGULATOR_TPS62360_H -#include <linux/regulator/machine.h> -/* * struct tps62360_regulator_platform_data - tps62360 regulator platform data. *
@@ -44,7 +42,7 @@* @vsel1_def_state: Default state of vsel1. 1 if it is high else 0. */ struct tps62360_regulator_platform_data { -struct regulator_init_data reg_init_data; +struct regulator_init_data *reg_init_data;bool en_force_pwm;bool en_discharge;bool en_internal_pulldn;
Signature · 1 line
1.7.1.1
PATCH v2 2/4 regulator: tps62360: add dt support
In reply to Laxman DewanganAdd dt support for the pmu device tps62360 and Add binding documentation with example.
With this patch driver will support both device-tree and non-device tree registration.
---
Changes from V1:
Fixed possible build error in non devicetree.
.../bindings/regulator/tps62360-regulator.txt | 45 ++++++++++++ drivers/regulator/tps62360-regulator.c | 74 +++++++++++++++++++- 2 files changed, 118 insertions(+), 1 deletions(-) create mode 100644 Documentation/devicetree/bindings/regulator/tps62360-regulator.txt
Documentation/devicetree/bindings/regulator/tps62360-regulator.txt new file +45 -0
@@ -0,0 +1,45 @@ +TPS62360 Voltage regulators + +Required properties: +- compatible: Must be one of the following. + "ti,tps62360" + "ti,tps62361", + "ti,tps62362", + "ti,tps62363", +- reg: I2C slave address + +Optional properties: +- ti,enable-force-pwm: Enable fore PWM mode. This is boolean value. +- ti,enable-vout-discharge: Enable output discharge. This is boolean value. +- ti,enable-pull-down: Enable pull down. This is boolean value. +- ti,vsel0-gpio: GPIO for controlling VSEL0 line. + If this property is missing, then assume that there is no GPIO + for vsel0 control. +- ti,vsel1-gpio: Gpio for controlling VSEL1 line. + If this property is missing, then assume that there is no GPIO + for vsel1 control. +- ti,vsel0-state-high: Inital state of vsel0 input is high. + If this property is missing, then assume the state as low (0). +- ti,vsel1-state-high: Inital state of vsel1 input is high. + If this property is missing, then assume the state as low (0). + +Any property defined as part of the core regulator binding, defined in +regulator.txt, can also be used. + +Example: + + abc: tps62360 { + compatible = "ti,tps62361"; + reg = <0x60>; + regulator-name = "tps62361-vout"; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1500000>; + regulator-boot-on + ti,vsel0-gpio = <&gpio1 16 0>; + ti,vsel1-gpio = <&gpio1 17 0>; + ti,vsel0-state-high; + ti,vsel1-state-high; + ti,enable-pull-down; + ti,enable-force-pwm; + ti,enable-vout-discharge; + };
drivers/regulator/tps62360-regulator.c +73 -1
106 lines not on this page · raw message
Signature · 1 line
1.7.1.1
Re: [PATCH V2 2/4] regulator: tps62360: add dt support
Quoted 9 lines · Laxman Dewangan
Add dt support for the pmu device tps62360 and Add binding documentation with example.
With this patch driver will support both device-tree and non-device tree registration.Signed-off-by Laxman Dewangan <[email protected]>---
Changes from V1:
Fixed possible build error in non devicetree.
Minor comments below...
Quoted 14 lines
.../bindings/regulator/tps62360-regulator.txt | 45 ++++++++++++ drivers/regulator/tps62360-regulator.c | 74 +++++++++++++++++++- 2 files changed, 118 insertions(+), 1 deletions(-) create mode 100644 Documentation/devicetree/bindings/regulator/tps62360-regulator.txtDocumentation/devicetree/bindings/regulator/tps62360-regulator.txt new file +2
-0@@ -0,0 +1,45 @@ +TPS62360 Voltage regulators +
Documentation/devicetree/bindings/regulator/tps62360-regulator.txt line 12
Quoted 10 lines
Documentation/devicetree/bindings/regulator/tps62360-regulator.txt new file +10
-0+Required properties: +- compatible: Must be one of the following. + "ti,tps62360" + "ti,tps62361", + "ti,tps62362", + "ti,tps62363", +- reg: I2C slave address + +Optional properties: +- ti,enable-force-pwm: Enable fore PWM mode. This is boolean value.
typo ----------------------------^^^^
Quoted 62 lines
Documentation/devicetree/bindings/regulator/tps62360-regulator.txt new file +33
-0+- ti,enable-vout-discharge: Enable output discharge. This is boolean value. +- ti,enable-pull-down: Enable pull down. This is boolean value. +- ti,vsel0-gpio: GPIO for controlling VSEL0 line. + If this property is missing, then assume that there is no GPIO + for vsel0 control. +- ti,vsel1-gpio: Gpio for controlling VSEL1 line. + If this property is missing, then assume that there is no GPIO + for vsel1 control. +- ti,vsel0-state-high: Inital state of vsel0 input is high. + If this property is missing, then assume the state as low (0). +- ti,vsel1-state-high: Inital state of vsel1 input is high. + If this property is missing, then assume the state as low (0). + +Any property defined as part of the core regulator binding, defined in +regulator.txt, can also be used. + +Example: + + abc: tps62360 { + compatible = "ti,tps62361"; + reg = <0x60>; + regulator-name = "tps62361-vout"; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1500000>; + regulator-boot-on + ti,vsel0-gpio = <&gpio1 16 0>; + ti,vsel1-gpio = <&gpio1 17 0>; + ti,vsel0-state-high; + ti,vsel1-state-high; + ti,enable-pull-down; + ti,enable-force-pwm; + ti,enable-vout-discharge; + };drivers/regulator/tps62360-regulator.c +14
-0@@ -26,6 +26,10 @@#include <linux/module.h> #include <linux/init.h> #include <linux/err.h> +#include <linux/of.h> +#include <linux/of_device.h> +#include <linux/of_gpio.h> +#include <linux/regulator/of_regulator.h> #include <linux/platform_device.h> #include <linux/regulator/driver.h> #include <linux/regulator/machine.h> @@ -297,6 +301,58 @@ static const struct regmap_config tps62360_regmap_config = { .cache_type = REGCACHE_RBTREE, }; +static struct tps62360_regulator_platform_data * +of_get_tps62360_platform_data (struct device *dev) +{ +struct tps62360_regulator_platform_data *pdata; +struct device_node *np = dev->of_node; + + pdata =devm_kzalloc (dev,sizeof (*pdata),GFP_KERNEL ); +if (!pdata) { +dev_err (dev,"Memory alloc failed for platform data\n" ); +return NULL ;
drivers/regulator/tps62360-regulator.c static const struct regmap_config tps62360_regmap_config = { · line 323
Quoted 10 lines
drivers/regulator/tps62360-regulator.c +10
-0+ } + + pdata->reg_init_data =of_get_regulator_init_data (dev, dev->of_node); +if (!pdata->reg_init_data) { +dev_err (dev,"Not able to get OF regulator init data\n" ); +return NULL ; + } + + pdata->vsel0_gpio =of_get_named_gpio (np,"vsel0-gpio" ,0 ); + pdata->vsel1_gpio =of_get_named_gpio (np,"vsel1_gpio" ,0 );
typo --------------------------------------------------^^^
Otherwise looks good to me.
g.
PATCH v2 3/4 ARM: tegra: config: enable REGULATOR_TPS62360
In reply to Laxman DewanganEnable regulator REGULATOR_TPS62360 for the core power of cardhu.
---
No change from V1.
arch/arm/configs/tegra_defconfig | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/configs/tegra_defconfig +1 -0
@@ -114,6 +114,7 @@ CONFIG_REGULATOR=y CONFIG_REGULATOR_FIXED_VOLTAGE=y CONFIG_REGULATOR_VIRTUAL_CONSUMER=y CONFIG_REGULATOR_GPIO=y +CONFIG_REGULATOR_TPS62360=y CONFIG_REGULATOR_TPS6586X=y CONFIG_SOUND=y CONFIG_SND=y
Signature · 1 line
1.7.1.1
PATCH v2 4/4 ARM: dt: tegra: cardhu: register core regulator tps62360
In reply to Laxman DewanganAdd device info for the core regulator tps62360 in tegra-cardhu dts file.
---
No change from V1.
arch/arm/boot/dts/tegra-cardhu.dts | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-)
arch/arm/boot/dts/tegra-cardhu.dts +14 -0
@@ -123,6 +123,20 @@ micdet-delay = <100>; gpio-cfg = <0xffffffff 0xffffffff 0 0xffffffff 0xffffffff>; }; + + tps62360 { + compatible = "ti,tps62361"; + reg = <0x60>; + + regulator-name = "tps62361-vout"; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1500000>; + regulator-boot-on; + regulator-always-on; + ti,vsel0-state-high; + ti,vsel1-state-high; + }; + }; sdhci@78000000 {
Signature · 1 line
1.7.1.1