summaryrefslogtreecommitdiffstats
path: root/0003-power-supply-core-Add-support-for-supplied-from-devi.patch
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2017-06-14 17:30:36 +0200
committerHans de Goede <hdegoede@redhat.com>2017-06-23 10:59:39 +0200
commit88f3771491aa5e04aeb32607a30aaa632158e961 (patch)
tree6cd01958277a7f55962a826fd7a6d72d1c5454f7 /0003-power-supply-core-Add-support-for-supplied-from-devi.patch
parent6b98e5e530e3b2c55e00df68c9537ac767058da5 (diff)
downloadkernel-88f3771491aa5e04aeb32607a30aaa632158e961.tar.gz
kernel-88f3771491aa5e04aeb32607a30aaa632158e961.tar.xz
kernel-88f3771491aa5e04aeb32607a30aaa632158e961.zip
Improve Bay and Cherry Trail device support
- Enable AXP288 PMIC support on x86_64 for battery charging and monitoring support on Bay and Cherry Trail tablets and laptops - Enable various drivers for peripherals found on Bay and Cherry Trail tablets - Add some small patches fixing suspend/resume touchscreen and accelerometer issues on various Bay and Cherry Trail tablets
Diffstat (limited to '0003-power-supply-core-Add-support-for-supplied-from-devi.patch')
-rw-r--r--0003-power-supply-core-Add-support-for-supplied-from-devi.patch57
1 files changed, 57 insertions, 0 deletions
diff --git a/0003-power-supply-core-Add-support-for-supplied-from-devi.patch b/0003-power-supply-core-Add-support-for-supplied-from-devi.patch
new file mode 100644
index 000000000..ab646e2e5
--- /dev/null
+++ b/0003-power-supply-core-Add-support-for-supplied-from-devi.patch
@@ -0,0 +1,57 @@
+From 69dd0606a0d8680fe0a5e9b959f6662e582e1674 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede@redhat.com>
+Date: Tue, 2 May 2017 13:43:34 +0200
+Subject: [PATCH 03/16] power: supply: core: Add support for supplied-from
+ device-property
+
+On devicetree using platforms the devicetree can provide info on which
+power-supplies supply another power-supply through phandles.
+
+This commit adds support for providing this info on non devicetree
+platforms through the platform code setting a supplied-from
+device-property on the power-supplies parent device.
+
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+---
+ drivers/power/supply/power_supply_core.c | 24 +++++++++++++++++++++++-
+ 1 file changed, 23 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
+index 7ec7c7c202bd..0c09144193a6 100644
+--- a/drivers/power/supply/power_supply_core.c
++++ b/drivers/power/supply/power_supply_core.c
+@@ -274,8 +274,30 @@ static int power_supply_check_supplies(struct power_supply *psy)
+ return power_supply_populate_supplied_from(psy);
+ }
+ #else
+-static inline int power_supply_check_supplies(struct power_supply *psy)
++static int power_supply_check_supplies(struct power_supply *psy)
+ {
++ int nval, ret;
++
++ if (!psy->dev.parent)
++ return 0;
++
++ nval = device_property_read_string_array(psy->dev.parent,
++ "supplied-from", NULL, 0);
++ if (nval <= 0)
++ return 0;
++
++ psy->supplied_from = devm_kmalloc_array(&psy->dev, nval,
++ sizeof(char *), GFP_KERNEL);
++ if (!psy->supplied_from)
++ return -ENOMEM;
++
++ ret = device_property_read_string_array(psy->dev.parent,
++ "supplied-from", (const char **)psy->supplied_from, nval);
++ if (ret < 0)
++ return ret;
++
++ psy->num_supplies = nval;
++
+ return 0;
+ }
+ #endif
+--
+2.13.0
+