summaryrefslogtreecommitdiffstats
path: root/drivers/power
Commit message (Collapse)AuthorAgeFilesLines
* Merge tag 'char-misc-5.10-rc1' of ↵Linus Torvalds2020-10-153-3/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc Pull char/misc driver updates from Greg KH: "Here is the big set of char, misc, and other assorted driver subsystem patches for 5.10-rc1. There's a lot of different things in here, all over the drivers/ directory. Some summaries: - soundwire driver updates - habanalabs driver updates - extcon driver updates - nitro_enclaves new driver - fsl-mc driver and core updates - mhi core and bus updates - nvmem driver updates - eeprom driver updates - binder driver updates and fixes - vbox minor bugfixes - fsi driver updates - w1 driver updates - coresight driver updates - interconnect driver updates - misc driver updates - other minor driver updates All of these have been in linux-next for a while with no reported issues" * tag 'char-misc-5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (396 commits) binder: fix UAF when releasing todo list docs: w1: w1_therm: Fix broken xref, mistakes, clarify text misc: Kconfig: fix a HISI_HIKEY_USB dependency LSM: Fix type of id parameter in kernel_post_load_data prototype misc: Kconfig: add a new dependency for HISI_HIKEY_USB firmware_loader: fix a kernel-doc markup w1: w1_therm: make w1_poll_completion static binder: simplify the return expression of binder_mmap test_firmware: Test partial read support firmware: Add request_partial_firmware_into_buf() firmware: Store opt_flags in fw_priv fs/kernel_file_read: Add "offset" arg for partial reads IMA: Add support for file reads without contents LSM: Add "contents" flag to kernel_read_file hook module: Call security_kernel_post_load_data() firmware_loader: Use security_post_load_data() LSM: Introduce kernel_post_load_data() hook fs/kernel_read_file: Add file_size output argument fs/kernel_read_file: Switch buffer size arg to size_t fs/kernel_read_file: Remove redundant size argument ...
| * power: supply: Constify static w1_family_ops structsRikard Falkeborn2020-10-053-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The only usage of these structs is to assign their address to the fops field in the w1_family struct, which is a const pointer. Make them const to allow the compiler to put them in read-only memory. This was done with the following Coccinelle semantic patch (http://coccinelle.lip6.fr/): // <smpl> @r1 disable optional_qualifier @ identifier i; position p; @@ static struct w1_family_ops i@p = {...}; @ok1@ identifier r1.i; position p; identifier s; @@ static struct w1_family s = { .fops=&i@p, }; @bad1@ position p!={r1.p,ok1.p}; identifier r1.i; @@ i@p @depends on !bad1 disable optional_qualifier@ identifier r1.i; @@ static +const struct w1_family_ops i={}; // </smpl> Acked-by: Sebastian Reichel <sre@kernel.org> Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> Link: https://lore.kernel.org/r/20201004193202.4044-4-rikard.falkeborn@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | Merge tag 'pm-5.10-rc1' of ↵Linus Torvalds2020-10-141-7/+1
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm Pull power management updates from Rafael Wysocki: "These rework the collection of cpufreq statistics to allow it to take place if fast frequency switching is enabled in the governor, rework the frequency invariance handling in the cpufreq core and drivers, add new hardware support to a couple of cpufreq drivers, fix a number of assorted issues and clean up the code all over. Specifics: - Rework cpufreq statistics collection to allow it to take place when fast frequency switching is enabled in the governor (Viresh Kumar). - Make the cpufreq core set the frequency scale on behalf of the driver and update several cpufreq drivers accordingly (Ionela Voinescu, Valentin Schneider). - Add new hardware support to the STI and qcom cpufreq drivers and improve them (Alain Volmat, Manivannan Sadhasivam). - Fix multiple assorted issues in cpufreq drivers (Jon Hunter, Krzysztof Kozlowski, Matthias Kaehlcke, Pali Rohár, Stephan Gerhold, Viresh Kumar). - Fix several assorted issues in the operating performance points (OPP) framework (Stephan Gerhold, Viresh Kumar). - Allow devfreq drivers to fetch devfreq instances by DT enumeration instead of using explicit phandles and modify the devfreq core code to support driver-specific devfreq DT bindings (Leonard Crestez, Chanwoo Choi). - Improve initial hardware resetting in the tegra30 devfreq driver and clean up the tegra cpuidle driver (Dmitry Osipenko). - Update the cpuidle core to collect state entry rejection statistics and expose them via sysfs (Lina Iyer). - Improve the ACPI _CST code handling diagnostics (Chen Yu). - Update the PSCI cpuidle driver to allow the PM domain initialization to occur in the OSI mode as well as in the PC mode (Ulf Hansson). - Rework the generic power domains (genpd) core code to allow domain power off transition to be aborted in the absence of the "power off" domain callback (Ulf Hansson). - Fix two suspend-to-idle issues in the ACPI EC driver (Rafael Wysocki). - Fix the handling of timer_expires in the PM-runtime framework on 32-bit systems and the handling of device links in it (Grygorii Strashko, Xiang Chen). - Add IO requests batching support to the hibernate image saving and reading code and drop a bogus get_gendisk() from there (Xiaoyi Chen, Christoph Hellwig). - Allow PCIe ports to be put into the D3cold power state if they are power-manageable via ACPI (Lukas Wunner). - Add missing header file include to a power capping driver (Pujin Shi). - Clean up the qcom-cpr AVS driver a bit (Liu Shixin). - Kevin Hilman steps down as designated reviwer of adaptive voltage scaling (AVS) drivers (Kevin Hilman)" * tag 'pm-5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (65 commits) cpufreq: stats: Fix string format specifier mismatch arm: disable frequency invariance for CONFIG_BL_SWITCHER cpufreq,arm,arm64: restructure definitions of arch_set_freq_scale() cpufreq: stats: Add memory barrier to store_reset() cpufreq: schedutil: Simplify sugov_fast_switch() ACPI: EC: PM: Drop ec_no_wakeup check from acpi_ec_dispatch_gpe() ACPI: EC: PM: Flush EC work unconditionally after wakeup PCI/ACPI: Whitelist hotplug ports for D3 if power managed by ACPI PM: hibernate: remove the bogus call to get_gendisk() in software_resume() cpufreq: Move traces and update to policy->cur to cpufreq core cpufreq: stats: Enable stats for fast-switch as well cpufreq: stats: Mark few conditionals with unlikely() cpufreq: stats: Remove locking cpufreq: stats: Defer stats update to cpufreq_stats_record_transition() PM: domains: Allow to abort power off when no ->power_off() callback PM: domains: Rename power state enums for genpd PM / devfreq: tegra30: Improve initial hardware resetting PM / devfreq: event: Change prototype of devfreq_event_get_edev_by_phandle function PM / devfreq: Change prototype of devfreq_get_devfreq_by_phandle function PM / devfreq: Add devfreq_get_devfreq_by_node function ...
| * | PM: AVS: qcom-cpr: simplify the return expression of cpr_disable()Liu Shixin2020-09-221-7/+1
| |/ | | | | | | | | | | | | | | | | | | Simplify the return expression. Signed-off-by: Liu Shixin <liushixin2@huawei.com> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Acked-by: Kevin Hilman <khilman@baylibre.com> [ rjw: Minor subject edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* | Merge tag 'for-v5.9-rc' of ↵Linus Torvalds2020-10-091-0/+6
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply Pull power supply fix from Sebastian Reichel: "Just a single change to revert enablement of packet error checking for battery data on Chromebooks, since some of their embedded controllers do not handle it correctly" * tag 'for-v5.9-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: power: supply: sbs-battery: chromebook workaround for PEC
| * power: supply: sbs-battery: chromebook workaround for PECSebastian Reichel2020-10-091-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Looks like the I2C tunnel implementation from Chromebook's embedded controller does not handle PEC correctly. Fix this by disabling PEC for batteries behind those I2C tunnels as a workaround. Note, that some Chromebooks actually have been reported to have working PEC support (with I2C tunnel). Since the problem has not yet been fully understood this simply reverts all Chromebooks to not use PEC for now. Reported-by: "Milan P. Stanić" <mps@arvanta.net> Reported-by: Vicente Bergas <vicencb@gmail.com> CC: Enric Balletbo i Serra <enric.balletbo@collabora.com> Fixes: 7222bd603dd2 ("power: supply: sbs-battery: add PEC support") Tested-by: Vicente Bergas <vicencb@gmail.com> Tested-by: "Milan P. Stanić" <mps@arvanta.net> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | treewide: Use fallthrough pseudo-keywordGustavo A. R. Silva2020-08-238-22/+22
|/ | | | | | | | | | Replace the existing /* fall through */ comments and its variants with the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary fall-through markings when it is the case. [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
* Merge tag 'for-v5.9' of ↵Linus Torvalds2020-08-0727-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>