summaryrefslogtreecommitdiffstats
path: root/drivers/power (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge tag 'for-v5.9' of ↵Linus Torvalds2020-08-0827-87/+1691
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply Pull power supply and reset updates from Sebastian Reichel: "Power-supply core: - add COOL/WARM/HOT state from JEITA JISC8712:2015 specification - convert simple-battery DT binding to YAML - add long-life charging mode Battery/charger drivers: - bq25150: new charger driver - bq27xxx: add support for BQ27z561 and BQ28z610 - max17040: support CAPACITY_ALERT_MIN - sbs-battery: add PEC support - wilco-ec: support long-life charging mode - bq25890: fix DT binding - misc. fixes and cleanups Reset drivers: - linkstation: new reset driver" * tag 'for-v5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (32 commits) power: supply: wilco_ec: Add long life charging mode power: supply: bq27xxx_battery: Add the BQ28z610 Battery monitor dt-bindings: power: Add BQ28z610 compatible power: supply: bq27xxx_battery: Add the BQ27Z561 Battery monitor dt-bindings: power: Add BQ27Z561 compatible power: supply: test_power: Fix battery_current initial value power: supply: Fix kerneldoc of power_supply_temp2resist_simple() power: supply: cpcap-battery: Fix kerneldoc of cpcap_battery_read_accumulated() dt-bindings: power: Convert battery.txt to battery.yaml power: supply: rt5033_battery: Fix error code in rt5033_battery_probe() power: supply: max17040: Add POWER_SUPPLY_PROP_CAPACITY_ALERT_MIN power: supply: check if calc_soc succeeded in pm860x_init_battery power: supply: bq2xxxx: Replace HTTP links with HTTPS ones power: reset: add driver for LinkStation power off power: supply: sc27xx: prevent adc * 1000 from overflow math64: New DIV_S64_ROUND_CLOSEST helper power: fix duplicated words in bq2415x_charger.h power: Convert to DEFINE_SHOW_ATTRIBUTE power: reset: keystone-reset: Replace HTTP links with HTTPS ones power: supply: bq25150 introduce the bq25150 ...
| * power: supply: wilco_ec: Add long life charging modeCrag Wang2020-07-312-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a long life mode set in the factory for extended warranty battery, the power charging rate is customized so that battery at work last longer. Presently switching to a different battery charging mode is through EC PID 0x0710 to configure the battery firmware, this operation will be blocked by EC with failure code 0x01 when PLL mode is already in use. Signed-off-by: Crag Wang <crag.wang@dell.com> Reviewed-by: Mario Limonciello <mario.limonciello@dell.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: bq27xxx_battery: Add the BQ28z610 Battery monitorDan Murphy2020-07-292-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | Add the Texas Instruments BQ28z610 battery monitor. The register address map is laid out the same as compared to other devices within the file. The battery status register bits are similar to the bq27z561 but they are different compared to other fuel gauge devices within this file. Signed-off-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: bq27xxx_battery: Add the BQ27Z561 Battery monitorDan Murphy2020-07-292-1/+69
| | | | | | | | | | | | | | | | | | | | Add the Texas Instruments BQ27Z561 battery monitor. The register address map is laid out the same as compared to other devices within the file. The battery status register has differing bits to determine if the battery is full, discharging or dead. Signed-off-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: test_power: Fix battery_current initial valueLH Lin2020-07-291-1/+1
| | | | | | | | | | | | | | | | Since default battery_status is POWER_SUPPLY_STATUS_DISCHARGING, we should change default battery_current to a negative value. Signed-off-by: LH Lin <lh.lin@mediatek.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: Fix kerneldoc of power_supply_temp2resist_simple()Krzysztof Kozlowski2020-07-291-1/+1
| | | | | | | | | | | | | | | | | | | | Fix W=1 compile warnings (invalid kerneldoc): drivers/power/supply/power_supply_core.c:747: warning: Function parameter or member 'temp' not described in 'power_supply_temp2resist_simple' drivers/power/supply/power_supply_core.c:747: warning: Excess function parameter 'ocv' description in 'power_supply_temp2resist_simple' Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: cpcap-battery: Fix kerneldoc of cpcap_battery_read_accumulated()Krzysztof Kozlowski2020-07-291-1/+1
| | | | | | | | | | | | | | | | | | | | Fix W=1 compile warnings (invalid kerneldoc): drivers/power/supply/cpcap-battery.c:292: warning: Function parameter or member 'ccd' not described in 'cpcap_battery_read_accumulated' drivers/power/supply/cpcap-battery.c:292: warning: Excess function parameter 'regs' description in 'cpcap_battery_read_accumulated' Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: rt5033_battery: Fix error code in rt5033_battery_probe()Peng Fan2020-07-281-1/+1
| | | | | | | | | | | | | | | | In the function rt5033_battery_probe(), it should return -ENOMEM instead of -EINVAL when call function devm_kzalloc() failed. Signed-off-by: Peng Fan <fanpeng@loongson.cn> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: max17040: Add POWER_SUPPLY_PROP_CAPACITY_ALERT_MINMatheus Castello2020-07-281-5/+46
| | | | | | | | | | | | | | | | | | | | Adds the property POWER_SUPPLY_PROP_CAPACITY_ALERT_MIN to export the chip->low_soc_alert and add the property as writeable, implementing max17040_prop_writeable and max17040_set_property, so with that the user space can readjust the alerts. Signed-off-by: Matheus Castello <matheus@castello.eng.br> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: check if calc_soc succeeded in pm860x_init_batteryTom Rix2020-07-281-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | clang static analysis flags this error 88pm860x_battery.c:522:19: warning: Assigned value is garbage or undefined [core.uninitialized.Assign] info->start_soc = soc; ^ ~~~ soc is set by calling calc_soc. But calc_soc can return without setting soc. So check the return status and bail similarly to other checks in pm860x_init_battery and initialize soc to silence the warning. Fixes: a830d28b48bf ("power_supply: Enable battery-charger for 88pm860x") Signed-off-by: Tom Rix <trix@redhat.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: bq2xxxx: Replace HTTP links with HTTPS onesAlexander A. Klimov2020-07-286-39/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rationale: Reduces attack surface on kernel devs opening the links for MITM as HTTPS traffic is much harder to manipulate. Deterministic algorithm: For each file: If not .svg: For each line: If doesn't contain `\bxmlns\b`: For each link, `\bhttp://[^# \t\r\n]*(?:\w|/)`: If neither `\bgnu\.org/license`, nor `\bmozilla\.org/MPL\b`: If both the HTTP and HTTPS versions return 200 OK and serve the same content: Replace HTTP with HTTPS. Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de> [also update recently added ti.com http links] Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: reset: add driver for LinkStation power offDaniel González Cabanelas2020-07-283-0/+148
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some Buffalo LinkStations perform the power off operation, at restart time, depending on the state of an output pin (LED2/INTn) at the ethernet PHY. This pin is also used to wake the machine when a WoL packet is received by the PHY. The driver is required by the Buffalo LinkStation LS421DE (ARM MVEBU), and other models. Without it, the board remains forever halted if a power off command is executed, unless the PSU is disconnected and connected again. Add the driver to provide the power off function and also make the WoL feature to be available. Signed-off-by: Daniel González Cabanelas <dgcbueu@gmail.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: sc27xx: prevent adc * 1000 from overflowChunyan Zhang2020-07-281-4/+5
| | | | | | | | | | | | | | | | | | The input parameter is int type, cause adc * 1000 could overflow. Change to use s64 to avoid this issue. Signed-off-by: Chen Yongzhi <yongzhi.chen@unisoc.com> Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: Convert to DEFINE_SHOW_ATTRIBUTEYongqiang Liu2020-07-271-11/+1
| | | | | | | | | | | | | | Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code. Signed-off-by: Yongqiang Liu <liuyongqiang13@huawei.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: reset: keystone-reset: Replace HTTP links with HTTPS onesAlexander A. Klimov2020-07-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rationale: Reduces attack surface on kernel devs opening the links for MITM as HTTPS traffic is much harder to manipulate. Deterministic algorithm: For each file: If not .svg: For each line: If doesn't contain `\bxmlns\b`: For each link, `\bhttp://[^# \t\r\n]*(?:\w|/)`: If neither `\bgnu\.org/license`, nor `\bmozilla\.org/MPL\b`: If both the HTTP and HTTPS versions return 200 OK and serve the same content: Replace HTTP with HTTPS. Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: bq25150 introduce the bq25150Ricardo Rivera-Matos2020-07-213-0/+1183
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce the bq2515x family of chargers. The BQ2515X family of devices are highly integrated battery management ICs that integrate the most common functions for wearable devices namely a charger, an output voltage rail, ADC for battery and system monitoring, and a push-button controller. Datasheets: bq25150 - http://www.ti.com/lit/ds/symlink/bq25150.pdf bq25155 - http://www.ti.com/lit/ds/symlink/bq25155.pdf Signed-off-by: Ricardo Rivera-Matos <r-rivera-matos@ti.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power_supply: Add additional health properties to the headerDan Murphy2020-07-211-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | Add HEALTH_WARM, HEALTH_COOL and HEALTH_HOT to the health enum. HEALTH_WARM, HEALTH_COOL, and HEALTH_HOT properties are taken from JEITA specification JISC8712:2015 Acked-by: Andrew F. Davis <afd@ti.com> Tested-by: Guru Das Srinagesh <gurus@codeaurora.org> Signed-off-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: max8998_charger: Correct ONLINE and add STATUS propsJonathan Bakker2020-06-191-3/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | The ONLINE prop should be when the charger is present (ie able to charge), however, it was for when it was actually charging or not. Instead, add the STATUS prop to show whether charging is actually going on or not. The magic numbers have been ported from a downstream kernel for the SGH-T959V. Signed-off-by: Jonathan Bakker <xc-racer2@live.ca> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: bq24190_charger: Fix runtime PM imbalance on errorDinghao Liu2020-06-191-1/+3
| | | | | | | | | | | | | | | | | | | | pm_runtime_get_sync() increments the runtime PM usage counter even it returns an error code. Thus a pairing decrement is needed on the error handling path to keep the counter balanced. Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn> Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: sbs-battery: add PEC supportSebastian Reichel2020-06-191-3/+61
| | | | | | | | | | | | | | | | | | | | | | SBS batteries optionally have support for PEC. This enables PEC handling based on the implemented SBS version as suggested by the standard. The support for PEC is re-evaluated when the battery is hotplugged into the system, since there might be systems supporting batteries from different SBS generations. Tested-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: sbs-battery: use i2c_smbus_read_block_data()Sebastian Reichel2020-06-191-2/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The SBS battery implements SMBus block reads. Currently the driver "emulates" this by doing an I2C byte read for the length followed by an I2C block read. The I2C subsystem actually provides a proper API for doing SMBus block reads, which can and should be used instead. The current implementation does not properly handle packet error checking (PEC). Not all upstream systems using sbs-battery have I2C bus drivers supporting I2C_M_RECV_LEN, so old implementation is kept as fallback to keep things working. But this prints a warning, which hopefully results in people implementing support for it. Tested-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: gpio-charger: Make gpios optionalSebastian Reichel2020-06-191-13/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While strongly recommended, not all devices have a gpio to detect if the charger is connected. This moves the 'gpios' from required to optional section. This also modifies error handling for the GPIO a bit: We no longer fallback to pdata, if a GPIO is specified using GPIO descriptor tables. This is a bit cleaner and does not have any real impact: There are only two mainline pdata users (arm/mach-sa1100/collie.c, arm/mach-pxa/tosa.c) and none of them specify the GPIO via gpiod descriptor tables. Once both have been converted the driver's support for specifying GPIOs numbers in pdata will be dropped. Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: axp20x_usb_power: fix spelling mistakeKeyur Patel2020-06-191-1/+1
| | | | | | | | | | | | | | | | Fix typo: "triger" --> "trigger" Signed-off-by: Keyur Patel <iamkeyur96@gmail.com> Acked-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: use kobj_to_devWang Qing2020-06-191-1/+1
| | | | | | | | | | | | | | Use kobj_to_dev() API instead of open-coded container_of(). Signed-off-by: Wang Qing <wangqing@vivo.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | thermal: Explicitly enable non-changing thermal zone devicesAndrzej Pietrasiewicz2020-06-291-2/+7
|/ | | | | | | | | | Some thermal zone devices never change their state, so they should be always enabled. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20200629122925.21729-9-andrzej.p@collabora.com
* Merge tag 'for-v5.8' of ↵Linus Torvalds2020-06-1033-522/+4098
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply Pull power supply and reset updates from Sebastian Reichel: "This time there are lots of changes. Quite a few changes to the core, lots of driver changes and one change to kobject core (with Ack from Greg). Summary: kobject: - Increase number of allowed uevent variables power-supply core: - Add power-supply type in uevent - Cleanup property handling in core - Make property and usb_type pointers const - Convert core power-supply DT binding to YAML - Cleanup HWMON code - Add new health status "calibration required" - Add new properties for manufacture date and capacity error margin battery drivers: - new cw2015 battery driver used by pine64 Pinebook Pro laptop - axp22: blacklist on Meegopad T02 - sc27xx: support current/voltage reading - max17042: support time-to-empty reading - simple-battery: add more battery parameters - bq27xxx: convert DT binding document to YAML - sbs-battery: add TI BQ20Z65 support, fix technology property, convert DT binding to YAML, add option to disable charger broadcasts, add new properties: manufacture date, capacity error margin, average current, charge current and voltage and support calibration required health status - misc fixes charger drivers: - bq25890: cleanup, implement charge type, precharge current and input current limiting properties - bd70528: use new linear range helper library - bd99954: new charger driver - mp2629: new charger driver - misc fixes reboot drivers: - oxnas-restart: introduce new driver - syscon-reboot: convert DT binding to YAML, add parent syscon device support - misc fixes" * tag 'for-v5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (85 commits) power: supply: cw2015: Attach OF ID table to the driver power: reset: gpio-poweroff: add missing '\n' in dev_err() Revert "power: supply: sbs-battery: simplify read_read_string_data" Revert "power: supply: sbs-battery: add PEC support" dt-bindings: power: sbs-battery: Convert to yaml power: supply: sbs-battery: constify power-supply property array power: supply: sbs-battery: switch to i2c's probe_new power: supply: sbs-battery: switch from of_property_* to device_property_* power: supply: sbs-battery: add ability to disable charger broadcasts power: supply: sbs-battery: fix idle battery status power: supply: sbs-battery: add POWER_SUPPLY_HEALTH_CALIBRATION_REQUIRED support power: supply: sbs-battery: add MANUFACTURE_DATE support power: supply: sbs-battery: add POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT/VOLTAGE_MAX support power: supply: sbs-battery: Improve POWER_SUPPLY_PROP_TECHNOLOGY support power: supply: sbs-battery: add POWER_SUPPLY_PROP_CURRENT_AVG support power: supply: sbs-battery: add PEC support power: supply: sbs-battery: simplify read_read_string_data power: supply: sbs-battery: add POWER_SUPPLY_PROP_CAPACITY_ERROR_MARGIN support power: supply: sbs-battery: Add TI BQ20Z65 support power: supply: core: add POWER_SUPPLY_HEALTH_CALIBRATION_REQUIRED ...
| * power: supply: cw2015: Attach OF ID table to the driverAndy Shevchenko2020-06-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | It appears that OF ID table was hanging around without being attached to the driver. Attach it properly. Fixes: b4c7715c10c1 ("power: supply: add CellWise cw2015 fuel gauge driver") Reported-by: kbuild test robot <lkp@intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-By: Tobias Schramm <t.schramm@manjaro.org> Tested-By: Tobias Schramm <t.schramm@manjaro.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: reset: gpio-poweroff: add missing '\n' in dev_err()Luca Ceresoli2020-06-061-1/+1
| | | | | | | | | | | | | | dev_err() needs a terminating newline. Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * Revert "power: supply: sbs-battery: simplify read_read_string_data"Sebastian Reichel2020-06-021-12/+53
| | | | | | | | | | | | | | | | | | | | | | | | The commit is a nice cleanup, but breaks booting on exynos5 based chromebooks. It's seems to come down to exynos5's i2c driver not implementing I2C_FUNC_SMBUS_READ_BLOCK_DATA. It's not yet clear why that breaks boot / massively slows it down when userspace starts, so revert the problematic patch. This reverts commit c4b12a2f3f3de670f6be5e96092a2cab0b877f1a. Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * Revert "power: supply: sbs-battery: add PEC support"Sebastian Reichel2020-06-021-51/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This depends on the simplification of sbs_read_string_data, which breaks booting exynos5 based chromebooks. More investigation is required, so this patch and the simplification patch are reverted for this merge window. Note, that this is only a partial revert, since sbs_update_presence() has not been removed. It is also required for the charger broadcast disabling. This reverts commit 79bcd5a4a66076a8a8dacd7f4a3be1952283aef4. Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: sbs-battery: constify power-supply property arraySebastian Reichel2020-05-291-1/+1
| | | | | | | | Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: sbs-battery: switch to i2c's probe_newSebastian Reichel2020-05-291-3/+2
| | | | | | | | | | | | | | sbs-battery does not use the ID parameter, so switch to i2c's probe_new API. Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: sbs-battery: switch from of_property_* to device_property_*Sebastian Reichel2020-05-291-7/+7
| | | | | | | | | | | | | | Switch from DT specific of_property_* API to generic and more modern device_property_* API. Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: sbs-battery: add ability to disable charger broadcastsJean-Francois Dagenais2020-05-291-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In certain designs, it is possible to add a battery on a populated i2c bus without an sbs compliant charger. In that case, the battery will unnecessarily and sometimes undesirably master the bus trying to write info in the charger. It is observed in many occasion that these battery "broadcasts" are even corrupting other ongoing master to slave communication. I.e. the multi-master support in the battery is inadequate. Thankfully, the CHARGER_MODE bit allows designers to disable that SBS battery behaviour. This needs to be done once when the battery is first seen on the bus. Signed-off-by: Jean-Francois Dagenais <jeff.dagenais@gmail.com> [rebased code] Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: sbs-battery: fix idle battery statusSebastian Reichel2020-05-291-3/+3
| | | | | | | | | | | | | | | | A battery, that is neither charged, nor discharged is not always Full. If the charger is disabled for other reasons it might simply be idle and should be marked accordingly. Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: sbs-battery: add POWER_SUPPLY_HEALTH_CALIBRATION_REQUIRED supportSebastian Reichel2020-05-291-3/+24
| | | | | | | | | | | | | | | | Add support for reporting the SBS battery's condition flag to userspace using the new "Calibration required" health status. Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: sbs-battery: add MANUFACTURE_DATE supportSebastian Reichel2020-05-291-0/+43
| | | | | | | | | | | | | | Expose the battery's manufacture date to userspace. Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: sbs-battery: add ↵Sebastian Reichel2020-05-291-0/+12
| | | | | | | | | | | | | | | | | | | | POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT/VOLTAGE_MAX support Expose maximum charge current/voltage information requested by the battery. Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: sbs-battery: Improve POWER_SUPPLY_PROP_TECHNOLOGY supportSebastian Reichel2020-05-291-2/+41
| | | | | | | | | | | | | | | | This reads the battery chemistry from the battery chip instead of incorrectly hardcoding the type to be Li-Ion. Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: sbs-battery: add POWER_SUPPLY_PROP_CURRENT_AVG supportSebastian Reichel2020-05-291-3/+9
| | | | | | | | | | | | | | | | Expose averaged current information, which is part of the SBS standard and should be supported by all batteries. Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: sbs-battery: add PEC supportSebastian Reichel2020-05-291-3/+69
| | | | | | | | | | | | | | | | | | | | | | SBS batteries optionally have support for PEC. This enables PEC handling based on the implemented SBS version as suggested by the standard. The support for PEC is re-evaluated when the battery is hotplugged into the system, since there might be systems supporting batteries from different SBS generations. Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: sbs-battery: simplify read_read_string_dataSebastian Reichel2020-05-291-53/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The SBS battery implements SMBus block reads. Currently the driver "emulates" this by doing an I2C byte read for the length followed by an I2C block read. The I2C subsystem actually provides a proper API for doing SMBus block reads, which can and should be used instead. The current implementation does not properly handle packet error checking (PEC). This change requires, that I2C bus drivers support I2C_M_RECV_LEN or directly provide the SMBus API to access device manufacturer and model name. Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: sbs-battery: add POWER_SUPPLY_PROP_CAPACITY_ERROR_MARGIN supportSebastian Reichel2020-05-291-0/+5
| | | | | | | | | | | | | | | | Add support for reporting the MaxError register from battery fuel gauges following the smart battery standard. Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: sbs-battery: Add TI BQ20Z65 supportSebastian Reichel2020-05-281-5/+10
| | | | | | | | | | | | | | | | | | | | | | Add support for BQ20Z65 manufacturer data to the sbs-battery driver. Implementation has been verified using the public TRM available from [0] and tested using a GE Flex 3S2P battery. [0] http://www.ti.com/lit/pdf/sluu386 Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: core: add POWER_SUPPLY_HEALTH_CALIBRATION_REQUIREDSebastian Reichel2020-05-281-0/+1
| | | | | | | | | | | | | | | | Some battery fuel gauges know when the battery needs to be recalibrated before providing usable values. This should be reported via the health property. Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: core: add manufacture date propertiesSebastian Reichel2020-05-281-0/+3
| | | | | | | | | | | | | | | | Some smart batteries store their manufacture date, which is useful to identify the battery and/or to know about the cell quality. Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: core: add capacity error margin propertySebastian Reichel2020-05-281-0/+1
| | | | | | | | | | | | | | Add a property for reporting the error margin expected by fuel gauge chips. Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: Make bd9995x_chip_reset staticSamuel Zou2020-05-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix the following sparse warning: drivers/power/supply/bd99954-charger.c:1028:6: warning: symbol 'bd9995x_chip_reset' was not declared. The bd9995x_chip_reset() has only one call site within bd99954-charger.c It should be static Fixes: 0902f8366491 ("power: supply: Support ROHM bd99954 charger") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Samuel Zou <zou_wei@huawei.com> Reviewed-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: charger: max14577: Add proper dt-compatible stringsMarek Szyprowski2020-05-281-0/+10
| | | | | | | | | | | | | | | | | | Add device tree compatible strings and create proper modalias structures to let this driver load automatically if compiled as module, because max14577 MFD driver creates MFD cells with such compatible strings. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * Merge tag 'tags/ib-mfd-iio-power-v5.8' into psy-nextSebastian Reichel2020-05-283-0/+680
| |\ | | | | | | | | | | | | | | | | | | | | | This merges the MP2629 battery charge management immutable branch between MFD, IIO and power-supply due for the v5.8 merge window into power-supply for-next branch. Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>