public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/4] power_supply: Add DT helper function to get power-supply dev from dt
@ 2014-03-17 12:43 Chanwoo Choi
  2014-03-17 12:43 ` [RFC PATCH 1/4] power_supply: of: Add an API to get power_supply device from dt node Chanwoo Choi
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Chanwoo Choi @ 2014-03-17 12:43 UTC (permalink / raw)
  To: dbaryshkov, dwmw2; +Cc: myungjoo.ham, kyungmin.park, linux-kernel, Chanwoo Choi

This patchset add DT helper function to get power-supply device from devicetree.
- of_power_supply_get_dev(struct device *dev, enum power_supply_dev_type type,
			  int index)
Power-supply class provides 'power_supply_get_by_name()' to users who want to
find power-supply device with the name of power-supply device.

If CONFIG_OF is enabled, device drivers which want to get power-supply device
would directly get the power-supply device from devicetree by using of_power_
supply_get_dev(). This function can be used instead of power_supply_get_by_name().

For example,

[After]
	The charger-manager must need the power-supply device of fuelgauge to
	read the battery capacity. The charger-manager dt don't need to consider
	the name of power-supply device for fuelgauge because of only needing
	phandle of fuelgauge power-supply device.

	fuelgauge0: max17047@36 {
		compatible = "maxim,max17047";
		interrupt-parent = <&gpx2>;
		interrputs = <3 2>;
		reg = <0x36>;
	};

	charger-manager@0 {
		compatible = "charger-manager";
		...
		fuel-gauge = <&fuelgauge0>;	/* Need phandle of fuelgauge
						 phandle name is always same. */
		...
	};

[Before]
	Previous way use the name of fuelgauge power-supply device to get
	fuel-gauge device using power_supply_get_by_name(). If change the name
	of fuelgauge device, we have to modify both fuelgauge dt and charger-
	manager dt. The charger-manager has dependency on the name of fuel-gague
	power-supply device.

	max17047@36 {
		compatible = "maxim,max17047";
		interrupt-parent = <&gpx2>;
		interrputs = <3 2>;
		reg = <0x36>;
	};

	charger-manager@0 {
		compatible = "charger-manager";
		...
		cm-fuel-gauge = "max170xx_battery";	/* Need the name of fuel-gauge */
		...
	};


Chanwoo Choi (4):
  power_supply: of: Add an API to get power_supply device from dt node
  charger-manager: Get power_supply device using of_power_supply_get_dev()
  Documentation: dt: charger-manager: Change the way to get fuel-gauge power-supply device
  max17042_battery: Change battery name instead of static name according to device type

 .../bindings/power_supply/charger-manager.txt      |  8 ++-
 drivers/power/Kconfig                              |  4 ++
 drivers/power/Makefile                             |  2 +
 drivers/power/charger-manager.c                    | 22 ++++--
 drivers/power/max17042_battery.c                   |  2 +-
 drivers/power/of_power_supply.c                    | 82 ++++++++++++++++++++++
 include/linux/power/charger-manager.h              |  2 +
 include/linux/power/of_power_supply.h              | 46 ++++++++++++
 8 files changed, 159 insertions(+), 9 deletions(-)
 create mode 100644 drivers/power/of_power_supply.c
 create mode 100644 include/linux/power/of_power_supply.h

-- 
1.8.0


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

end of thread, other threads:[~2014-03-18 15:01 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-17 12:43 [RFC PATCH 0/4] power_supply: Add DT helper function to get power-supply dev from dt Chanwoo Choi
2014-03-17 12:43 ` [RFC PATCH 1/4] power_supply: of: Add an API to get power_supply device from dt node Chanwoo Choi
2014-03-17 12:43 ` [RFC PATCH 2/4] charger-manager: Get power_supply device using of_power_supply_get_dev() Chanwoo Choi
2014-03-17 12:43 ` [RFC PATCH 3/4] Documentation: dt: charger-manager: Change the way to get fuel-gauge power-supply device Chanwoo Choi
2014-03-17 12:43 ` [RFC PATCH 4/4] max17042_battery: Change battery name instead of static name according to device type Chanwoo Choi
2014-03-18  0:38 ` [RFC PATCH 0/4] power_supply: Add DT helper function to get power-supply dev from dt sre
2014-03-18  1:25   ` Chanwoo Choi
2014-03-18  6:06   ` Chanwoo Choi
2014-03-18 15:01     ` sre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox