summaryrefslogtreecommitdiffstats
path: root/drivers
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-26watchdog: sunxi: register restart handler with kernel restart handlerGuenter Roeck
The kernel core now provides an API to trigger a system restart. Register with it instead of setting arm_pm_restart. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Heiko Stuebner <heiko@sntech.de> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Catalin Marinas <catalin.marinas@arm.com> 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: Russell King <linux@arm.linux.org.uk> 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-26watchdog: alim7101: register restart handler with kernel restart handlerGuenter Roeck
The kernel core now provides an API to trigger a system restart. Register with it to restart the system instead of misusing the reboot notifier. 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: 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: Russell King <linux@arm.linux.org.uk> 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-26watchdog: moxart: register restart handler with kernel restart handlerGuenter Roeck
The kernel now provides an API to trigger a system restart. Register with it instead of setting arm_pm_restart. 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: 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: Russell King <linux@arm.linux.org.uk> 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-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-24regulator/mfd: max14577: Export symbols for calculating charger currentKrzysztof Kozlowski
This patch prepares for changing the max14577 charger driver to allow configuring battery-dependent settings from DTS. The patch moves from regulator driver to MFD core driver and exports: - function for calculating register value for charger's current; - table of limits for chargers (MAX14577, MAX77836). Previously they were used only by the max14577 regulator driver. In next patch the charger driver will use them as well. Exporting them will reduce unnecessary code duplication. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Acked-by: Mark Brown <broonie@linaro.org> 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-24mfd: max14577: Map charger device to its own of_nodeKrzysztof Kozlowski
Add a "maxim,max14577-charger" of_compatible to the mfd_cell so the MFD child device (the charger) will have its own of_node set. This will be used by the max14577 charger driver in next patches to obtain battery configuration from DTS. 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-09-05Merge branch 'i2c/for-current' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux Pull i2c bugfixes from Wolfram Sang: "I2C driver bugfixes for the 3.17 release. Details can be found in the commit messages, yet I think this is typical driver stuff" * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: Revert "i2c: rcar: remove spinlock" i2c: at91: add bound checking on SMBus block length bytes i2c: rk3x: fix bug that cause transfer fails in master receive mode i2c: at91: Fix a race condition during signal handling in at91_do_twi_xfer. i2c: mv64xxx: continue probe when clock-frequency is missing i2c: rcar: fix MNR interrupt handling
2014-09-05Merge tag 'gpio-v3.17-3' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio Pull GPIO fixes from Linus Walleij: - some documentation sync - resource leak in the bt8xx driver - again fix the way varargs are used to handle the optional flags on the gpiod_* accessors. Now hopefully nailed the entire problem. * tag 'gpio-v3.17-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: gpio: move varargs hack outside #ifdef GPIOLIB gpio: bt8xx: fix release of managed resources Documentation: gpio: documentation for optional getters functions
2014-09-05Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linuxLinus Torvalds
Pull drm fixes from Dave Airlie: - i915 fixes: a few display regressions - vmwgfx: possible loop forever fix - nouveau: one userspace interface fix * 'drm-fixes' of git://people.freedesktop.org/~airlied/linux: drm/nouveau/core: don't leak oclass type bits to user drm/i915: Fix lock dropping in intel_tv_detect() drm/i915: handle G45/GM45 pulse detection connected state. drm/vmwgfx: Fix a potential infinite spin waiting for fifo idle drm/vmwgfx: Fix an incorrect OOM return value drm/i915: Remove bogus __init annotation from DMI callbacks drm/i915: don't warn if backlight unexpectedly enabled drm/i915: Move intel_ddi_set_vc_payload_alloc(false) to haswell_crtc_disable() drm/i915: fix plane/cursor handling when runtime suspended drm/i915: Ignore VBT backlight presence check on Acer C720 (4005U)
2014-09-05Merge branch 'linux-3.17' of ↵Dave Airlie
git://anongit.freedesktop.org/git/nouveau/linux-2.6 into drm-fixes single fix for nouveau. * 'linux-3.17' of git://anongit.freedesktop.org/git/nouveau/linux-2.6: drm/nouveau/core: don't leak oclass type bits to user
2014-09-05drm/nouveau/core: don't leak oclass type bits to userBen Skeggs
Fixes not being able to init fence subsystem when multiple boards are present. Reported-by: Ilia Mirkin <imirkin@alum.mit.edu> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-09-04Revert "i2c: rcar: remove spinlock"Sergei Shtylyov
This reverts commit 150b8be3cda54412ad7b54f5392b513b25c0aaa7. The I2C core's per-adapter locks can't protect from IRQs, so the driver still needs a spinlock to protect the register accesses. Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Cc: stable@vger.kernel.org # 3.16+ Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-09-04Merge tag 'hwmon-for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging Pull hwmon bugfix from Guenter Roeck: "Fix a bug in the ds1621 driver" * tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: hwmon: (ds1621) Update zbits after conversion rate change