summaryrefslogtreecommitdiffstats
path: root/drivers/power
Commit message (Collapse)AuthorAgeFilesLines
* power_supply: tps65217-charger: Fix NULL deref during property exportMarcin Niestroj2016-06-161-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | This bug leads to: [ 1.906411] Unable to handle kernel NULL pointer dereference at virtual address 0000000c [ 1.914878] pgd = c0004000 [ 1.917786] [0000000c] *pgd=00000000 [ 1.921536] Internal error: Oops: 5 [#1] SMP ARM [ 1.926357] Modules linked in: [ 1.929556] CPU: 0 PID: 14 Comm: kworker/0:1 Not tainted 4.4.5 #18 [ 1.936006] Hardware name: Generic AM33XX (Flattened Device Tree) [ 1.942383] Workqueue: events power_supply_changed_work [ 1.947842] task: de2c41c0 ti: de2c8000 task.ti: de2c8000 [ 1.953483] PC is at tps65217_ac_get_property+0x14/0x28 [ 1.958937] LR is at tps65217_ac_get_property+0x10/0x28 Driver was trying to use drv_data in property get handler. However drv_data was not set, so it caused NULL pointer dereference. This patch properly sets drv_data during probe by power_supply_config parameter, so the property get handler works as desired. Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com> Fixes: 3636859b280c ("power_supply: Add support for tps65217-charger") Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power_supply: power_supply_read_temp only if use_cnt > 0Rhyland Klein2016-06-141-11/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change power_supply_read_temp() to use power_supply_get_property() so that it will check the use_cnt and ensure it is > 0. The use_cnt will be incremented at the end of __power_supply_register, so this will block to case where get_property can be called before the supply is fully registered. This fixes the issue show in the stack below: [ 1.452598] power_supply_read_temp+0x78/0x80 [ 1.458680] thermal_zone_get_temp+0x5c/0x11c [ 1.464765] thermal_zone_device_update+0x34/0xb4 [ 1.471195] thermal_zone_device_register+0x87c/0x8cc [ 1.477974] __power_supply_register+0x364/0x424 [ 1.484317] power_supply_register_no_ws+0x10/0x18 [ 1.490833] bq27xxx_battery_setup+0x10c/0x164 [ 1.497003] bq27xxx_battery_i2c_probe+0xd0/0x1b0 [ 1.503435] i2c_device_probe+0x174/0x240 [ 1.509172] driver_probe_device+0x1fc/0x29c [ 1.515167] __driver_attach+0xa4/0xa8 [ 1.520643] bus_for_each_dev+0x58/0x98 [ 1.526204] driver_attach+0x20/0x28 [ 1.531505] bus_add_driver+0x1c8/0x22c [ 1.537067] driver_register+0x68/0x108 [ 1.542630] i2c_register_driver+0x38/0x7c [ 1.548457] bq27xxx_battery_i2c_driver_init+0x18/0x20 [ 1.555321] do_one_initcall+0x38/0x12c [ 1.560886] kernel_init_freeable+0x148/0x1ec [ 1.566972] kernel_init+0x10/0xfc [ 1.572101] ret_from_fork+0x10/0x40 Also make the same change to ps_get_max_charge_cntl_limit() and ps_get_cur_chrage_cntl_limit() to be safe. Lastly, change the return value of power_supply_get_property() to -EAGAIN from -ENODEV if use_cnt <= 0. Fixes: 297d716f6260 ("power_supply: Change ownership from driver to core") Cc: stable@vger.kernel.org Signed-off-by: Rhyland Klein <rklein@nvidia.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* Merge tag 'for-v4.7' of ↵Linus Torvalds2016-05-206-10/+297
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply Pull power supply and reset updates from Sebastian Reichel: - alternative reset driver for new at91 SoCs - misc fixes * tag 'for-v4.7' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: sbs-battery: fix power status when battery charging near dry power: ipaq-micro-battery: freeing the wrong variable power/max8925: freeing wrong variable power: reset: at91-shdwc: add new shutdown controller driver ARM: dts: at91: shdwc binding: add new shutdown controller documentation
| * sbs-battery: fix power status when battery charging near dryYH Huang2016-04-101-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | POWER_SUPPLY_STATUS_NOT_CHARGING is used for AC connected, but battery not charging (e.g. because battery temperature is out of acceptable range). When battery is charging near dry and BATTERY_FULL_DISCHARGED is set, it is wrong to set as POWER_SUPPLY_STATUS_NOT_CHARGING. Just use BATTERY_DISCHARGING to decide the power supply status is discharging or charging. Signed-off-by: YH Huang <yh.huang@mediatek.com> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
| * power: ipaq-micro-battery: freeing the wrong variableDan Carpenter2016-04-101-1/+1
| | | | | | | | | | | | | | | | | | We accidentally free "micro_ac_power" which is an error pointer and it leads to an oops. We intended to free "micro_batt_power". Fixes: a2c1d531854c ('power_supply: ipaq_micro_battery: Check return values in probe') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
| * power/max8925: freeing wrong variableDan Carpenter2016-04-101-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | We were freeing "info->battery" instead of "info->usb", which leads to an OOps and a resource leak. The labels were wonky, "out_battery" did release the battery but out_usb did not release usb. I was introducing a call to free usb so it sort conflicted with existing misleading name. I renamed them. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
| * power: reset: at91-shdwc: add new shutdown controller driverNicolas Ferre2016-04-103-0/+291
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sama5d2 SoC has a completely new shutdown controller with new features and register layout. It thus makes sense to add a new driver for this new peripheral. This driver is Device Tree only and handles events from the wake-up pin and the RTC. As the register layout may change in the future, so some values are encoded in a configuration structure. Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* | PM / AVS: rockchip-io: make io-domains a child of the GRFHeiko Stuebner2016-04-261-1/+9
|/ | | | | | | | | | | | | IO-domain handling is part of the general register files, so should live under the grf directly. This change allows the grf to be a simple-mfd and the io-domains fetching the syscon regmap from that parent-node. The old binding is of course preserved, though deprecated. Signed-off-by: Heiko Stuebner <heiko@sntech.de> Acked-by: Kevin Hilman <khilman@baylibre.com> Tested-by: David Wu <david.wu@rock-chips.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* Merge tag 'pm+acpi-4.6-rc1-3' of ↵Linus Torvalds2016-03-251-0/+0
|\ | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm Pull power management fixlet from Rafael Wysocki: "One of commits in my previous pull request changed the permissions of drivers/power/avs/rockchip-io-domain.c to executable by mistake" * tag 'pm+acpi-4.6-rc1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: Fix permissions of drivers/power/avs/rockchip-io-domain.c
| * Fix permissions of drivers/power/avs/rockchip-io-domain.cRafael J. Wysocki2016-03-251-0/+0
| | | | | | | | | | | | | | | | The permissions of this file were modified by commit (f447671b9e4f PM / AVS: rockchip-io: add io selectors and supplies for rk3399) by mistake, so fix them. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* | Merge tag 'pm+acpi-4.6-rc1-2' of ↵Linus Torvalds2016-03-241-0/+58
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm Pull more power management and ACPI updates from Rafael Wysocki: "The second batch of power management and ACPI updates for v4.6. Included are fixups on top of the previous PM/ACPI pull request and other material that didn't make into it but still should go into 4.6. Among other things, there's a fix for an intel_pstate driver issue uncovered by recent cpufreq changes, a workaround for a boot hang on Skylake-H related to the handling of deep C-states by the platform and a PCI/ACPI fix for the handling of IO port resources on non-x86 architectures plus some new device IDs and similar. Specifics: - Fix for an intel_pstate driver issue related to the handling of MSR updates uncovered by the recent cpufreq rework (Rafael Wysocki). - cpufreq core cleanups related to starting governors and frequency synchronization during resume from system suspend and a locking fix for cpufreq_quick_get() (Rafael Wysocki, Richard Cochran). - acpi-cpufreq and powernv cpufreq driver updates (Jisheng Zhang, Michael Neuling, Richard Cochran, Shilpasri Bhat). - intel_idle driver update preventing some Skylake-H systems from hanging during initialization by disabling deep C-states mishandled by the platform in the problematic configurations (Len Brown). - Intel Xeon Phi Processor x200 support for intel_idle (Dasaratharaman Chandramouli). - cpuidle menu governor updates to make it always honor PM QoS latency constraints (and prevent C1 from being used as the fallback C-state on x86 when they are set below its exit latency) and to restore the previous behavior to fall back to C1 if the next timer event is set far enough in the future that was changed in 4.4 which led to an energy consumption regression (Rik van Riel, Rafael Wysocki). - New device ID for a future AMD UART controller in the ACPI driver for AMD SoCs (Wang Hongcheng). - Rockchip rk3399 support for the rockchip-io-domain adaptive voltage scaling (AVS) driver (David Wu). - ACPI PCI resources management fix for the handling of IO space resources on architectures where the IO space is memory mapped (IA64 and ARM64) broken by the introduction of common ACPI resources parsing for PCI host bridges in 4.4 (Lorenzo Pieralisi). - Fix for the ACPI backend of the generic device properties API to make it parse non-device (data node only) children of an ACPI device correctly (Irina Tirdea). - Fixes for the handling of global suspend flags (introduced in 4.4) during hibernation and resume from it (Lukas Wunner). - Support for obtaining configuration information from Device Trees in the PM clocks framework (Jon Hunter). - ACPI _DSM helper code and devfreq framework cleanups (Colin Ian King, Geert Uytterhoeven)" * tag 'pm+acpi-4.6-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (23 commits) PM / AVS: rockchip-io: add io selectors and supplies for rk3399 intel_idle: Support for Intel Xeon Phi Processor x200 Product Family intel_idle: prevent SKL-H boot failure when C8+C9+C10 enabled ACPI / PM: Runtime resume devices when waking from hibernate PM / sleep: Clear pm_suspend_global_flags upon hibernate cpufreq: governor: Always schedule work on the CPU running update cpufreq: Always update current frequency before startig governor cpufreq: Introduce cpufreq_update_current_freq() cpufreq: Introduce cpufreq_start_governor() cpufreq: powernv: Add sysfs attributes to show throttle stats cpufreq: acpi-cpufreq: make Intel/AMD MSR access, io port access static PCI: ACPI: IA64: fix IO port generic range check ACPI / util: cast data to u64 before shifting to fix sign extension cpufreq: powernv: Define per_cpu chip pointer to optimize hot-path cpuidle: menu: Fall back to polling if next timer event is near cpufreq: acpi-cpufreq: Clean up hot plug notifier callback intel_pstate: Do not call wrmsrl_on_cpu() with disabled interrupts cpufreq: Make cpufreq_quick_get() safe to call ACPI / property: fix data node parsing in acpi_get_next_subnode() ACPI / APD: Add device HID for future AMD UART controller ...
| * PM / AVS: rockchip-io: add io selectors and supplies for rk3399David Wu2016-03-231-0/+58
| | | | | | | | | | | | | | | | | | | | | | | | This adds the necessary data for handling io voltage domains on the rk3399. As interesting tidbit, the rk3399 contains two separate iodomain areas. One in the regular General Register Files (GRF) and one in PMUGRF in the pmu power domain. Signed-off-by: David Wu <david.wu@rock-chips.com> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Acked-by: Kevin Hilman <khilman@baylibre.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* | Merge branch 'akpm' (patches from Andrew)Linus Torvalds2016-03-185-63/+24
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Merge second patch-bomb from Andrew Morton: - a couple of hotfixes - the rest of MM - a new timer slack control in procfs - a couple of procfs fixes - a few misc things - some printk tweaks - lib/ updates, notably to radix-tree. - add my and Nick Piggin's old userspace radix-tree test harness to tools/testing/radix-tree/. Matthew said it was a godsend during the radix-tree work he did. - a few code-size improvements, switching to __always_inline where gcc screwed up. - partially implement character sets in sscanf * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (118 commits) sscanf: implement basic character sets lib/bug.c: use common WARN helper param: convert some "on"/"off" users to strtobool lib: add "on"/"off" support to kstrtobool lib: update single-char callers of strtobool() lib: move strtobool() to kstrtobool() include/linux/unaligned: force inlining of byteswap operations include/uapi/linux/byteorder, swab: force inlining of some byteswap operations include/asm-generic/atomic-long.h: force inlining of some atomic_long operations usb: common: convert to use match_string() helper ide: hpt366: convert to use match_string() helper ata: hpt366: convert to use match_string() helper power: ab8500: convert to use match_string() helper power: charger_manager: convert to use match_string() helper drm/edid: convert to use match_string() helper pinctrl: convert to use match_string() helper device property: convert to use match_string() helper lib/string: introduce match_string() helper radix-tree tests: add test for radix_tree_iter_next radix-tree tests: add regression3 test ...
| * | power: ab8500: convert to use match_string() helperAndy Shevchenko2016-03-174-40/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new helper returns index of the mathing string in an array. We would use it here. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| * | power: charger_manager: convert to use match_string() helperAndy Shevchenko2016-03-171-23/+4
| |/ | | | | | | | | | | | | | | | | | | | | | | The new helper returns index of the mathing string in an array. We would use it here. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Sebastian Reichel <sre@kernel.org> Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Cc: David Woodhouse <dwmw2@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* | Merge tag 'for-v4.6' of ↵Linus Torvalds2016-03-1718-62/+624
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply Pull power supply and reset changes from Sebastian Reichel: - add types for USB Type C and PD chargers - add act8945a charger driver - add ACPI/DT bindings for goldfish-battery - add support for versatile reset controller - misc fixes * tag 'for-v4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (24 commits) power: pm2301-charger: use __maybe_unused to hide pm functions power: ipaq-micro-battery: use __maybe_unused to hide pm functions power_supply: 88pm860x_charger: do not pass NULL to power_supply_put jz4740-battery: Correct voltage change check power_supply: lp8788-charger: initialize boolean 'found' goldfish: Enable ACPI-based enumeration for goldfish battery power: goldfish_battery: add devicetree bindings power: act8945a: add charger driver for ACT8945A power: add documentation for ACT8945A's charger DT bindings ARM: dts: n900: Rename isp1704 to isp1707 to match correct name power_supply: bq27xxx_battery: Add of modalias and match table when CONFIG_OF is enabled power_supply: bq2415x_charger: Add of modalias and match table when CONFIG_OF is enabled power_supply: bq2415x_charger: Do not add acpi modalias when CONFIG_ACPI is not enabled power_supply: isp1704_charger: Add compatible of match for nxp,isp1707 power_supply: isp1704_charger: Error messages when probe fail power_supply: Add types for USB Type C and PD chargers power: bq24735-charger: add 'ti,external-control' option power: bq24735-charger: document 'ti,external-control' option power: bq24735-charger: fix failed i2c with ac-detect power: reset: Fix dependencies for !HAS_IOMEM archs ...
| * power: pm2301-charger: use __maybe_unused to hide pm functionsArnd Bergmann2016-03-031-16/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The pm2301 charger driver uses nested #ifdefs to check for both CONFIG_PM and CONFIG_PM_SLEEP in an attempt to hide its suspend and runtime-pm operations when they are unused, but it does not hide the clear_lpn_pin() function in the same way, so we get a build warning when everything is disabled: drivers/power/pm2301_charger.c:123:13: error: 'clear_lpn_pin' defined but not used [-Werror=unused-function] This removes all the #ifdef and instead uses __maybe_unused annotations to let the compiler know it can silently drop the function definition. For the PM2XXX_PM_OPS, we can use an IS_ENABLED() check to avoid defining the structure when CONFIG_PM is not set without the #ifdef. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Sebastian Reichel <sre@kernel.org>
| * power: ipaq-micro-battery: use __maybe_unused to hide pm functionsArnd Bergmann2016-03-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ipaq micro battery driver has suspend/resume functions that are accessed using SIMPLE_DEV_PM_OPS, which hide the reference when CONFIG_PM_SLEEP is not set, resulting in a warning about unused functions: drivers/power/ipaq_micro_battery.c:284:12: error: 'micro_batt_suspend' defined but not used [-Werror=unused-function] drivers/power/ipaq_micro_battery.c:292:12: error: 'micro_batt_resume' defined but not used [-Werror=unused-function] This adds __maybe_unused annotations to let the compiler know it can silently drop the function definition. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Sebastian Reichel <sre@kernel.org>
| * power_supply: 88pm860x_charger: do not pass NULL to power_supply_putColin Ian King2016-03-031-1/+1
| | | | | | | | | | | | | | | | | | | | In the case where power_supply_get_by_name returns NULL the current error return path calls power_supply_put with a NULL psy which will cause a null pointer dereference. Avoid this with an immediate return. Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
| * jz4740-battery: Correct voltage change checkMaarten ter Huurne2016-03-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | The check is supposed to avoid redundant update notifications, so it should check for the difference between old and new voltage exceeding a threshold. Also make sure the result of a failed read is never stored. Signed-off-by: Maarten ter Huurne <maarten@treewalker.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
| * power_supply: lp8788-charger: initialize boolean 'found'Colin Ian King2016-03-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | The boolean 'found' is not initialized and hence garbage. It should be initialized as false. Found with static analysis using CoverityScan Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Milo Kim <milo.kim@ti.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
| * goldfish: Enable ACPI-based enumeration for goldfish batteryYu Ning2016-03-031-0/+8
| | | | | | | | | | | | | | | | | | Add the ACPI bindings to the goldfish battery driver. Signed-off-by: Yu Ning <yu.ning@intel.com> Signed-off-by: Jin Qian <jinqian@android.com> Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
| * power: goldfish_battery: add devicetree bindingsGreg Hackmann2016-03-031-1/+8
| | | | | | | | | | | | | | | | | | Add device tree bindings to the Goldfish virtual platform battery drivers. Signed-off-by: Greg Hackmann <ghackmann@google.com> Signed-off-by: Jin Qian <jinqian@android.com> Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
| * power: act8945a: add charger driver for ACT8945AWenyou Yang2016-02-243-0/+367
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds new driver for Active-semi ACT8945A ActivePath charger (part of ACT8945A MFD driver) providing power supply class information to userspace. The driver can be configured through DT (such as, total timer, precondition timer and input over-voltage threshold). Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> [ add "|| COMPILE_TEST" to MFD_ACT8945A dependency ] Signed-off-by: Sebastian Reichel <sre@kernel.org>
| * power_supply: bq27xxx_battery: Add of modalias and match table when ↵Pali Rohár2016-02-212-0/+36
| | | | | | | | | | | | | | | | CONFIG_OF is enabled Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Sebastian Reichel <sre@kernel.org>
| * power_supply: bq2415x_charger: Add of modalias and match table when ↵Pali Rohár2016-02-211-0/+20
| | | | | | | | | | | | | | | | CONFIG_OF is enabled Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Sebastian Reichel <sre@kernel.org>
| * power_supply: bq2415x_charger: Do not add acpi modalias when CONFIG_ACPI is ↵Pali Rohár2016-02-211-0/+2
| | | | | | | | | | | | | | | | not enabled Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Sebastian Reichel <sre@kernel.org>
| * power_supply: isp1704_charger: Add compatible of match for nxp,isp1707Pali Rohár2016-02-211-0/+1
| | | | | | | | | | Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
| * power_supply: isp1704_charger: Error messages when probe failPali Rohár2016-02-211-4/+14
| | | | | | | | | | | | | | | | | | | | This patch adds more detailed error messages when probe function fails. It is useful for debbuging why the driver refuses to register the charger device. Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Sebastian Reichel <sre@kernel.org>
| * power_supply: Add types for USB Type C and PD chargersBenson Leung2016-02-151-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds power supply types for USB chargers defined in the USB Type-C Specification 1.1 and in the USB Power Delivery Specification Revision 2.0 V1.1. The following are added : POWER_SUPPLY_TYPE_USB_TYPE_C, /* Type C Port */ POWER_SUPPLY_TYPE_USB_PD, /* Power Delivery Port */ POWER_SUPPLY_TYPE_USB_PD_DRP, /* PD Dual Role Port */ Signed-off-by: Benson Leung <bleung@chromium.org> [tomeu: remove the mention to Type C from the comments] Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Todd Broch <tbroch@chromium.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
| * power: bq24735-charger: add 'ti,external-control' optionJonathan Tinkham2016-02-151-0/+11
| | | | | | | | | | | | | | | | Implement an 'ti,external-control' option for when the charger shouldn't be configured by the host. Signed-off-by: Jonathan Tinkham <sctincman@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
| * power: bq24735-charger: fix failed i2c with ac-detectJonathan Tinkham2016-02-151-21/+24
| | | | | | | | | | | | | | | | | | When an ac-detect pin exists, but the charger is not plugged in, the chip will not respond to i2c messages, causing the module to fail when inserted. Signed-off-by: Jonathan Tinkham <sctincman@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
| * power: reset: Fix dependencies for !HAS_IOMEM archsRichard Weinberger2016-02-151-0/+2
| | | | | | | | | | | | | | | | Not every arch has io memory. So, unbreak the build by fixing the dependencies. Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Sebastian Reichel <sre@kernel.org>
| * power: collie_battery: hide unused variableArnd Bergmann2016-02-151-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The 'wakeup_enabled' variable in this driver is only accessed by the optional power management functions and we get a warning when they are disabled: drivers/power/collie_battery.c:29:12: error: 'wakeup_enabled' defined but not used [-Werror=unused-variable] This moves the definition next to the users inside the same #ifdef, which avoids the warning. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Sebastian Reichel <sre@kernel.org>
| * power/reset: versatile: support the actual versatileLinus Walleij2016-02-151-12/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | While this driver is named after the Versatile family of boards (ARM reference designs) the machine actually called Versatile was not supported. This patch makes the driver handle also that machine. We augment the register names for the reset to *VERSATILE* as well since it is the same register offsets for Versatile and RealView. Cc: Rob Herring <robh@kernel.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
| * bq24735_charger: add status property to view/enable/disable chargingPeter Rosin2016-02-151-1/+89
| | | | | | | | | | | | | | Add possibility to disable/re-enable charging via sysfs. Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* | power: bq27xxx_battery: Restore device nameIvaylo Dimitrov2016-02-211-3/+34
|/ | | | | | | | | | | | Patch <703df6c09795> ("power: bq27xxx_battery: Reorganize I2C into a module") has removed the device name numbering from bq27xxx_battery_i2c_probe. Fix that by restoring the code. Fixes: 703df6c097956d17a818e63961c82e8e9eef9fef Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> Reviewed-by: Pali Rohár <pali.rohar@gmail.com> Tested-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power: bq27xxx_battery: Fix bq27541 AveragePower register addressLiu Xiang2016-01-141-1/+1
| | | | | | | | | | | | | Currently in bq27541 driver, the average power register address is incorrectly set to 0x76, which would result in an error: bq27xxx-battery 2-0055: error reading average power register 10: -11 According to the bq27541 datasheet, fix this problem by setting the average power register address to 0x24. Fixes: d74534c27775 ("power: bq27xxx_battery: Add support for additional bq27xxx family devices") Signed-off-by: Liu Xiang <liu.xiang6@zte.com.cn> Acked-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power: test_power: correctly handle empty writesSasha Levin2016-01-071-0/+2
| | | | | | | | | Writing 0 length data into test_power makes it access an invalid array location and kill the system. Fixes: f17ef9b2d ("power: Make test_power driver more dynamic.") Signed-off-by: Sasha Levin <sasha.levin@oracle.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power: generic-adc-battery: use to_delayed_workGeliang Tang2016-01-071-1/+1
| | | | | | | Use to_delayed_work() instead of open-coding it. Signed-off-by: Geliang Tang <geliangtang@163.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power: isp1704_charger: Fix isp1704_write() definitionIvaylo Dimitrov2016-01-071-1/+1
| | | | | | | | | | | All calls to isp1704_write() are using parameter sequence of isp1704_write(isp, reg, val) but the function is defined as isp1704_write(isp, val, reg). Fix isp1704_write function definition so that the driver to be functional. Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> Reviewed-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power: bq27xxx: fix register numbers of bq27500H. Nikolaus Schaller2016-01-071-3/+3
| | | | | | | | | | | bug: according to data sheet some register numbers are wrong. tested: no Fixes: d74534c27775 ("power: bq27xxx_battery: Add support for additional bq27xxx family devices") Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com> Acked-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power: bq27xxx: fix reading for bq27000 and bq27010H. Nikolaus Schaller2016-01-071-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bug: the driver reports funny capacity values: root@letux:/sys/class/power_supply/bq27000-battery# cat uevent POWER_SUPPLY_NAME=bq27000-battery POWER_SUPPLY_STATUS=Charging POWER_SUPPLY_PRESENT=1 POWER_SUPPLY_VOLTAGE_NOW=3702000 POWER_SUPPLY_CURRENT_NOW=-464635 POWER_SUPPLY_CAPACITY=1536 <- over 100% is magic POWER_SUPPLY_CAPACITY_LEVEL=Normal POWER_SUPPLY_TEMP=311 POWER_SUPPLY_TIME_TO_FULL_NOW=10440 POWER_SUPPLY_TECHNOLOGY=Li-ion POWER_SUPPLY_CHARGE_FULL=805450 POWER_SUPPLY_CHARGE_NOW=1068 POWER_SUPPLY_CHARGE_FULL_DESIGN=8844998 <- battery has just 1200 mAh POWER_SUPPLY_CYCLE_COUNT=21 POWER_SUPPLY_ENERGY_NOW=0 POWER_SUPPLY_POWER_AVG=0 POWER_SUPPLY_HEALTH=Good POWER_SUPPLY_MANUFACTURER=Texas Instruments reason: the state of charge and the design capacity register are single byte only. The design capacity returns the higer order byte. tested: GTA04 with Openmoko/FIC HF08x battery (using hdq) Fixes: d74534c27775 ("power: bq27xxx_battery: Add support for additional bq27xxx family devices") Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com> Acked-by: Andrew F. Davis <afd@ti.com> Reviewed-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power: Fix unmet dependency on POWER_SUPPLY by POWER_RESET by uncoupling themKrzysztof Kozlowski2015-12-081-2/+1
| | | | | | | | | | | | | | | | | | | | | | | Currently the reset/power off handlers (POWER_RESET) and Adaptive Voltage Scaling class (POWER_AVS) are not built when POWER_SUPPLY is disabled. The POWER_RESET is also not visible in drivers main section of config. However they do not really depend on power supply so they can be built always. The objects for power supply drivers already depend on particular Kconfig symbols so there is no need for any changes in drivers/power/Makefile. This allows selecting POWER_RESET from main drivers config section and fixes following build warning (encountered on ARM exynos defconfig when POWER_SUPPLY is disabled manually): warning: (ARCH_HISI && ARCH_INTEGRATOR && ARCH_EXYNOS && ARCH_VEXPRESS && REALVIEW_DT) selects POWER_RESET which has unmet direct dependencies (POWER_SUPPLY) warning: (ARCH_EXYNOS) selects POWER_RESET_SYSCON which has unmet direct dependencies (POWER_SUPPLY && POWER_RESET && OF) warning: (ARCH_EXYNOS) selects POWER_RESET_SYSCON_POWEROFF which has unmet direct dependencies (POWER_SUPPLY && POWER_RESET && OF) Reported-by: Pavel Fedin <p.fedin@samsung.com> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power: bq27xxx_battery: Reorganize I2C into a moduleAndrew F. Davis2015-12-054-311/+180
| | | | | | | | Separate out I2C functionality into a module. This fixes several small issues and simplifies the driver initialization. Signed-off-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power: bq27xxx: don't fill system log by missing batteryNeilBrown2015-12-051-1/+1
| | | | | | | | | Print message that battery is not calibrated only once to avoid spamming the log. Suggested-By: H. Nikolaus Schaller <hns@goldelico.com> Suggested-By: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power: max8903_charger: set IRQF_ONESHOT if no primary handler is specifiedSaurabh Sengar2015-12-051-12/+12
| | | | | | | | | | If no primary handler is specified for threaded_irq then a default one is assigned which always returns IRQ_WAKE_THREAD. This handler requires the IRQF_ONESHOT, because the source of interrupt is not disabled. Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power/reset: at91-reset: add missing of_node_putJulia Lawall2015-12-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | for_each_matching_node performs an of_node_get on each iteration, so a break out of the loop requires an of_node_put. A simplified version of the semantic patch that fixes this problem is as follows (http://coccinelle.lip6.fr): // <smpl> @@ expression e,e1; local idexpression np; @@ for_each_matching_node(np, e1) { ... when != of_node_put(np) when != e = np ( return np; | + of_node_put(np); ? return ...; ) ... } // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power: ds2782_battery: constify ds278x_battery_ops structureJulia Lawall2015-12-051-2/+2
| | | | | | | | | The ds278x_battery_ops structure is never modified, so declare it as const. Done with the help of Coccinelle. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* power: bq2415x_charger: Delete unnecessary checks before the function call ↵Markus Elfring2015-12-051-4/+2
| | | | | | | | | | | | | "of_node_put" The of_node_put() function tests whether its argument is NULL and then returns immediately. Thus the test around the calls is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Acked-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
OpenPOWER on IntegriCloud