devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] regulator: tps65910: set input_supply on desc unconditionally
@ 2012-07-16 13:44 Laxman Dewangan
       [not found] ` <1342446294-2644-1-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Laxman Dewangan @ 2012-07-16 13:44 UTC (permalink / raw)
  To: broonie, lrg, rob.herring, swarren
  Cc: linux-kernel, devicetree-discuss, Laxman Dewangan

Set the supply_name in the regulator descriptor unconditionally
and make this parameter as required parameter in the device
node for successfully registration of the regulator.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
---

The changes are based on on discussion on patch
[PATCH 1/3] ARM: dt: tegra: seaboard: add regulators
on which the input supply name should be require in DT case and 
unconditionally set on the desc.supply_name.

Although the support was accepted earlier but as per discussion,
it was not so good and hence this is the change.
Becasue no-one is using this device as of now in dt file, it is safe
to change now and provide guidance to the new user of this device.


 Documentation/devicetree/bindings/mfd/tps65910.txt |   36 ++++++++++++--------
 drivers/regulator/tps65910-regulator.c             |   11 +-----
 include/linux/mfd/tps65910.h                       |    2 -
 3 files changed, 23 insertions(+), 26 deletions(-)

diff --git a/Documentation/devicetree/bindings/mfd/tps65910.txt b/Documentation/devicetree/bindings/mfd/tps65910.txt
index 2ae1854..019ef5c 100644
--- a/Documentation/devicetree/bindings/mfd/tps65910.txt
+++ b/Documentation/devicetree/bindings/mfd/tps65910.txt
@@ -24,20 +24,12 @@ Required properties:
             vaux2, vaux33, vmmc
   tps65911: vrtc, vio, vdd1, vdd3, vddctrl, ldo1, ldo2, ldo3, ldo4, ldo5,
             ldo6, ldo7, ldo8
-
-Optional properties:
-- ti,vmbch-threshold: (tps65911) main battery charged threshold
-  comparator. (see VMBCH_VSEL in TPS65910 datasheet)
-- ti,vmbch2-threshold: (tps65911) main battery discharged threshold
-  comparator. (see VMBCH_VSEL in TPS65910 datasheet)
-- ti,en-ck32k-xtal: enable external 32-kHz crystal oscillator (see CK32K_CTRL
-  in TPS6591X datasheet)
-- ti,en-gpio-sleep: enable sleep control for gpios
-  There should be 9 entries here, one for each gpio.
 - xxx-supply: Input voltage supply regulator.
-  Missing of these properties will be assume as there is no supply regulator
-  for that input pins and always powered on.
-  The valid input supply properties are:
+  These entries are require if regulators are enabled for a device. Missing of these
+  properties can cause the regulator registration fails.
+  If some of input supply is powered through battery or always-on supply then
+  also it is require to have these parameters with proper node handle of always
+  on power supply.
   tps65910:
 	vcc1-supply: VDD1 input.
 	vcc2-supply: VDD2 input.
@@ -57,6 +49,16 @@ Optional properties:
 	vcc7-supply: VRTC input.
 	vccio-supply: VIO input.
 
+Optional properties:
+- ti,vmbch-threshold: (tps65911) main battery charged threshold
+  comparator. (see VMBCH_VSEL in TPS65910 datasheet)
+- ti,vmbch2-threshold: (tps65911) main battery discharged threshold
+  comparator. (see VMBCH_VSEL in TPS65910 datasheet)
+- ti,en-ck32k-xtal: enable external 32-kHz crystal oscillator (see CK32K_CTRL
+  in TPS6591X datasheet)
+- ti,en-gpio-sleep: enable sleep control for gpios
+  There should be 9 entries here, one for each gpio.
+
 Regulator Optional properties:
 - ti,regulator-ext-sleep-control: enable external sleep
   control through external inputs [0 (not enabled), 1 (EN1), 2 (EN2) or 4(EN3)]
@@ -81,8 +83,14 @@ Example:
 		ti,en-ck32k-xtal;
 		ti,en-gpio-sleep = <0 0 1 0 0 0 0 0 0>;
 
-		vcc7-supply = <&reg_parent>;
 		vcc1-supply = <&reg_parent>;
+		vcc2-supply = <&some_reg>;
+		vcc3-supply = <...>;
+		vcc4-supply = <...>;
+		vcc5-supply = <...>;
+		vcc6-supply = <...>;
+		vcc7-supply = <...>;
+		vccio-supply = <...>;
 
 		regulators {
 			#address-cells = <1>;
diff --git a/drivers/regulator/tps65910-regulator.c b/drivers/regulator/tps65910-regulator.c
index d2ba066..793adda 100644
--- a/drivers/regulator/tps65910-regulator.c
+++ b/drivers/regulator/tps65910-regulator.c
@@ -1001,9 +1001,6 @@ static struct tps65910_board *tps65910_parse_dt_reg_data(
 	*tps65910_reg_matches = matches;
 
 	for (idx = 0; idx < count; idx++) {
-		struct tps_info *info = matches[idx].driver_data;
-		char in_supply[32]; /* 32 is max size of property name */
-
 		if (!matches[idx].init_data || !matches[idx].of_node)
 			continue;
 
@@ -1015,12 +1012,6 @@ static struct tps65910_board *tps65910_parse_dt_reg_data(
 		if (!ret)
 			pmic_plat_data->regulator_ext_sleep_control[idx] = prop;
 
-		if (info->vin_name) {
-			snprintf(in_supply, 32, "%s-supply", info->vin_name);
-			if (of_find_property(np, in_supply, 0))
-				pmic_plat_data->input_supply[idx] =
-								info->vin_name;
-		}
 	}
 
 	return pmic_plat_data;
@@ -1123,7 +1114,7 @@ static __devinit int tps65910_probe(struct platform_device *pdev)
 		pmic->info[i] = info;
 
 		pmic->desc[i].name = info->name;
-		pmic->desc[i].supply_name = pmic_plat_data->input_supply[i];
+		pmic->desc[i].supply_name = info->vin_name;
 		pmic->desc[i].id = i;
 		pmic->desc[i].n_voltages = info->n_voltages;
 		pmic->desc[i].enable_time = info->enable_time_us;
diff --git a/include/linux/mfd/tps65910.h b/include/linux/mfd/tps65910.h
index 9cc09c8..9bf8767 100644
--- a/include/linux/mfd/tps65910.h
+++ b/include/linux/mfd/tps65910.h
@@ -799,7 +799,6 @@ struct tps65910_sleep_keepon_data {
 /**
  * struct tps65910_board
  * Board platform data may be used to initialize regulators.
- * @input_supply: Name of input supply regulator.
  */
 
 struct tps65910_board {
@@ -813,7 +812,6 @@ struct tps65910_board {
 	struct tps65910_sleep_keepon_data *slp_keepon;
 	bool en_gpio_sleep[TPS6591X_MAX_NUM_GPIO];
 	unsigned long regulator_ext_sleep_control[TPS65910_NUM_REGS];
-	const char *input_supply[TPS65910_NUM_REGS];
 	struct regulator_init_data *tps65910_pmic_init_data[TPS65910_NUM_REGS];
 };
 
-- 
1.7.1.1

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

* Re: [PATCH] regulator: tps65910: set input_supply on desc unconditionally
       [not found] ` <1342446294-2644-1-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2012-07-16 19:57   ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2012-07-16 19:57 UTC (permalink / raw)
  To: Laxman Dewangan
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, lrg-l0cyMroinI0,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ


[-- Attachment #1.1: Type: text/plain, Size: 326 bytes --]

On Mon, Jul 16, 2012 at 07:14:54PM +0530, Laxman Dewangan wrote:
> Set the supply_name in the regulator descriptor unconditionally
> and make this parameter as required parameter in the device
> node for successfully registration of the regulator.

This doesn't apply against topic/drivers, please check what's going on
here.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 192 bytes --]

_______________________________________________
devicetree-discuss mailing list
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
https://lists.ozlabs.org/listinfo/devicetree-discuss

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

end of thread, other threads:[~2012-07-16 19:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-16 13:44 [PATCH] regulator: tps65910: set input_supply on desc unconditionally Laxman Dewangan
     [not found] ` <1342446294-2644-1-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-07-16 19:57   ` Mark Brown

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).