summaryrefslogtreecommitdiffstats
path: root/drivers/power
AgeCommit message (Collapse)Author
2014-10-01power: reset: Add generic SYSCON register mapped resetFeng Kan
Add a generic SYSCON register mapped reset mechanism. Signed-off-by: Feng Kan <fkan@apm.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-10-01bq27x00_battery: Fix flag reading for bq27742Puthikorn Voravootivat
This patch fix the following issues. - Flag for bq27742 is 2 bytes contracy to 1 byte for older hardware - Don't read FLAG_CI as bq27742 does not have it - Use Battery full capacity register as last measure discharge Signed-off-by: Puthikorn Voravootivat <puthik@chromium.org> Reviewed-by: Benson Leung <bleung@chromium.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-09-26power: reset: use restart_notifier mechanism for msm-poweroffPramod Gurav
This change replaces use of arm_pm_restart with recently introduced reset mechanism in Linux kernel called restart_notifier. Choosing priority 128, which is default priority, as according to documentation, this mechanism is sufficient to restart the entire system. Cc: Guenter Roeck <linux@roeck-us.net> Cc: Josh Cartwright <joshc@codeaurora.org> Cc: Sebastian Reichel <sre@kernel.org> Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Stephen Boyd <sboyd@codeaurora.org> Cc: linux-pm@vger.kernel.org Reviewed-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-09-26power: Add simple gpio-restart driverDavid Riley
This driver registers a restart handler to set a GPIO line high/low to reset a board based on devicetree bindings. Signed-off-by: David Riley <davidriley@chromium.org> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-09-26Merge tag 'tags/restart-handler-for-v3.18' into nextSebastian Reichel
Immutable branch with restart handler patches for v3.18
2014-09-26power: reset: Add restart functionality for STiH41x platformsLee Jones
This driver adds the restart functionality for STiH415 and STiH416 platforms from STMicroelectronics. This driver registers an arm_pm_restart function to reset the platform. Signed-off-by: Christophe Kerello <christophe.kerello@st.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-09-26power: charger-manager: Fix NULL pointer exception with missing cm-fuel-gaugeKrzysztof Kozlowski
NULL pointer exception happens during charger-manager probe if 'cm-fuel-gauge' property is not present. [ 2.448536] Unable to handle kernel NULL pointer dereference at virtual address 00000000 [ 2.456572] pgd = c0004000 [ 2.459217] [00000000] *pgd=00000000 [ 2.462759] Internal error: Oops: 5 [#1] PREEMPT SMP ARM [ 2.468047] Modules linked in: [ 2.471089] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.17.0-rc6-00251-ge44cf96cd525-dirty #969 [ 2.479765] task: ea890000 ti: ea87a000 task.ti: ea87a000 [ 2.485161] PC is at strcmp+0x4/0x30 [ 2.488719] LR is at power_supply_match_device_by_name+0x10/0x1c [ 2.494695] pc : [<c01f4220>] lr : [<c030fe38>] psr: a0000113 [ 2.494695] sp : ea87bde0 ip : 00000000 fp : eaa97010 [ 2.506150] r10: 00000004 r9 : ea97269c r8 : ea3bbfd0 [ 2.511360] r7 : eaa97000 r6 : c030fe28 r5 : 00000000 r4 : ea3b0000 [ 2.517869] r3 : 0000006d r2 : 00000000 r1 : 00000000 r0 : c057c195 [ 2.524381] Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel [ 2.531671] Control: 10c5387d Table: 4000404a DAC: 00000015 [ 2.537399] Process swapper/0 (pid: 1, stack limit = 0xea87a240) [ 2.543388] Stack: (0xea87bde0 to 0xea87c000) [ 2.547733] bde0: ea3b0210 c026b1c8 eaa97010 eaa97000 eaa97010 eabb60a8 ea3b0210 00000000 [ 2.555891] be00: 00000008 ea2db210 ea1a3410 c030fee0 ea3bbf90 c03138fc c068969c c013526c [ 2.564050] be20: eaa040c0 00000000 c068969c 00000000 eaa040c0 ea2da300 00000002 00000000 [ 2.572208] be40: 00000001 ea2da3c0 00000000 00000001 00000000 eaa97010 c068969c 00000000 [ 2.580367] be60: 00000000 c068969c 00000000 00000002 00000000 c026b71c c026b6f0 eaa97010 [ 2.588527] be80: c0e82530 c026a330 00000000 eaa97010 c068969c eaa97044 00000000 c061df50 [ 2.596686] bea0: ea87a000 c026a4dc 00000000 c068969c c026a448 c0268b5c ea8054a8 eaa8fd50 [ 2.604845] bec0: c068969c ea2db180 c06801f8 c0269b18 c0590f68 c068969c c0656c98 c068969c [ 2.613004] bee0: c0656c98 ea3bbe40 c06988c0 c026aaf0 00000000 c0656c98 c0656c98 c00088a4 [ 2.621163] bf00: 00000000 c0055f48 00000000 00000004 00000000 ea890000 c05dbc54 c062c178 [ 2.629323] bf20: c0603518 c005f674 00000001 ea87a000 eb7ff83b c0476440 00000091 c003d41c [ 2.637482] bf40: c05db344 00000007 eb7ff858 00000007 c065a76c c0647d24 00000007 c062c170 [ 2.645642] bf60: c06988c0 00000091 c062c178 c0603518 00000000 c0603cc4 00000007 00000007 [ 2.653801] bf80: c0603518 c0c0c0c0 00000000 c0453948 00000000 00000000 00000000 00000000 [ 2.661959] bfa0: 00000000 c0453950 00000000 c000e728 00000000 00000000 00000000 00000000 [ 2.670118] bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 2.678277] bfe0: 00000000 00000000 00000000 00000000 00000013 00000000 c0c0c0c0 c0c0c0c0 [ 2.686454] [<c01f4220>] (strcmp) from [<c030fe38>] (power_supply_match_device_by_name+0x10/0x1c) [ 2.695303] [<c030fe38>] (power_supply_match_device_by_name) from [<c026b1c8>] (class_find_device+0x54/0xac) [ 2.705106] [<c026b1c8>] (class_find_device) from [<c030fee0>] (power_supply_get_by_name+0x1c/0x30) [ 2.714137] [<c030fee0>] (power_supply_get_by_name) from [<c03138fc>] (charger_manager_probe+0x3d8/0xe58) [ 2.723683] [<c03138fc>] (charger_manager_probe) from [<c026b71c>] (platform_drv_probe+0x2c/0x5c) [ 2.732532] [<c026b71c>] (platform_drv_probe) from [<c026a330>] (driver_probe_device+0x10c/0x224) [ 2.741384] [<c026a330>] (driver_probe_device) from [<c026a4dc>] (__driver_attach+0x94/0x98) [ 2.749813] [<c026a4dc>] (__driver_attach) from [<c0268b5c>] (bus_for_each_dev+0x54/0x88) [ 2.757969] [<c0268b5c>] (bus_for_each_dev) from [<c0269b18>] (bus_add_driver+0xd4/0x1d0) [ 2.766123] [<c0269b18>] (bus_add_driver) from [<c026aaf0>] (driver_register+0x78/0xf4) [ 2.774110] [<c026aaf0>] (driver_register) from [<c00088a4>] (do_one_initcall+0x80/0x1bc) [ 2.782276] [<c00088a4>] (do_one_initcall) from [<c0603cc4>] (kernel_init_freeable+0x100/0x1cc) [ 2.790952] [<c0603cc4>] (kernel_init_freeable) from [<c0453950>] (kernel_init+0x8/0xec) [ 2.799029] [<c0453950>] (kernel_init) from [<c000e728>] (ret_from_fork+0x14/0x2c) [ 2.806572] Code: e12fff1e e1a03000 eafffff7 e4d03001 (e4d12001) [ 2.812832] ---[ end trace 7f12556111b9e7ef ]--- Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Cc: <stable@vger.kernel.org> Fixes: 856ee6115e2d ("charger-manager: Support deivce tree in charger manager driver") Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-09-26power/restart: call machine_restart instead of arm_pm_restartGuenter Roeck
machine_restart is supported on non-ARM platforms, and and ultimately calls arm_pm_restart, so dont call arm_pm_restart directly but use the more generic function. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Acked-by: Heiko Stuebner <heiko@sntech.de> Cc: Russell King <linux@arm.linux.org.uk> Cc: Arnd Bergmann <arnd@arndb.de> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jonas Jensen <jonas.jensen@gmail.com> Cc: Maxime Ripard <maxime.ripard@free-electrons.com> Cc: Randy Dunlap <rdunlap@infradead.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Tomasz Figa <t.figa@samsung.com> Cc: Will Deacon <will.deacon@arm.com> Cc: Wim Van Sebroeck <wim@iguana.be> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2014-09-25power: max14577: Fix circular config SYSFS dependencyKrzysztof Kozlowski
Make the max14577 charger driver depending on SYSFS instead selecting it. This fixes warning on x86_64 with allmodconfig: scripts/kconfig/conf --allmodconfig Kconfig fs/sysfs/Kconfig:1:error: recursive dependency detected! fs/sysfs/Kconfig:1: symbol SYSFS is selected by CHARGER_MAX14577 drivers/power/Kconfig:327: symbol CHARGER_MAX14577 depends on POWER_SUPPLY drivers/power/Kconfig:1: symbol POWER_SUPPLY is selected by HID_SONY drivers/hid/Kconfig:638: symbol HID_SONY depends on NEW_LEDS drivers/leds/Kconfig:8: symbol NEW_LEDS is selected by SENSORS_APPLESMC drivers/hwmon/Kconfig:299: symbol SENSORS_APPLESMC depends on HWMON drivers/hwmon/Kconfig:5: symbol HWMON is selected by EEEPC_LAPTOP drivers/platform/x86/Kconfig:496: symbol EEEPC_LAPTOP depends on HOTPLUG_PCI drivers/pci/hotplug/Kconfig:5: symbol HOTPLUG_PCI depends on SYSFS Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-09-25Merge tag 'tags/mfd-power-charger-regulator-v3.18' into nextSebastian Reichel
Immutable branch between MFD, Power, Charger and Regulator for v3.18
2014-09-25power: gpio-charger: do not use gpio value directlyHeiko Stuebner
Some gpio implementations return interesting values for gpio_get_value when the value is not 0 - as seen on a imx6sl board. Therefore do not use the value returned from gpio_get_value directly but simply check for 0 or not 0. Signed-off-by: Heiko Stuebner <heiko.stuebner@bq.com> Reviewed-by: Doug Anderson <dianders@chromium.org> Tested-by: Doug Anderson <dianders@chromium.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-09-25power: max8925: Use of_get_child_by_nameKrzysztof Kozlowski
Use of_get_child_by_name to obtain reference to charger node instead of of_find_node_by_name which can walk outside of the parent node. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-09-25power: max8925: Fix NULL ptr dereference on memory allocation failureKrzysztof Kozlowski
Check the return value of devm_kzalloc() to fix possible NULL pointer dereference and properly exit the probe() on memory allocation failure. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-09-25bq27x00_battery: Add support to bq27742Puthikorn Voravootivat
Add support to bq27742 in bq27x00 driver. bq27742 register addresses are mostly mostly the same as bq27500 addresses with minor differences. Signed-off-by: Puthikorn Voravootivat <puthik@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Rhyland Klein <rklein@nvidia.com> Reviewed-by: Benson Leung <bleung@chromium.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-09-24power: max17040: Add ID for MAX77836 Fuel Gauge blockKrzysztof Kozlowski
MAX77836 has the same Fuel Gauge as MAX17040/17048. The max17040 driver can be safely re-used. The patch adds MAX77836 device to the array of i2c_device_id. Additionally it removes the id associated with MAX17040 device as the value is not used. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Acked-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-09-24charger: max14577: Configure battery-dependent settings from DTS and sysfsKrzysztof Kozlowski
Remove hard-coded values for: - Fast Charge current, - End Of Charge current, - Fast Charge timer, - Overvoltage Protection Threshold, - Battery Constant Voltage, and use DTS or sysfs to configure them. This allows using the max14577 charger driver with different batteries. Now the charger driver requires valid configuration data from DTS. In case of wrong configuration data it fails during probe. The fast charge timer is configured through sysfs entry. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Acked-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-09-24charger: max14577: Add support for MAX77836 chargerKrzysztof Kozlowski
Add support for MAX77836 charger to the max14577 driver. The MAX77836 charger is almost the same as 14577 model except: - No dead-battery detection; - Support for special charger (like in MAX77693); - Support for DX over-voltage protection (like in MAX77693); - Lower values of charging current (two times lower current for slow/fast charge, much lower EOC current); - Slightly different values in ChgTyp field of STATUS2 register. On MAX14577 0x6 is reserved and 0x7 dead battery. On the MAX77836 the 0x6 means special charger and 0x7 is reserved. Regardless of these differences the driver maps them to one enum max14577_muic_charger_type. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Acked-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-09-16power: reset: add LTC2952 poweroff driverRené Moll
This adds a driver for the LTC2952, an external power control chip, which signals the OS to shut down. Additionally this driver lets the kernel power down the board. Signed-off-by: René Moll <rene.moll@xsens.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-09-16power_supply: Don't iterate over devices to return -EPROBE_DEFERViresh Kumar
This piece of code was added so that we return -EPROBE_DEFER when no devices are registered. But even if class_for_each_device() returns 0, we are going to return -EPROBE_DEFER only. And so this code isn't required at all. Remove it. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-09-16power-supply: Avoid unnecessary 'goto' statementsViresh Kumar
Using 'goto' statements for freeing resources on failures is a good choice as it makes code very clean, and reduces the chances of human errors. Though in most cases compiler may take care of this. But adding unnecessary 'goto' statements wouldn't make anything better. Code becomes less readable actually. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-09-16power-supply: Check for failures only when we can failViresh Kumar
In power_supply_show_property() routine, we call ->get_property() conditionally and should check for failure in that case only. There is no point comparing 'ret' for errors when 'ret' is surely zero. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-09-16power-supply: Use PTR_ERR_OR_ZERO() routineViresh Kumar
At multiple places we are doing exactly what PTR_ERR_OR_ZERO() does. And so that routine can be reused instead of increasing lines of code here. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-09-16power-supply: Mark 'if' blocks in power_supply_changed_work() with 'likely'Viresh Kumar
The 'if' statements in power_supply_changed_work() are mostly there for taking care of races and normally they will always evaluate to true. Optimize them for fast execution with 'likely' statements. Also there is need to have better comments in code to mention about the races clearly. Get them in place. Cc: Zoran Markovic <zrn.markovic@gmail.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-09-16power-supply: Drop useless 'if (ret.intval)' statementsViresh Kumar
There is no need to check the value of ret.intval before returning it, as we will be returning zero explicitly when ret.intval is zero. So essentially we will end up returning value of ret.intval as it is. Drop the unnecessary 'if' statements. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-09-16power-supply: Don't return -EINVAL from __power_supply_find_supply_from_node()Viresh Kumar
We need to stop 'class_for_each_device' loop when a supply matches with the of-node. In order to achieve this we currently return -EINVAL from __power_supply_populate_supplied_from() on successful match. class_for_each_device() is free to return similar errors in other cases as well and so the choice of return value here isn't particularly great. This commit isn't removing the Hack but making it more elegant by returning '1' instead. Also power_supply_find_supply_from_node() can return errors other than -EPROBE_DEFER now if class_for_each_device() fails. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-09-16power-supply: Propagate error returned by power_supply_find_supply_from_node()Viresh Kumar
Callers of power_supply_find_supply_from_node(), i.e. power_supply_check_supplies(), must propagate the errors returned by it instead of returning their own. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-09-16power-supply: Rearrange code to remove duplicate linesViresh Kumar
of_node_put() was called twice in power_supply_check_supplies() whereas a single call will also work. Rearrange code a bit to make that feasible. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-09-16power-supply: Use 'break' instead of 'continue' to end loopViresh Kumar
In few routines, we need to end the do-while loop when no more "power-supplies" are available. Currently we are doing 'continue' which will make the 'while(np)' conditional statement run again. Skip this by doing a 'break' instead. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-09-16power-supply: Drop unnecessary typecastsViresh Kumar
Typecast from 'void *' to any other pointer type falls under implicit typecasts category and so doesn't require explicit typecasts. Drop them. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-09-16power-supply: Return early if "power-supplies" property isn't validViresh Kumar
If power-supply's DT node doesn't have a valid "power-supplies" entry, then power_supply_check_supplies() should return early instead of trying to allocate memory for "supplied_from" array. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-09-16power-supply: Don't over-allocate memory for "supplied-from" arrayViresh Kumar
In routine power_supply_check_supplies(), 'cnt' is counting the number of supplies passed in "power-supplies" field of a node. The value of 'cnt' will always be one more than the number of supplies after the do-while loop ends. And so we need to allocate memory for 'cnt - 1' char pointers. But we are allocating memory for 'cnt' instead. Fix this by not over-allocating memory. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-09-06power: charger-manager: Remove casting the return value which is a void pointerJingoo Han
Casting the return value which is a void pointer is redundant. The conversion from void pointer to any other pointer type is guaranteed by the C programming language. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-09-06power_supply: Add boot and calibration attributesRamakrishna Pallala
Usually PMIC's come with coulomb counting mechanism which can be used to implement a Fuel Gauginig solution in Software itself. One of key input to these SW Fuel Gauge solutioons is the boot up parameters like boot voltage and boot current. This patch adds the VOLTAGE_BOOT and CURRENT_BOOT power supply attributes to report bootup voltage and current. This patch also adds CALIBRATE power supply attribute which useful is for calibrating the battery/coulomb counter. Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-09-06power: charger-manager: Check charging state right after completed ↵Chanwoo Choi
initialization This patch check the charging state after completed initialization of charger- manager and update current charging state. If charger-manager never check and update current charging state, charger-manager would have the mismatch issue between real state of cable connection and the charging state of charger-manager until first polling time of charger-manager. Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Acked-by: Myungjoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-09-06power: charger-manager: Fix checking of wrong return typeChanwoo Choi
This patch fix minor issue about checking wrong return type. The of_cm_parse_desc() return ERR_PTR(errnor number) when some error happen in this function. But, charger_manager_probe() has only checked whether desc is NULL or not. If of_cm_parse_desc() returns ERR_PTR(-ENOMEM), desc isn't NULL but desc is (void *)(-ENOMEM). Althouhg some error happen for parsing DT, charger_manager_probe() can't detect error of desc instance. Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Acked-by: Myungjoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-09-06power/reset: xgene-reset: Fix prototype of xgene_restart()Mark Brown
The xgene-reset driver uses xgene_restart() as arm_pm_restart() but that function should take an enum reset_type as the first argument rather than a char. Fix this; the paramter is not referenced in the implementation. Signed-off-by: Mark Brown <broonie@linaro.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-09-06sbs-battery: add min design voltage to sbs-batterySimon Que
sbs-battery has a max design voltage but not a min design voltage field. The SBS spec only has one design voltage: http://www.sbs-forum.org/specs/sbdat110.pdf Currently this is being used for max design voltage. This patch uses it for min design voltage as well. Signed-off-by: Simon Que <sque@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Todd Broch <tbroch@chromium.org> Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-09-06sbs-battery: export manufacturer and model name to sysfsCheng-Yi Chiang
This CL supports two power_supply_property items for smart battery: POWER_SUPPLY_PROP_MANUFACTURER and POWER_SUPPLY_PROP_MODEL_NAME such that battery information 'manufacturer' and 'model_name' can be exported to sysfs. Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org> Reviewed-by: Olof Johansson <olofj@chromium.org> Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-08-08Merge tag 'soc-for-3.17' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc Pull ARM SoC platform changes from Olof Johansson: "This is the bulk of new SoC enablement and other platform changes for 3.17: - Samsung S5PV210 has been converted to DT and multiplatform - Clock drivers and bindings for some of the lower-end i.MX 1/2 platforms - Kirkwood, one of the popular Marvell platforms, is folded into the mvebu platform code, removing mach-kirkwood - Hwmod data for TI AM43xx and DRA7 platforms - More additions of Renesas shmobile platform support - Removal of plat-samsung contents that can be removed with S5PV210 being multiplatform/DT-enabled and the other two old platforms being removed New platforms (most with only basic support right now): - Hisilicon X5HD2 settop box chipset is introduced - Mediatek MT6589 (mobile chipset) is introduced - Broadcom BCM7xxx settop box chipset is introduced + as usual a lot other pieces all over the platform code" * tag 'soc-for-3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (240 commits) ARM: hisi: remove smp from machine descriptor power: reset: move hisilicon reboot code ARM: dts: Add hix5hd2-dkb dts file. ARM: debug: Rename Hi3716 to HIX5HD2 ARM: hisi: enable hix5hd2 SoC ARM: hisi: add ARCH_HISI MAINTAINERS: add entry for Broadcom ARM STB architecture ARM: brcmstb: select GISB arbiter and interrupt drivers ARM: brcmstb: add infrastructure for ARM-based Broadcom STB SoCs ARM: configs: enable SMP in bcm_defconfig ARM: add SMP support for Broadcom mobile SoCs Documentation: arm: misc updates to Marvell EBU SoC status Documentation: arm: add URLs to public datasheets for the Marvell Armada XP SoC ARM: mvebu: fix build without platforms selected ARM: mvebu: add cpuidle support for Armada 38x ARM: mvebu: add cpuidle support for Armada 370 cpuidle: mvebu: add Armada 38x support cpuidle: mvebu: add Armada 370 support cpuidle: mvebu: rename the driver from armada-370-xp to mvebu-v7 ARM: mvebu: export the SCU address ...
2014-07-30power: reset: move hisilicon reboot codeHaojian Zhuang
Move reboot code from hisilicon platform driver into reset driver. Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org> Acked-by: Wei Xu <xuwei5@hisilicon.com> Signed-off-by: Olof Johansson <olof@lixom.net>
2014-07-28ipaq_micro_battery: fix sparse non static symbol warningWei Yongjun
Fixes the following sparse warnings: drivers/power/ipaq_micro_battery.c:278:24: warning: symbol 'micro_batt_device_driver' was not declared. Should it be static? Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-07-24power: add driver for battery reading on iPaq h3xxxDmitry Artamonow
This adds a driver for reading the battery status of the battery connected to the Atmel microcontroller on the iPAQ h3xxx series. Based on a driver from handhelds.org 2.6.21 kernel, written by Alessandro GARDICH. Signed-off-by: Dmitry Artamonow <mad_soft@inbox.ru> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-07-23power: twl4030_charger: detect battery presence prior to enabling chargerNishanth Menon
TWL4030's Battery Charger seems to be designed for non-hotpluggable batteries. If battery is not present in the system, BATSTS is always set with the expectation that software will take actions to move to a required safe state (could be power down or disable various charger paths). It does not seem possible even by manipulating the edge detection of the event (using BCIEDR2 register) to have a consistent hotplug handling. This seems to be the result of BATSTS interrupt generated when the thermistor of the battery pack is disconnected from the dedicated ADIN1 pin. Clearing the status just results in the status being regenerated by the monitoring ADC(MADC) and disabling the edges of event just makes hotplug no longer function. The only other option is to disable the detection of the MADC by disabling BCIMFEN4::BATSTSMCHGEN (battery presence detector) - but then, we can never again detect battery reconnection. So, detect battery presence based on precharge(which is hardware automatic state) or default main charger configuration at the time of probe and enable charger logic only if battery was present. Reported-by: Russell King <linux@arm.linux.org.uk> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Nishanth Menon <nm@ti.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-07-23power: reset: Add reboot driver for brcmstbMarc Carino
Add support for reboot functionality on boards with ARM-based Broadcom STB chipsets. Make it built-in by default for ARCH_BRCMSTB, but allow it to be configurable under COMPILE_TEST. Signed-off-by: Marc Carino <marc.ceeeee@gmail.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-07-20power_supply: Fix sparse non static symbol warningWei Yongjun
Fixes the following sparse warnings: drivers/power/power_supply_core.c:540:5: warning: symbol '__power_supply_register' was not declared. Should it be static? Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-07-18power_supply: Add inlmt,iterm, min/max temp propsJenny TC
Add new power supply properties for input current, charge termination current, min and max temperature POWER_SUPPLY_PROP_TEMP_MIN - minimum operatable temperature POWER_SUPPLY_PROP_TEMP_MAX - maximum operatable temperature POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT - input current limit programmed by charger. Indicates the input current for a charging source. POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT - Charge termination current used to detect the end of charge condition Signed-off-by: Jenny TC <jenny.tc@intel.com> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-07-18charger: tps65090: Allow charger module to be used when no irqDoug Anderson
On the ARM Chromebook tps65090 has two masters: the AP (the main processor running linux) and the EC (the embedded controller). The AP is allowed to mess with FETs but the EC is in charge of charge control. The tps65090 interupt line is routed to both the AP and the EC, which can cause quite a headache. Having two people adjusting masks and acking interrupts is a recipe for disaster. In the shipping kernel we had a hack to have the AP pay attention to the IRQ but not to ack it. It also wasn't supposed to configure the IRQ in any way. That hack allowed us to detect when the device was charging without messing with the EC's state. The current tps65090 infrastructure makes the above difficult, and it was a bit of a hack to begin with. Rather than uglify the driver to support it, just extend the driver's existing notion of "no irq" to the charger. This makes the charger code poll every 2 seconds for AC detect, which is sufficient. For proper functioning, requires (mfd: tps65090: Don't tell child devices we have an IRQ if we don't). If we don't have that patch we'll simply fail to probe on devices without an interrupt (just like we did before this patch). Signed-off-by: Doug Anderson <dianders@chromium.org> Reviewed-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Tested-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> [sre@kernel.org: Use -ENXIO instead of NO_IRQ for missing interrupt, since NO_IRQ is not available on all architectures.] Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-07-18power/reset: Fix GPL v2 license string typoBjorn Helgaas
Per license_is_gpl_compatible(), the MODULE_LICENSE() string for GPL v2 is "GPL v2", not "GPLv2". Use "GPL v2" so this module doesn't taint the kernel. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-07-18power: poweroff: gpio: convert to use descriptorsLinus Walleij
This switches the GPIO poweroff driver to use GPIO descriptors rather than numeral GPIOs. We get rid of the specific inversion handling as GPIO descriptors know if they are active low or high and can assert the line properly, so we do not need to check the flag OF_GPIO_ACTIVE_LOW returned from the old call of_get_gpio_flags() anymore. Also convert to use managed resources and use dev_* message printing while we're at it. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2014-07-18bq27000: report missing device better.Marek Belisko
One an hdq buss, a missing device reads as 0xff, not -1. So do a translation to allow detecting of a missing bus. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Sebastian Reichel <sre@kernel.org>