forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag 'for-v5.3' of git://git.kernel.org/pub/scm/linux/kernel/git…
…/sre/linux-power-supply Pull power supply and reset updates from Sebastian Reichel: "Core: - add HWMON compat layer - new properties: - input power limit - input voltage limit Drivers: - qcom-pon: add gen2 support - new driver for storing reboot move in NVMEM - new driver for Wilco EC charger configuration - simplify getting the adapter of a client" * tag 'for-v5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: power: reset: nvmem-reboot-mode: add CONFIG_OF dependency power_supply: wilco_ec: Add charging config driver power: supply: cros: allow to set input voltage and current limit power: supply: add input power and voltage limit properties power: supply: fix semicolon.cocci warnings power: reset: nvmem-reboot-mode: use NVMEM as reboot mode write interface dt-bindings: power: reset: add document for NVMEM based reboot-mode reset: qcom-pon: Add support for gen2 pon dt-bindings: power: reset: qcom: Add qcom,pm8998-pon compatibility line power: supply: Add HWMON compatibility layer power: supply: sbs-manager: simplify getting the adapter of a client power: supply: rt9455_charger: simplify getting the adapter of a client power: supply: rt5033_battery: simplify getting the adapter of a client power: supply: max17042_battery: simplify getting the adapter of a client power: supply: max17040_battery: simplify getting the adapter of a client power: supply: max14656_charger_detector: simplify getting the adapter of a client power: supply: bq25890_charger: simplify getting the adapter of a client power: supply: bq24257_charger: simplify getting the adapter of a client power: supply: bq24190_charger: simplify getting the adapter of a client
- Loading branch information
Showing
27 changed files
with
908 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -376,10 +376,42 @@ Description: | |
supply. Normally this is configured based on the type of | ||
connection made (e.g. A configured SDP should output a maximum | ||
of 500mA so the input current limit is set to the same value). | ||
Use preferably input_power_limit, and for problems that can be | ||
solved using power limit use input_current_limit. | ||
|
||
Access: Read, Write | ||
Valid values: Represented in microamps | ||
|
||
What: /sys/class/power_supply/<supply_name>/input_voltage_limit | ||
Date: May 2019 | ||
Contact: [email protected] | ||
Description: | ||
This entry configures the incoming VBUS voltage limit currently | ||
set in the supply. Normally this is configured based on | ||
system-level knowledge or user input (e.g. This is part of the | ||
Pixel C's thermal management strategy to effectively limit the | ||
input power to 5V when the screen is on to meet Google's skin | ||
temperature targets). Note that this feature should not be | ||
used for safety critical things. | ||
Use preferably input_power_limit, and for problems that can be | ||
solved using power limit use input_voltage_limit. | ||
|
||
Access: Read, Write | ||
Valid values: Represented in microvolts | ||
|
||
What: /sys/class/power_supply/<supply_name>/input_power_limit | ||
Date: May 2019 | ||
Contact: [email protected] | ||
Description: | ||
This entry configures the incoming power limit currently set | ||
in the supply. Normally this is configured based on | ||
system-level knowledge or user input. Use preferably this | ||
feature to limit the incoming power and use current/voltage | ||
limit only for problems that can be solved using power limit. | ||
|
||
Access: Read, Write | ||
Valid values: Represented in microwatts | ||
|
||
What: /sys/class/power_supply/<supply_name>/online, | ||
Date: May 2007 | ||
Contact: [email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
What: /sys/class/power_supply/wilco-charger/charge_type | ||
Date: April 2019 | ||
KernelVersion: 5.2 | ||
Description: | ||
What charging algorithm to use: | ||
|
||
Standard: Fully charges battery at a standard rate. | ||
Adaptive: Battery settings adaptively optimized based on | ||
typical battery usage pattern. | ||
Fast: Battery charges over a shorter period. | ||
Trickle: Extends battery lifespan, intended for users who | ||
primarily use their Chromebook while connected to AC. | ||
Custom: A low and high threshold percentage is specified. | ||
Charging begins when level drops below | ||
charge_control_start_threshold, and ceases when | ||
level is above charge_control_end_threshold. | ||
|
||
What: /sys/class/power_supply/wilco-charger/charge_control_start_threshold | ||
Date: April 2019 | ||
KernelVersion: 5.2 | ||
Description: | ||
Used when charge_type="Custom", as described above. Measured in | ||
percentages. The valid range is [50, 95]. | ||
|
||
What: /sys/class/power_supply/wilco-charger/charge_control_end_threshold | ||
Date: April 2019 | ||
KernelVersion: 5.2 | ||
Description: | ||
Used when charge_type="Custom", as described above. Measured in | ||
percentages. The valid range is [55, 100]. |
26 changes: 26 additions & 0 deletions
26
Documentation/devicetree/bindings/power/reset/nvmem-reboot-mode.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
NVMEM reboot mode driver | ||
|
||
This driver gets reboot mode magic value from reboot-mode driver | ||
and stores it in a NVMEM cell named "reboot-mode". Then the bootloader | ||
can read it and take different action according to the magic | ||
value stored. | ||
|
||
Required properties: | ||
- compatible: should be "nvmem-reboot-mode". | ||
- nvmem-cells: A phandle to the reboot mode provided by a nvmem device. | ||
- nvmem-cell-names: Should be "reboot-mode". | ||
|
||
The rest of the properties should follow the generic reboot-mode description | ||
found in reboot-mode.txt | ||
|
||
Example: | ||
reboot-mode { | ||
compatible = "nvmem-reboot-mode"; | ||
nvmem-cells = <&reboot_mode>; | ||
nvmem-cell-names = "reboot-mode"; | ||
|
||
mode-normal = <0xAAAA5501>; | ||
mode-bootloader = <0xBBBB5500>; | ||
mode-recovery = <0xCCCC5502>; | ||
mode-test = <0xDDDD5503>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// SPDX-License-Identifier: GPL-2.0+ | ||
/* | ||
* Copyright (c) Vaisala Oyj. All rights reserved. | ||
*/ | ||
|
||
#include <linux/init.h> | ||
#include <linux/module.h> | ||
#include <linux/kernel.h> | ||
#include <linux/of.h> | ||
#include <linux/nvmem-consumer.h> | ||
#include <linux/platform_device.h> | ||
#include <linux/reboot-mode.h> | ||
|
||
struct nvmem_reboot_mode { | ||
struct reboot_mode_driver reboot; | ||
struct nvmem_cell *cell; | ||
}; | ||
|
||
static int nvmem_reboot_mode_write(struct reboot_mode_driver *reboot, | ||
unsigned int magic) | ||
{ | ||
int ret; | ||
struct nvmem_reboot_mode *nvmem_rbm; | ||
|
||
nvmem_rbm = container_of(reboot, struct nvmem_reboot_mode, reboot); | ||
|
||
ret = nvmem_cell_write(nvmem_rbm->cell, &magic, sizeof(magic)); | ||
if (ret < 0) | ||
dev_err(reboot->dev, "update reboot mode bits failed\n"); | ||
|
||
return ret; | ||
} | ||
|
||
static int nvmem_reboot_mode_probe(struct platform_device *pdev) | ||
{ | ||
int ret; | ||
struct nvmem_reboot_mode *nvmem_rbm; | ||
|
||
nvmem_rbm = devm_kzalloc(&pdev->dev, sizeof(*nvmem_rbm), GFP_KERNEL); | ||
if (!nvmem_rbm) | ||
return -ENOMEM; | ||
|
||
nvmem_rbm->reboot.dev = &pdev->dev; | ||
nvmem_rbm->reboot.write = nvmem_reboot_mode_write; | ||
|
||
nvmem_rbm->cell = devm_nvmem_cell_get(&pdev->dev, "reboot-mode"); | ||
if (IS_ERR(nvmem_rbm->cell)) { | ||
dev_err(&pdev->dev, "failed to get the nvmem cell reboot-mode\n"); | ||
return PTR_ERR(nvmem_rbm->cell); | ||
} | ||
|
||
ret = devm_reboot_mode_register(&pdev->dev, &nvmem_rbm->reboot); | ||
if (ret) | ||
dev_err(&pdev->dev, "can't register reboot mode\n"); | ||
|
||
return ret; | ||
} | ||
|
||
static const struct of_device_id nvmem_reboot_mode_of_match[] = { | ||
{ .compatible = "nvmem-reboot-mode" }, | ||
{} | ||
}; | ||
MODULE_DEVICE_TABLE(of, nvmem_reboot_mode_of_match); | ||
|
||
static struct platform_driver nvmem_reboot_mode_driver = { | ||
.probe = nvmem_reboot_mode_probe, | ||
.driver = { | ||
.name = "nvmem-reboot-mode", | ||
.of_match_table = nvmem_reboot_mode_of_match, | ||
}, | ||
}; | ||
module_platform_driver(nvmem_reboot_mode_driver); | ||
|
||
MODULE_AUTHOR("Nandor Han <[email protected]>"); | ||
MODULE_DESCRIPTION("NVMEM reboot mode driver"); | ||
MODULE_LICENSE("GPL"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.