* [PATCH v6 0/6] Introduce MAX77759 charger driver
@ 2026-02-14 3:12 Amit Sunil Dhamne via B4 Relay
2026-02-14 3:12 ` [PATCH v6 1/6] dt-bindings: mfd: maxim,max77759: reference power-supply schema and add regulator property Amit Sunil Dhamne via B4 Relay
` (5 more replies)
0 siblings, 6 replies; 15+ messages in thread
From: Amit Sunil Dhamne via B4 Relay @ 2026-02-14 3:12 UTC (permalink / raw)
To: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
André Draszik, Lee Jones, Greg Kroah-Hartman,
Badhri Jagan Sridharan, Heikki Krogerus, Peter Griffin,
Tudor Ambarus, Alim Akhtar, Mark Brown, Matti Vaittinen,
Andrew Morton
Cc: linux-kernel, linux-pm, devicetree, linux-usb, linux-arm-kernel,
linux-samsung-soc, RD Babiera, Kyle Tso, Amit Sunil Dhamne,
Krzysztof Kozlowski
MAX77759 PMIC is used in Pixel 6 and 6 Pro (Oriole/Raven) boards.
One of the functions of the MAX77759 PMIC is a battery charger. This
patchset introduces a driver for this function. One of the unique
features of this charger driver is that it works with a USB input where
the Type-C controller is TCPCI based.
Changes to the board files will follow soon once this patchset is reviewed.
For reference to the MAX77759 MFD based patchset (present in upstream):
https://lore.kernel.org/all/20250509-max77759-mfd-v10-0-962ac15ee3ef@linaro.org/
Dependency list for patches (directionality indicates depends on):
[6] -> [5] -> [4] & [3]
Signed-off-by: Amit Sunil Dhamne <amitsd@google.com>
---
Changes in v6:
- Linear Range usage (André Draszik):
- Dedicate individual arrays for inlim, chgcc & chg_cv_prm to simplify
code.
- Use numerical values instead of macros for linear_range array init.
- Remove macros defining current and voltage limits due to above.
- Didn't use Reviewed-by tag for Patch 3 due to the above.
- Add new linear_ranges api to leverage it for obtaining selector
values.
- Improve voltage and current getters and setters functions by leveraging
existing and new linear_ranges API.
- IRQ related changes (André Draszik)
- Dedicated names for individual irqs.
- Refactor irq handlers.
- Ratelimit prints
- Retry mechanism (André Draszik):
- Initialize error retry counter to 0 when psy work is scheduled on a
new notifier event.
- Protect the counter using a lock.
- Add appropriate prints.
- Link to v5: https://lore.kernel.org/r/20260203-max77759-charger-v5-0-b50395376a5f@google.com
Changes in v5:
- Use linear_range library instead of reinventing it. (André Draszik)
- This requires a selector_max value so modified mfd/max77759.h to
include it for CHGCC and CHG_ILIM.
- Removed "reviewed-by" for Patch 3 (mfd) due to above
- Use asnyc probe type. (André Draszik)
- Retry mechanism for psy_work. (André Draszik)
- Minor nits (André Draszik):
- Use named initializers for instantiating structs.
- Use static qualifier for `psy_name` variable.
- Refactor if-else ladder to remove else handling if return in prior
"if" loop.
- Remove redundant `unlikely`.
- Link to v4: https://lore.kernel.org/r/20260121-max77759-charger-v4-0-694234c8ded1@google.com
Changes in v4:
- Removed a stray tabspace in mfd/max77759.h. (André Draszik)
- Fixed the following issues in Patch 4/5 (André Draszik):
- Re-order Kconfig entry
- Refactored to not use global variable
- Use of clamp() to clamp values instead of duplicating logic
- Return IRQ_NONE for unhandled irqs or error conditions
- Remove debug messages in irq handler
- Refactor code to use dev_err_probe in *_init_irqhandler()
- Remove unneeded irq_flags
- Check return values of regmap ops
- Other nits like newlines, not using greedy init, using print stmnts
- Link to v3: https://lore.kernel.org/r/20251227-max77759-charger-v3-0-54e664f5ca92@google.com
Changes in v3:
- Had incorrectly folded the charger sub-device with the pmic parent.
Corrected it. (Krzysztof Kozlowski)
- Link to v2: https://lore.kernel.org/r/20251218-max77759-charger-v2-0-2b259980a686@google.com
Changes in v2:
- Fold charger binding in maxim,max77759-charger.yaml to its parent
node. (Krzysztof Kozlowski)
- Renamed regulator supplier & consumer. (Krzysztof Kozlowski & Heikki
Krogerus)
- Removed explicit setting of irq trigger types in max77759 driver.
(André Draszik & Krzysztof Kozlowski)
- Complete bit definitions for IRQ registers. (André Draszik)
- Consolidate all bit definitions for charger IP in mfd/max77759.h.
(André Draszik)
- Modify the handling of charger IRQs such that regmap IRQ chip handles
masking, de-mux and acking of interrupts. (André Draszik)
- Remove unused macro definitions relating to Charger modes in tcpci
maxim driver (André Draszik)
- Add dependency on Regulator class in Kconfig definition for max77759
chg. (Kernel Test Robot)
- Link to v1: https://lore.kernel.org/r/20251123-max77759-charger-v1-0-6b2e4b8f7f54@google.com
---
Amit Sunil Dhamne (6):
dt-bindings: mfd: maxim,max77759: reference power-supply schema and add regulator property
dt-bindings: usb: maxim,max33359: Add supply property for vbus
mfd: max77759: add register bitmasks and modify irq configs for charger
lib/linear_ranges: Add linear_range_get_selector_high_array
power: supply: max77759: add charger driver
usb: typec: tcpm/tcpci_maxim: deprecate WAR for setting charger mode
.../devicetree/bindings/mfd/maxim,max77759.yaml | 16 +-
.../devicetree/bindings/usb/maxim,max33359.yaml | 4 +
MAINTAINERS | 6 +
drivers/mfd/max77759.c | 91 ++-
drivers/power/supply/Kconfig | 11 +
drivers/power/supply/Makefile | 1 +
drivers/power/supply/max77759_charger.c | 768 +++++++++++++++++++++
drivers/usb/typec/tcpm/tcpci_maxim.h | 1 +
drivers/usb/typec/tcpm/tcpci_maxim_core.c | 54 +-
include/linux/linear_range.h | 3 +
include/linux/mfd/max77759.h | 176 ++++-
lib/linear_ranges.c | 36 +
12 files changed, 1108 insertions(+), 59 deletions(-)
---
base-commit: 8dfce8991b95d8625d0a1d2896e42f93b9d7f68d
change-id: 20251105-max77759-charger-852b626d661a
Best regards,
--
Amit Sunil Dhamne <amitsd@google.com>
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v6 1/6] dt-bindings: mfd: maxim,max77759: reference power-supply schema and add regulator property
2026-02-14 3:12 [PATCH v6 0/6] Introduce MAX77759 charger driver Amit Sunil Dhamne via B4 Relay
@ 2026-02-14 3:12 ` Amit Sunil Dhamne via B4 Relay
2026-02-14 3:12 ` [PATCH v6 2/6] dt-bindings: usb: maxim,max33359: Add supply property for vbus Amit Sunil Dhamne via B4 Relay
` (4 subsequent siblings)
5 siblings, 0 replies; 15+ messages in thread
From: Amit Sunil Dhamne via B4 Relay @ 2026-02-14 3:12 UTC (permalink / raw)
To: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
André Draszik, Lee Jones, Greg Kroah-Hartman,
Badhri Jagan Sridharan, Heikki Krogerus, Peter Griffin,
Tudor Ambarus, Alim Akhtar, Mark Brown, Matti Vaittinen,
Andrew Morton
Cc: linux-kernel, linux-pm, devicetree, linux-usb, linux-arm-kernel,
linux-samsung-soc, RD Babiera, Kyle Tso, Amit Sunil Dhamne,
Krzysztof Kozlowski
From: Amit Sunil Dhamne <amitsd@google.com>
Extend the max77759 binding to reference power-supply schema, so that
PMIC node can reference its supplier. Also, add regulator property to
control CHGIN (OTG) voltage.
Signed-off-by: Amit Sunil Dhamne <amitsd@google.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Reviewed-by: André Draszik <andre.draszik@linaro.org>
---
.../devicetree/bindings/mfd/maxim,max77759.yaml | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/mfd/maxim,max77759.yaml b/Documentation/devicetree/bindings/mfd/maxim,max77759.yaml
index 525de9ab3c2b..42e4a84d5204 100644
--- a/Documentation/devicetree/bindings/mfd/maxim,max77759.yaml
+++ b/Documentation/devicetree/bindings/mfd/maxim,max77759.yaml
@@ -16,6 +16,9 @@ description: |
The MAX77759 includes Battery Charger, Fuel Gauge, temperature sensors, USB
Type-C Port Controller (TCPC), NVMEM, and a GPIO expander.
+allOf:
+ - $ref: /schemas/power/supply/power-supply.yaml#
+
properties:
compatible:
const: maxim,max77759
@@ -37,12 +40,18 @@ properties:
nvmem-0:
$ref: /schemas/nvmem/maxim,max77759-nvmem.yaml
+ chgin-otg-regulator:
+ type: object
+ description: Provides Boost for sourcing VBUS.
+ $ref: /schemas/regulator/regulator.yaml#
+ unevaluatedProperties: false
+
required:
- compatible
- interrupts
- reg
-additionalProperties: false
+unevaluatedProperties: false
examples:
- |
@@ -59,6 +68,11 @@ examples:
interrupt-controller;
#interrupt-cells = <2>;
+ power-supplies = <&maxtcpci>;
+
+ chgin-otg-regulator {
+ regulator-name = "chgin-otg";
+ };
gpio {
compatible = "maxim,max77759-gpio";
--
2.53.0.273.g2a3d683680-goog
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v6 2/6] dt-bindings: usb: maxim,max33359: Add supply property for vbus
2026-02-14 3:12 [PATCH v6 0/6] Introduce MAX77759 charger driver Amit Sunil Dhamne via B4 Relay
2026-02-14 3:12 ` [PATCH v6 1/6] dt-bindings: mfd: maxim,max77759: reference power-supply schema and add regulator property Amit Sunil Dhamne via B4 Relay
@ 2026-02-14 3:12 ` Amit Sunil Dhamne via B4 Relay
2026-02-14 3:12 ` [PATCH v6 3/6] mfd: max77759: add register bitmasks and modify irq configs for charger Amit Sunil Dhamne via B4 Relay
` (3 subsequent siblings)
5 siblings, 0 replies; 15+ messages in thread
From: Amit Sunil Dhamne via B4 Relay @ 2026-02-14 3:12 UTC (permalink / raw)
To: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
André Draszik, Lee Jones, Greg Kroah-Hartman,
Badhri Jagan Sridharan, Heikki Krogerus, Peter Griffin,
Tudor Ambarus, Alim Akhtar, Mark Brown, Matti Vaittinen,
Andrew Morton
Cc: linux-kernel, linux-pm, devicetree, linux-usb, linux-arm-kernel,
linux-samsung-soc, RD Babiera, Kyle Tso, Amit Sunil Dhamne,
Krzysztof Kozlowski
From: Amit Sunil Dhamne <amitsd@google.com>
Add a regulator supply property for vbus. This notifies the regulator
provider to source vbus when Type-C operates in Source power mode,
while turn off sourcing vbus when operating in Sink mode or
disconnected.
Signed-off-by: Amit Sunil Dhamne <amitsd@google.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
Documentation/devicetree/bindings/usb/maxim,max33359.yaml | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/Documentation/devicetree/bindings/usb/maxim,max33359.yaml b/Documentation/devicetree/bindings/usb/maxim,max33359.yaml
index 3de4dc40b791..e652a24902ea 100644
--- a/Documentation/devicetree/bindings/usb/maxim,max33359.yaml
+++ b/Documentation/devicetree/bindings/usb/maxim,max33359.yaml
@@ -32,6 +32,9 @@ properties:
description:
Properties for usb c connector.
+ vbus-supply:
+ description: Regulator to control sourcing Vbus.
+
required:
- compatible
- reg
@@ -53,6 +56,7 @@ examples:
reg = <0x25>;
interrupt-parent = <&gpa8>;
interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
+ vbus-supply = <&chgin_otg_reg>;
connector {
compatible = "usb-c-connector";
--
2.53.0.273.g2a3d683680-goog
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v6 3/6] mfd: max77759: add register bitmasks and modify irq configs for charger
2026-02-14 3:12 [PATCH v6 0/6] Introduce MAX77759 charger driver Amit Sunil Dhamne via B4 Relay
2026-02-14 3:12 ` [PATCH v6 1/6] dt-bindings: mfd: maxim,max77759: reference power-supply schema and add regulator property Amit Sunil Dhamne via B4 Relay
2026-02-14 3:12 ` [PATCH v6 2/6] dt-bindings: usb: maxim,max33359: Add supply property for vbus Amit Sunil Dhamne via B4 Relay
@ 2026-02-14 3:12 ` Amit Sunil Dhamne via B4 Relay
2026-02-17 12:30 ` André Draszik
2026-02-14 3:12 ` [PATCH v6 4/6] lib/linear_ranges: Add linear_range_get_selector_high_array Amit Sunil Dhamne via B4 Relay
` (2 subsequent siblings)
5 siblings, 1 reply; 15+ messages in thread
From: Amit Sunil Dhamne via B4 Relay @ 2026-02-14 3:12 UTC (permalink / raw)
To: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
André Draszik, Lee Jones, Greg Kroah-Hartman,
Badhri Jagan Sridharan, Heikki Krogerus, Peter Griffin,
Tudor Ambarus, Alim Akhtar, Mark Brown, Matti Vaittinen,
Andrew Morton
Cc: linux-kernel, linux-pm, devicetree, linux-usb, linux-arm-kernel,
linux-samsung-soc, RD Babiera, Kyle Tso, Amit Sunil Dhamne
From: Amit Sunil Dhamne <amitsd@google.com>
Add register bitmasks for charger function.
In addition split the charger IRQs further such that each bit represents
an IRQ downstream of charger regmap irq chip. In addition populate the
ack_base to offload irq ack to the regmap irq chip framework.
Signed-off-by: Amit Sunil Dhamne <amitsd@google.com>
---
drivers/mfd/max77759.c | 91 ++++++++++++++++++++--
include/linux/mfd/max77759.h | 176 ++++++++++++++++++++++++++++++++++++-------
2 files changed, 230 insertions(+), 37 deletions(-)
diff --git a/drivers/mfd/max77759.c b/drivers/mfd/max77759.c
index 6cf6306c4a3b..a5f7da003edd 100644
--- a/drivers/mfd/max77759.c
+++ b/drivers/mfd/max77759.c
@@ -201,8 +201,24 @@ static const struct regmap_config max77759_regmap_config_charger = {
* - SYSUVLO_INT
* - FSHIP_NOT_RD
* - CHGR_INT: charger
- * - CHG_INT
- * - CHG_INT2
+ * - INT1
+ * - AICL
+ * - CHGIN
+ * - WCIN
+ * - CHG
+ * - BAT
+ * - INLIM
+ * - THM2
+ * - BYP
+ * - INT2
+ * - INSEL
+ * - SYS_UVLO1
+ * - SYS_UVLO2
+ * - BAT_OILO
+ * - CHG_STA_CC
+ * - CHG_STA_CV
+ * - CHG_STA_TO
+ * - CHG_STA_DONE
*/
enum {
MAX77759_INT_MAXQ,
@@ -228,8 +244,22 @@ enum {
};
enum {
- MAX77759_CHARGER_INT_1,
- MAX77759_CHARGER_INT_2,
+ MAX77759_CHGR_INT1_AICL,
+ MAX77759_CHGR_INT1_CHGIN,
+ MAX77759_CHGR_INT1_WCIN,
+ MAX77759_CHGR_INT1_CHG,
+ MAX77759_CHGR_INT1_BAT,
+ MAX77759_CHGR_INT1_INLIM,
+ MAX77759_CHGR_INT1_THM2,
+ MAX77759_CHGR_INT1_BYP,
+ MAX77759_CHGR_INT2_INSEL,
+ MAX77759_CHGR_INT2_SYS_UVLO1,
+ MAX77759_CHGR_INT2_SYS_UVLO2,
+ MAX77759_CHGR_INT2_BAT_OILO,
+ MAX77759_CHGR_INT2_CHG_STA_CC,
+ MAX77759_CHGR_INT2_CHG_STA_CV,
+ MAX77759_CHGR_INT2_CHG_STA_TO,
+ MAX77759_CHGR_INT2_CHG_STA_DONE,
};
static const struct regmap_irq max77759_pmic_irqs[] = {
@@ -256,8 +286,38 @@ static const struct regmap_irq max77759_topsys_irqs[] = {
};
static const struct regmap_irq max77759_chgr_irqs[] = {
- REGMAP_IRQ_REG(MAX77759_CHARGER_INT_1, 0, GENMASK(7, 0)),
- REGMAP_IRQ_REG(MAX77759_CHARGER_INT_2, 1, GENMASK(7, 0)),
+ REGMAP_IRQ_REG(MAX77759_CHGR_INT1_AICL, 0,
+ MAX77759_CHGR_REG_CHG_INT_AICL),
+ REGMAP_IRQ_REG(MAX77759_CHGR_INT1_CHGIN, 0,
+ MAX77759_CHGR_REG_CHG_INT_CHGIN),
+ REGMAP_IRQ_REG(MAX77759_CHGR_INT1_WCIN, 0,
+ MAX77759_CHGR_REG_CHG_INT_WCIN),
+ REGMAP_IRQ_REG(MAX77759_CHGR_INT1_CHG, 0,
+ MAX77759_CHGR_REG_CHG_INT_CHG),
+ REGMAP_IRQ_REG(MAX77759_CHGR_INT1_BAT, 0,
+ MAX77759_CHGR_REG_CHG_INT_BAT),
+ REGMAP_IRQ_REG(MAX77759_CHGR_INT1_INLIM, 0,
+ MAX77759_CHGR_REG_CHG_INT_INLIM),
+ REGMAP_IRQ_REG(MAX77759_CHGR_INT1_THM2, 0,
+ MAX77759_CHGR_REG_CHG_INT_THM2),
+ REGMAP_IRQ_REG(MAX77759_CHGR_INT1_BYP, 0,
+ MAX77759_CHGR_REG_CHG_INT_BYP),
+ REGMAP_IRQ_REG(MAX77759_CHGR_INT2_INSEL, 1,
+ MAX77759_CHGR_REG_CHG_INT2_INSEL),
+ REGMAP_IRQ_REG(MAX77759_CHGR_INT2_SYS_UVLO1, 1,
+ MAX77759_CHGR_REG_CHG_INT2_SYS_UVLO1),
+ REGMAP_IRQ_REG(MAX77759_CHGR_INT2_SYS_UVLO2, 1,
+ MAX77759_CHGR_REG_CHG_INT2_SYS_UVLO2),
+ REGMAP_IRQ_REG(MAX77759_CHGR_INT2_BAT_OILO, 1,
+ MAX77759_CHGR_REG_CHG_INT2_BAT_OILO),
+ REGMAP_IRQ_REG(MAX77759_CHGR_INT2_CHG_STA_CC, 1,
+ MAX77759_CHGR_REG_CHG_INT2_CHG_STA_CC),
+ REGMAP_IRQ_REG(MAX77759_CHGR_INT2_CHG_STA_CV, 1,
+ MAX77759_CHGR_REG_CHG_INT2_CHG_STA_CV),
+ REGMAP_IRQ_REG(MAX77759_CHGR_INT2_CHG_STA_TO, 1,
+ MAX77759_CHGR_REG_CHG_INT2_CHG_STA_TO),
+ REGMAP_IRQ_REG(MAX77759_CHGR_INT2_CHG_STA_DONE, 1,
+ MAX77759_CHGR_REG_CHG_INT2_CHG_STA_DONE),
};
static const struct regmap_irq_chip max77759_pmic_irq_chip = {
@@ -302,6 +362,7 @@ static const struct regmap_irq_chip max77759_chrg_irq_chip = {
.domain_suffix = "CHGR",
.status_base = MAX77759_CHGR_REG_CHG_INT,
.mask_base = MAX77759_CHGR_REG_CHG_INT_MASK,
+ .ack_base = MAX77759_CHGR_REG_CHG_INT,
.num_regs = 2,
.irqs = max77759_chgr_irqs,
.num_irqs = ARRAY_SIZE(max77759_chgr_irqs),
@@ -325,8 +386,22 @@ static const struct resource max77759_gpio_resources[] = {
};
static const struct resource max77759_charger_resources[] = {
- DEFINE_RES_IRQ_NAMED(MAX77759_CHARGER_INT_1, "INT1"),
- DEFINE_RES_IRQ_NAMED(MAX77759_CHARGER_INT_2, "INT2"),
+ DEFINE_RES_IRQ_NAMED(MAX77759_CHGR_INT1_AICL, "AICL"),
+ DEFINE_RES_IRQ_NAMED(MAX77759_CHGR_INT1_CHGIN, "CHGIN"),
+ DEFINE_RES_IRQ_NAMED(MAX77759_CHGR_INT1_WCIN, "WCIN"),
+ DEFINE_RES_IRQ_NAMED(MAX77759_CHGR_INT1_CHG, "CHG"),
+ DEFINE_RES_IRQ_NAMED(MAX77759_CHGR_INT1_BAT, "BAT"),
+ DEFINE_RES_IRQ_NAMED(MAX77759_CHGR_INT1_INLIM, "INLIM"),
+ DEFINE_RES_IRQ_NAMED(MAX77759_CHGR_INT1_THM2, "THM2"),
+ DEFINE_RES_IRQ_NAMED(MAX77759_CHGR_INT1_BYP, "BYP"),
+ DEFINE_RES_IRQ_NAMED(MAX77759_CHGR_INT2_INSEL, "INSEL"),
+ DEFINE_RES_IRQ_NAMED(MAX77759_CHGR_INT2_SYS_UVLO1, "SYS_UVLO1"),
+ DEFINE_RES_IRQ_NAMED(MAX77759_CHGR_INT2_SYS_UVLO2, "SYS_UVLO2"),
+ DEFINE_RES_IRQ_NAMED(MAX77759_CHGR_INT2_BAT_OILO, "BAT_OILO"),
+ DEFINE_RES_IRQ_NAMED(MAX77759_CHGR_INT2_CHG_STA_CC, "CHG_STA_CC"),
+ DEFINE_RES_IRQ_NAMED(MAX77759_CHGR_INT2_CHG_STA_CV, "CHG_STA_CV"),
+ DEFINE_RES_IRQ_NAMED(MAX77759_CHGR_INT2_CHG_STA_TO, "CHG_STA_TO"),
+ DEFINE_RES_IRQ_NAMED(MAX77759_CHGR_INT2_CHG_STA_DONE, "CHG_STA_DONE"),
};
static const struct mfd_cell max77759_cells[] = {
diff --git a/include/linux/mfd/max77759.h b/include/linux/mfd/max77759.h
index c6face34e385..fd5aea21ab2e 100644
--- a/include/linux/mfd/max77759.h
+++ b/include/linux/mfd/max77759.h
@@ -59,35 +59,65 @@
#define MAX77759_MAXQ_REG_AP_DATAIN0 0xb1
#define MAX77759_MAXQ_REG_UIC_SWRST 0xe0
-#define MAX77759_CHGR_REG_CHG_INT 0xb0
-#define MAX77759_CHGR_REG_CHG_INT2 0xb1
-#define MAX77759_CHGR_REG_CHG_INT_MASK 0xb2
-#define MAX77759_CHGR_REG_CHG_INT2_MASK 0xb3
-#define MAX77759_CHGR_REG_CHG_INT_OK 0xb4
-#define MAX77759_CHGR_REG_CHG_DETAILS_00 0xb5
-#define MAX77759_CHGR_REG_CHG_DETAILS_01 0xb6
-#define MAX77759_CHGR_REG_CHG_DETAILS_02 0xb7
-#define MAX77759_CHGR_REG_CHG_DETAILS_03 0xb8
-#define MAX77759_CHGR_REG_CHG_CNFG_00 0xb9
-#define MAX77759_CHGR_REG_CHG_CNFG_01 0xba
-#define MAX77759_CHGR_REG_CHG_CNFG_02 0xbb
-#define MAX77759_CHGR_REG_CHG_CNFG_03 0xbc
-#define MAX77759_CHGR_REG_CHG_CNFG_04 0xbd
-#define MAX77759_CHGR_REG_CHG_CNFG_05 0xbe
-#define MAX77759_CHGR_REG_CHG_CNFG_06 0xbf
-#define MAX77759_CHGR_REG_CHG_CNFG_07 0xc0
-#define MAX77759_CHGR_REG_CHG_CNFG_08 0xc1
-#define MAX77759_CHGR_REG_CHG_CNFG_09 0xc2
-#define MAX77759_CHGR_REG_CHG_CNFG_10 0xc3
-#define MAX77759_CHGR_REG_CHG_CNFG_11 0xc4
-#define MAX77759_CHGR_REG_CHG_CNFG_12 0xc5
-#define MAX77759_CHGR_REG_CHG_CNFG_13 0xc6
-#define MAX77759_CHGR_REG_CHG_CNFG_14 0xc7
-#define MAX77759_CHGR_REG_CHG_CNFG_15 0xc8
-#define MAX77759_CHGR_REG_CHG_CNFG_16 0xc9
-#define MAX77759_CHGR_REG_CHG_CNFG_17 0xca
-#define MAX77759_CHGR_REG_CHG_CNFG_18 0xcb
-#define MAX77759_CHGR_REG_CHG_CNFG_19 0xcc
+#define MAX77759_CHGR_REG_CHG_INT 0xb0
+#define MAX77759_CHGR_REG_CHG_INT_AICL BIT(7)
+#define MAX77759_CHGR_REG_CHG_INT_CHGIN BIT(6)
+#define MAX77759_CHGR_REG_CHG_INT_WCIN BIT(5)
+#define MAX77759_CHGR_REG_CHG_INT_CHG BIT(4)
+#define MAX77759_CHGR_REG_CHG_INT_BAT BIT(3)
+#define MAX77759_CHGR_REG_CHG_INT_INLIM BIT(2)
+#define MAX77759_CHGR_REG_CHG_INT_THM2 BIT(1)
+#define MAX77759_CHGR_REG_CHG_INT_BYP BIT(0)
+#define MAX77759_CHGR_REG_CHG_INT2 0xb1
+#define MAX77759_CHGR_REG_CHG_INT2_INSEL BIT(7)
+#define MAX77759_CHGR_REG_CHG_INT2_SYS_UVLO1 BIT(6)
+#define MAX77759_CHGR_REG_CHG_INT2_SYS_UVLO2 BIT(5)
+#define MAX77759_CHGR_REG_CHG_INT2_BAT_OILO BIT(4)
+#define MAX77759_CHGR_REG_CHG_INT2_CHG_STA_CC BIT(3)
+#define MAX77759_CHGR_REG_CHG_INT2_CHG_STA_CV BIT(2)
+#define MAX77759_CHGR_REG_CHG_INT2_CHG_STA_TO BIT(1)
+#define MAX77759_CHGR_REG_CHG_INT2_CHG_STA_DONE BIT(0)
+#define MAX77759_CHGR_REG_CHG_INT_MASK 0xb2
+#define MAX77759_CHGR_REG_CHG_INT2_MASK 0xb3
+#define MAX77759_CHGR_REG_CHG_INT_OK 0xb4
+#define MAX77759_CHGR_REG_CHG_DETAILS_00 0xb5
+#define MAX77759_CHGR_REG_CHG_DETAILS_00_CHGIN_DTLS GENMASK(6, 5)
+#define MAX77759_CHGR_REG_CHG_DETAILS_01 0xb6
+#define MAX77759_CHGR_REG_CHG_DETAILS_01_BAT_DTLS GENMASK(6, 4)
+#define MAX77759_CHGR_REG_CHG_DETAILS_01_CHG_DTLS GENMASK(3, 0)
+#define MAX77759_CHGR_REG_CHG_DETAILS_02 0xb7
+#define MAX77759_CHGR_REG_CHG_DETAILS_02_CHGIN_STS BIT(5)
+#define MAX77759_CHGR_REG_CHG_DETAILS_03 0xb8
+#define MAX77759_CHGR_REG_CHG_CNFG_00 0xb9
+#define MAX77759_CHGR_REG_CHG_CNFG_00_MODE GENMASK(3, 0)
+#define MAX77759_CHGR_REG_CHG_CNFG_01 0xba
+#define MAX77759_CHGR_REG_CHG_CNFG_02 0xbb
+#define MAX77759_CHGR_REG_CHG_CNFG_02_CHGCC GENMASK(5, 0)
+#define MAX77759_CHGR_REG_CHG_CNFG_03 0xbc
+#define MAX77759_CHGR_REG_CHG_CNFG_04 0xbd
+#define MAX77759_CHGR_REG_CHG_CNFG_04_CHG_CV_PRM GENMASK(5, 0)
+#define MAX77759_CHGR_REG_CHG_CNFG_05 0xbe
+#define MAX77759_CHGR_REG_CHG_CNFG_06 0xbf
+#define MAX77759_CHGR_REG_CHG_CNFG_06_CHGPROT GENMASK(3, 2)
+#define MAX77759_CHGR_REG_CHG_CNFG_07 0xc0
+#define MAX77759_CHGR_REG_CHG_CNFG_08 0xc1
+#define MAX77759_CHGR_REG_CHG_CNFG_09 0xc2
+#define MAX77759_CHGR_REG_CHG_CNFG_09_CHGIN_ILIM GENMASK(6, 0)
+#define MAX77759_CHGR_REG_CHG_CNFG_10 0xc3
+#define MAX77759_CHGR_REG_CHG_CNFG_11 0xc4
+#define MAX77759_CHGR_REG_CHG_CNFG_12 0xc5
+/* Wireless Charging input channel select */
+#define MAX77759_CHGR_REG_CHG_CNFG_12_WCINSEL BIT(6)
+/* CHGIN/USB input channel select */
+#define MAX77759_CHGR_REG_CHG_CNFG_12_CHGINSEL BIT(5)
+#define MAX77759_CHGR_REG_CHG_CNFG_13 0xc6
+#define MAX77759_CHGR_REG_CHG_CNFG_14 0xc7
+#define MAX77759_CHGR_REG_CHG_CNFG_15 0xc8
+#define MAX77759_CHGR_REG_CHG_CNFG_16 0xc9
+#define MAX77759_CHGR_REG_CHG_CNFG_17 0xca
+#define MAX77759_CHGR_REG_CHG_CNFG_18 0xcb
+#define MAX77759_CHGR_REG_CHG_CNFG_18_WDTEN BIT(0)
+#define MAX77759_CHGR_REG_CHG_CNFG_19 0xcc
/* MaxQ opcodes for max77759_maxq_command() */
#define MAX77759_MAXQ_OPCODE_MAXLENGTH (MAX77759_MAXQ_REG_AP_DATAOUT32 - \
@@ -101,6 +131,94 @@
#define MAX77759_MAXQ_OPCODE_USER_SPACE_READ 0x81
#define MAX77759_MAXQ_OPCODE_USER_SPACE_WRITE 0x82
+/*
+ * Charger Input Status
+ * @MAX77759_CHGR_CHGIN_DTLS_VBUS_UNDERVOLTAGE:
+ * Charger input voltage (Vchgin) < Under Voltage Threshold (Vuvlo)
+ * @MAX77759_CHGR_CHGIN_DTLS_VBUS_MARGINAL_VOLTAGE: Vchgin > Vuvlo and
+ * Vchgin < (Battery Voltage (Vbatt) + system voltage (Vsys))
+ * @MAX77759_CHGR_CHGIN_DTLS_VBUS_OVERVOLTAGE:
+ * Vchgin > Over Voltage threshold (Vovlo)
+ * @MAX77759_CHGR_CHGIN_DTLS_VBUS_VALID:
+ * Vchgin > Vuvlo, Vchgin < Vovlo and Vchgin > (Vsys + Vbatt)
+ */
+enum max77759_chgr_chgin_dtls_status {
+ MAX77759_CHGR_CHGIN_DTLS_VBUS_UNDERVOLTAGE,
+ MAX77759_CHGR_CHGIN_DTLS_VBUS_MARGINAL_VOLTAGE,
+ MAX77759_CHGR_CHGIN_DTLS_VBUS_OVERVOLTAGE,
+ MAX77759_CHGR_CHGIN_DTLS_VBUS_VALID,
+};
+
+/*
+ * Battery Details
+ * @MAX77759_CHGR_BAT_DTLS_NO_BATT_CHG_SUSP:
+ * No battery and the charger suspended
+ * @MAX77759_CHGR_BAT_DTLS_DEAD_BATTERY: Vbatt < Vtrickle
+ * @MAX77759_CHGR_BAT_DTLS_BAT_CHG_TIMER_FAULT:
+ * Charging suspended due to timer fault
+ * @MAX77759_CHGR_BAT_DTLS_BAT_OKAY:
+ * Battery okay and Vbatt > Min Sys Voltage (Vsysmin)
+ * @MAX77759_CHGR_BAT_DTLS_BAT_UNDERVOLTAGE:
+ * Battery is okay. Vtrickle < Vbatt < Vsysmin
+ * @MAX77759_CHGR_BAT_DTLS_BAT_OVERVOLTAGE:
+ * Battery voltage > Overvoltage threshold
+ * @MAX77759_CHGR_BAT_DTLS_BAT_OVERCURRENT:
+ * Battery current exceeds overcurrent threshold
+ * @MAX77759_CHGR_BAT_DTLS_BAT_ONLY_MODE:
+ * Battery only mode and battery level not available
+ */
+enum max77759_chgr_bat_dtls_states {
+ MAX77759_CHGR_BAT_DTLS_NO_BATT_CHG_SUSP,
+ MAX77759_CHGR_BAT_DTLS_DEAD_BATTERY,
+ MAX77759_CHGR_BAT_DTLS_BAT_CHG_TIMER_FAULT,
+ MAX77759_CHGR_BAT_DTLS_BAT_OKAY,
+ MAX77759_CHGR_BAT_DTLS_BAT_UNDERVOLTAGE,
+ MAX77759_CHGR_BAT_DTLS_BAT_OVERVOLTAGE,
+ MAX77759_CHGR_BAT_DTLS_BAT_OVERCURRENT,
+ MAX77759_CHGR_BAT_DTLS_BAT_ONLY_MODE,
+};
+
+/*
+ * Charger Details
+ * @MAX77759_CHGR_CHG_DTLS_PREQUAL: Charger in prequalification mode
+ * @MAX77759_CHGR_CHG_DTLS_CC: Charger in fast charge const curr mode
+ * @MAX77759_CHGR_CHG_DTLS_CV: Charger in fast charge const voltage mode
+ * @MAX77759_CHGR_CHG_DTLS_TO: Charger is in top off mode
+ * @MAX77759_CHGR_CHG_DTLS_DONE: Charger is done
+ * @MAX77759_CHGR_CHG_DTLS_RSVD_1: Reserved
+ * @MAX77759_CHGR_CHG_DTLS_TIMER_FAULT: Charger is in timer fault mode
+ * @MAX77759_CHGR_CHG_DTLS_SUSP_BATT_THM:
+ * Charger is suspended as bettery removal detected
+ * @MAX77759_CHGR_CHG_DTLS_OFF:
+ * Charger is off. Input invalid or charger disabled
+ * @MAX77759_CHGR_CHG_DTLS_RSVD_2: Reserved
+ * @MAX77759_CHGR_CHG_DTLS_RSVD_3: Reserved
+ * @MAX77759_CHGR_CHG_DTLS_OFF_WDOG_TIMER:
+ * Charger is off as watchdog timer expired
+ * @MAX77759_CHGR_CHG_DTLS_SUSP_JEITA: Charger is in JEITA control mode
+ */
+enum max77759_chgr_chg_dtls_states {
+ MAX77759_CHGR_CHG_DTLS_PREQUAL,
+ MAX77759_CHGR_CHG_DTLS_CC,
+ MAX77759_CHGR_CHG_DTLS_CV,
+ MAX77759_CHGR_CHG_DTLS_TO,
+ MAX77759_CHGR_CHG_DTLS_DONE,
+ MAX77759_CHGR_CHG_DTLS_RSVD_1,
+ MAX77759_CHGR_CHG_DTLS_TIMER_FAULT,
+ MAX77759_CHGR_CHG_DTLS_SUSP_BATT_THM,
+ MAX77759_CHGR_CHG_DTLS_OFF,
+ MAX77759_CHGR_CHG_DTLS_RSVD_2,
+ MAX77759_CHGR_CHG_DTLS_RSVD_3,
+ MAX77759_CHGR_CHG_DTLS_OFF_WDOG_TIMER,
+ MAX77759_CHGR_CHG_DTLS_SUSP_JEITA,
+};
+
+enum max77759_chgr_mode {
+ MAX77759_CHGR_MODE_OFF,
+ MAX77759_CHGR_MODE_CHG_BUCK_ON = 0x5,
+ MAX77759_CHGR_MODE_OTG_BOOST_ON = 0xA,
+};
+
/**
* struct max77759 - core max77759 internal data structure
*
--
2.53.0.273.g2a3d683680-goog
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v6 4/6] lib/linear_ranges: Add linear_range_get_selector_high_array
2026-02-14 3:12 [PATCH v6 0/6] Introduce MAX77759 charger driver Amit Sunil Dhamne via B4 Relay
` (2 preceding siblings ...)
2026-02-14 3:12 ` [PATCH v6 3/6] mfd: max77759: add register bitmasks and modify irq configs for charger Amit Sunil Dhamne via B4 Relay
@ 2026-02-14 3:12 ` Amit Sunil Dhamne via B4 Relay
2026-02-16 13:58 ` Matti Vaittinen
2026-02-14 3:12 ` [PATCH v6 5/6] power: supply: max77759: add charger driver Amit Sunil Dhamne via B4 Relay
2026-02-14 3:12 ` [PATCH v6 6/6] usb: typec: tcpm/tcpci_maxim: deprecate WAR for setting charger mode Amit Sunil Dhamne via B4 Relay
5 siblings, 1 reply; 15+ messages in thread
From: Amit Sunil Dhamne via B4 Relay @ 2026-02-14 3:12 UTC (permalink / raw)
To: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
André Draszik, Lee Jones, Greg Kroah-Hartman,
Badhri Jagan Sridharan, Heikki Krogerus, Peter Griffin,
Tudor Ambarus, Alim Akhtar, Mark Brown, Matti Vaittinen,
Andrew Morton
Cc: linux-kernel, linux-pm, devicetree, linux-usb, linux-arm-kernel,
linux-samsung-soc, RD Babiera, Kyle Tso, Amit Sunil Dhamne
From: Amit Sunil Dhamne <amitsd@google.com>
Add a helper function to find the selector for a given value in a linear
range array. The selector should be such that the value it represents
should be higher or equal to the given value.
Signed-off-by: Amit Sunil Dhamne <amitsd@google.com>
---
include/linux/linear_range.h | 3 +++
lib/linear_ranges.c | 36 ++++++++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+)
diff --git a/include/linux/linear_range.h b/include/linux/linear_range.h
index 2e4f4c3539c0..0f3037f1a94f 100644
--- a/include/linux/linear_range.h
+++ b/include/linux/linear_range.h
@@ -57,5 +57,8 @@ void linear_range_get_selector_within(const struct linear_range *r,
int linear_range_get_selector_low_array(const struct linear_range *r,
int ranges, unsigned int val,
unsigned int *selector, bool *found);
+int linear_range_get_selector_high_array(const struct linear_range *r,
+ int ranges, unsigned int val,
+ unsigned int *selector, bool *found);
#endif
diff --git a/lib/linear_ranges.c b/lib/linear_ranges.c
index a1a7dfa881de..c85583678f6b 100644
--- a/lib/linear_ranges.c
+++ b/lib/linear_ranges.c
@@ -241,6 +241,42 @@ int linear_range_get_selector_high(const struct linear_range *r,
}
EXPORT_SYMBOL_GPL(linear_range_get_selector_high);
+/**
+ * linear_range_get_selector_high_array - return linear range selector for value
+ * @r: pointer to array of linear ranges where selector is looked from
+ * @ranges: amount of ranges to scan from array
+ * @val: value for which the selector is searched
+ * @selector: address where found selector value is updated
+ * @found: flag to indicate that given value was in the range
+ *
+ * Scan array of ranges for selector for which range value matches given
+ * input value. Value is matching if it is equal or higher than given value
+ * If given value is found to be in a range scanning is stopped and @found is
+ * set true. If a range with values greater than given value is found
+ * but the range min is being greater than given value, then the range's
+ * lowest selector is updated to @selector and scanning is stopped.
+ *
+ * Return: 0 on success, -EINVAL if range array is invalid or does not contain
+ * range with a value greater or equal to given value
+ */
+int linear_range_get_selector_high_array(const struct linear_range *r,
+ int ranges, unsigned int val,
+ unsigned int *selector, bool *found)
+{
+ int i;
+ int ret;
+
+ for (i = 0; i < ranges; i++) {
+ ret = linear_range_get_selector_high(&r[i], val, selector,
+ found);
+ if (!ret)
+ return 0;
+ }
+
+ return -EINVAL;
+}
+EXPORT_SYMBOL_GPL(linear_range_get_selector_high_array);
+
/**
* linear_range_get_selector_within - return linear range selector for value
* @r: pointer to linear range where selector is looked from
--
2.53.0.273.g2a3d683680-goog
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v6 5/6] power: supply: max77759: add charger driver
2026-02-14 3:12 [PATCH v6 0/6] Introduce MAX77759 charger driver Amit Sunil Dhamne via B4 Relay
` (3 preceding siblings ...)
2026-02-14 3:12 ` [PATCH v6 4/6] lib/linear_ranges: Add linear_range_get_selector_high_array Amit Sunil Dhamne via B4 Relay
@ 2026-02-14 3:12 ` Amit Sunil Dhamne via B4 Relay
2026-02-14 8:56 ` kernel test robot
2026-02-17 13:14 ` André Draszik
2026-02-14 3:12 ` [PATCH v6 6/6] usb: typec: tcpm/tcpci_maxim: deprecate WAR for setting charger mode Amit Sunil Dhamne via B4 Relay
5 siblings, 2 replies; 15+ messages in thread
From: Amit Sunil Dhamne via B4 Relay @ 2026-02-14 3:12 UTC (permalink / raw)
To: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
André Draszik, Lee Jones, Greg Kroah-Hartman,
Badhri Jagan Sridharan, Heikki Krogerus, Peter Griffin,
Tudor Ambarus, Alim Akhtar, Mark Brown, Matti Vaittinen,
Andrew Morton
Cc: linux-kernel, linux-pm, devicetree, linux-usb, linux-arm-kernel,
linux-samsung-soc, RD Babiera, Kyle Tso, Amit Sunil Dhamne
From: Amit Sunil Dhamne <amitsd@google.com>
Add support for MAX77759 battery charger driver. This is a 4A 1-Cell
Li+/LiPoly dual input switch mode charger. While the device can support
USB & wireless charger inputs, this implementation only supports USB
input. This implementation supports both buck and boost modes.
Signed-off-by: Amit Sunil Dhamne <amitsd@google.com>
---
MAINTAINERS | 6 +
drivers/power/supply/Kconfig | 11 +
drivers/power/supply/Makefile | 1 +
drivers/power/supply/max77759_charger.c | 768 ++++++++++++++++++++++++++++++++
4 files changed, 786 insertions(+)
diff --git a/MAINTAINERS b/MAINTAINERS
index 67db88b04537..7f6d1c5c2569 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -15553,6 +15553,12 @@ F: drivers/mfd/max77759.c
F: drivers/nvmem/max77759-nvmem.c
F: include/linux/mfd/max77759.h
+MAXIM MAX77759 BATTERY CHARGER DRIVER
+M: Amit Sunil Dhamne <amitsd@google.com>
+L: linux-kernel@vger.kernel.org
+S: Maintained
+F: drivers/power/supply/max77759_charger.c
+
MAXIM MAX77802 PMIC REGULATOR DEVICE DRIVER
M: Javier Martinez Canillas <javier@dowhile0.org>
L: linux-kernel@vger.kernel.org
diff --git a/drivers/power/supply/Kconfig b/drivers/power/supply/Kconfig
index 92f9f7aae92f..3a2cdb95c98e 100644
--- a/drivers/power/supply/Kconfig
+++ b/drivers/power/supply/Kconfig
@@ -631,6 +631,17 @@ config CHARGER_MAX77705
help
Say Y to enable support for the Maxim MAX77705 battery charger.
+config CHARGER_MAX77759
+ tristate "Maxim MAX77759 battery charger driver"
+ depends on MFD_MAX77759 && REGULATOR
+ default MFD_MAX77759
+ help
+ Say M or Y here to enable the MAX77759 battery charger. MAX77759
+ charger is a function of the MAX77759 PMIC. This is a dual input
+ switch-mode charger. This driver supports buck and OTG boost modes.
+
+ If built as a module, it will be called max77759_charger.
+
config CHARGER_MAX77976
tristate "Maxim MAX77976 battery charger driver"
depends on I2C
diff --git a/drivers/power/supply/Makefile b/drivers/power/supply/Makefile
index 4b79d5abc49a..6af905875ad5 100644
--- a/drivers/power/supply/Makefile
+++ b/drivers/power/supply/Makefile
@@ -128,3 +128,4 @@ obj-$(CONFIG_CHARGER_SURFACE) += surface_charger.o
obj-$(CONFIG_BATTERY_UG3105) += ug3105_battery.o
obj-$(CONFIG_CHARGER_QCOM_SMB2) += qcom_smbx.o
obj-$(CONFIG_FUEL_GAUGE_MM8013) += mm8013.o
+obj-$(CONFIG_CHARGER_MAX77759) += max77759_charger.o
diff --git a/drivers/power/supply/max77759_charger.c b/drivers/power/supply/max77759_charger.c
new file mode 100644
index 000000000000..d4e02764ba04
--- /dev/null
+++ b/drivers/power/supply/max77759_charger.c
@@ -0,0 +1,768 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * max77759_charger.c - Battery charger driver for MAX77759 charger device.
+ *
+ * Copyright 2025 Google LLC.
+ */
+
+#include <linux/bitfield.h>
+#include <linux/cleanup.h>
+#include <linux/device.h>
+#include <linux/devm-helpers.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/linear_range.h>
+#include <linux/mfd/max77759.h>
+#include <linux/module.h>
+#include <linux/mod_devicetable.h>
+#include <linux/mutex.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/power_supply.h>
+#include <linux/regmap.h>
+#include <linux/regulator/driver.h>
+#include <linux/string_choices.h>
+#include <linux/workqueue.h>
+
+/* Default values for Fast Charge Current & Float Voltage */
+#define CHG_CC_DEFAULT_UA 2266770
+#define CHG_FV_DEFAULT_MV 4300
+
+#define MAX_NUM_RETRIES 3
+#define PSY_WORK_RETRY_DELAY_MS 10
+
+#define FOREACH_IRQ(S) \
+ S(AICL), \
+ S(CHGIN), \
+ S(CHG), \
+ S(INLIM), \
+ S(BAT_OILO), \
+ S(CHG_STA_CC), \
+ S(CHG_STA_CV), \
+ S(CHG_STA_TO), \
+ S(CHG_STA_DONE)
+
+#define GENERATE_ENUM(e) e
+#define GENERATE_STRING(s) #s
+
+enum {
+ FOREACH_IRQ(GENERATE_ENUM)
+};
+
+static const char *const chgr_irqs_str[] = {
+ FOREACH_IRQ(GENERATE_STRING)
+};
+
+#define NUM_IRQS ARRAY_SIZE(chgr_irqs_str)
+
+/* Fast charge current limits (in uA) */
+static const struct linear_range chgcc_limit_ranges[] = {
+ LINEAR_RANGE(133330, 0x0, 0x2, 0),
+ LINEAR_RANGE(200000, 0x3, 0x3C, 66670),
+};
+
+/* Charge Termination Voltage Limits (in mV) */
+static const struct linear_range chg_cv_prm_ranges[] = {
+ LINEAR_RANGE(3800, 0x38, 0x39, 100),
+ LINEAR_RANGE(4000, 0x0, 0x32, 10),
+};
+
+/* USB input current limits (in uA) */
+static const struct linear_range chgin_ilim_ranges[] = {
+ LINEAR_RANGE(100000, 0x3, 0x7F, 25000),
+};
+
+struct max77759_charger {
+ struct device *dev;
+ struct regmap *regmap;
+ struct power_supply *psy;
+ struct regulator_dev *chgin_otg_rdev;
+ struct notifier_block nb;
+ struct power_supply *tcpm_psy;
+ struct delayed_work psy_work;
+ struct mutex retry_lock; /* Protects psy_work_retry_cnt */
+ u32 psy_work_retry_cnt;
+ int irqs[NUM_IRQS];
+ struct mutex lock; /* protects the state below */
+ enum max77759_chgr_mode mode;
+};
+
+static inline int unlock_prot_regs(struct max77759_charger *chg, bool unlock)
+{
+ return regmap_update_bits(chg->regmap, MAX77759_CHGR_REG_CHG_CNFG_06,
+ MAX77759_CHGR_REG_CHG_CNFG_06_CHGPROT, unlock
+ ? MAX77759_CHGR_REG_CHG_CNFG_06_CHGPROT : 0);
+}
+
+static int charger_input_valid(struct max77759_charger *chg)
+{
+ u32 val;
+ int ret;
+
+ ret = regmap_read(chg->regmap, MAX77759_CHGR_REG_CHG_INT_OK, &val);
+ if (ret)
+ return ret;
+
+ return (val & MAX77759_CHGR_REG_CHG_INT_CHG) &&
+ (val & MAX77759_CHGR_REG_CHG_INT_CHGIN);
+}
+
+static int get_online(struct max77759_charger *chg)
+{
+ u32 val;
+ int ret;
+
+ ret = charger_input_valid(chg);
+ if (ret <= 0)
+ return ret;
+
+ ret = regmap_read(chg->regmap, MAX77759_CHGR_REG_CHG_DETAILS_02, &val);
+ if (ret)
+ return ret;
+
+ guard(mutex)(&chg->lock);
+
+ return (val & MAX77759_CHGR_REG_CHG_DETAILS_02_CHGIN_STS) &&
+ (chg->mode == MAX77759_CHGR_MODE_CHG_BUCK_ON);
+}
+
+static int get_status(struct max77759_charger *chg)
+{
+ u32 val;
+ int ret;
+
+ ret = regmap_read(chg->regmap, MAX77759_CHGR_REG_CHG_DETAILS_01, &val);
+ if (ret)
+ return ret;
+
+ switch (FIELD_GET(MAX77759_CHGR_REG_CHG_DETAILS_01_CHG_DTLS, val)) {
+ case MAX77759_CHGR_CHG_DTLS_PREQUAL:
+ case MAX77759_CHGR_CHG_DTLS_CC:
+ case MAX77759_CHGR_CHG_DTLS_CV:
+ case MAX77759_CHGR_CHG_DTLS_TO:
+ return POWER_SUPPLY_STATUS_CHARGING;
+ case MAX77759_CHGR_CHG_DTLS_DONE:
+ return POWER_SUPPLY_STATUS_FULL;
+ case MAX77759_CHGR_CHG_DTLS_TIMER_FAULT:
+ case MAX77759_CHGR_CHG_DTLS_SUSP_BATT_THM:
+ case MAX77759_CHGR_CHG_DTLS_OFF_WDOG_TIMER:
+ case MAX77759_CHGR_CHG_DTLS_SUSP_JEITA:
+ return POWER_SUPPLY_STATUS_NOT_CHARGING;
+ case MAX77759_CHGR_CHG_DTLS_OFF:
+ return POWER_SUPPLY_STATUS_DISCHARGING;
+ default:
+ break;
+ }
+
+ return POWER_SUPPLY_STATUS_UNKNOWN;
+}
+
+static int get_charge_type(struct max77759_charger *chg)
+{
+ u32 val;
+ int ret;
+
+ ret = regmap_read(chg->regmap, MAX77759_CHGR_REG_CHG_DETAILS_01, &val);
+ if (ret)
+ return ret;
+
+ switch (FIELD_GET(MAX77759_CHGR_REG_CHG_DETAILS_01_CHG_DTLS, val)) {
+ case MAX77759_CHGR_CHG_DTLS_PREQUAL:
+ return POWER_SUPPLY_CHARGE_TYPE_TRICKLE;
+ case MAX77759_CHGR_CHG_DTLS_CC:
+ case MAX77759_CHGR_CHG_DTLS_CV:
+ return POWER_SUPPLY_CHARGE_TYPE_FAST;
+ case MAX77759_CHGR_CHG_DTLS_TO:
+ return POWER_SUPPLY_CHARGE_TYPE_STANDARD;
+ case MAX77759_CHGR_CHG_DTLS_DONE:
+ case MAX77759_CHGR_CHG_DTLS_TIMER_FAULT:
+ case MAX77759_CHGR_CHG_DTLS_SUSP_BATT_THM:
+ case MAX77759_CHGR_CHG_DTLS_OFF_WDOG_TIMER:
+ case MAX77759_CHGR_CHG_DTLS_SUSP_JEITA:
+ case MAX77759_CHGR_CHG_DTLS_OFF:
+ return POWER_SUPPLY_CHARGE_TYPE_NONE;
+ default:
+ break;
+ }
+
+ return POWER_SUPPLY_CHARGE_TYPE_UNKNOWN;
+}
+
+static int get_chg_health(struct max77759_charger *chg)
+{
+ u32 val;
+ int ret;
+
+ ret = regmap_read(chg->regmap, MAX77759_CHGR_REG_CHG_DETAILS_00, &val);
+ if (ret)
+ return ret;
+
+ switch (FIELD_GET(MAX77759_CHGR_REG_CHG_DETAILS_00_CHGIN_DTLS, val)) {
+ case MAX77759_CHGR_CHGIN_DTLS_VBUS_UNDERVOLTAGE:
+ case MAX77759_CHGR_CHGIN_DTLS_VBUS_MARGINAL_VOLTAGE:
+ return POWER_SUPPLY_HEALTH_UNDERVOLTAGE;
+ case MAX77759_CHGR_CHGIN_DTLS_VBUS_OVERVOLTAGE:
+ return POWER_SUPPLY_HEALTH_OVERVOLTAGE;
+ case MAX77759_CHGR_CHGIN_DTLS_VBUS_VALID:
+ return POWER_SUPPLY_HEALTH_GOOD;
+ default:
+ break;
+ }
+
+ return POWER_SUPPLY_HEALTH_UNKNOWN;
+}
+
+static int get_batt_health(struct max77759_charger *chg)
+{
+ u32 val;
+ int ret;
+
+ ret = regmap_read(chg->regmap, MAX77759_CHGR_REG_CHG_DETAILS_01, &val);
+ if (ret)
+ return ret;
+
+ switch (FIELD_GET(MAX77759_CHGR_REG_CHG_DETAILS_01_BAT_DTLS, val)) {
+ case MAX77759_CHGR_BAT_DTLS_NO_BATT_CHG_SUSP:
+ return POWER_SUPPLY_HEALTH_NO_BATTERY;
+ case MAX77759_CHGR_BAT_DTLS_DEAD_BATTERY:
+ return POWER_SUPPLY_HEALTH_DEAD;
+ case MAX77759_CHGR_BAT_DTLS_BAT_CHG_TIMER_FAULT:
+ return POWER_SUPPLY_HEALTH_SAFETY_TIMER_EXPIRE;
+ case MAX77759_CHGR_BAT_DTLS_BAT_OKAY:
+ case MAX77759_CHGR_BAT_DTLS_BAT_ONLY_MODE:
+ return POWER_SUPPLY_HEALTH_GOOD;
+ case MAX77759_CHGR_BAT_DTLS_BAT_UNDERVOLTAGE:
+ return POWER_SUPPLY_HEALTH_UNDERVOLTAGE;
+ case MAX77759_CHGR_BAT_DTLS_BAT_OVERVOLTAGE:
+ return POWER_SUPPLY_HEALTH_OVERVOLTAGE;
+ case MAX77759_CHGR_BAT_DTLS_BAT_OVERCURRENT:
+ return POWER_SUPPLY_HEALTH_OVERCURRENT;
+ default:
+ break;
+ }
+
+ return POWER_SUPPLY_HEALTH_UNKNOWN;
+}
+
+static int get_health(struct max77759_charger *chg)
+{
+ int ret;
+
+ ret = get_online(chg);
+ if (ret < 0)
+ return ret;
+
+ if (ret) {
+ ret = get_chg_health(chg);
+ if (ret < 0 || ret != POWER_SUPPLY_HEALTH_GOOD)
+ return ret;
+ }
+
+ return get_batt_health(chg);
+}
+
+static int get_fast_charge_current(struct max77759_charger *chg)
+{
+ u32 regval, val;
+ int ret;
+
+ ret = regmap_read(chg->regmap, MAX77759_CHGR_REG_CHG_CNFG_02, ®val);
+ if (ret)
+ return ret;
+
+ regval = FIELD_GET(MAX77759_CHGR_REG_CHG_CNFG_02_CHGCC, regval);
+ ret = linear_range_get_value_array(chgcc_limit_ranges,
+ ARRAY_SIZE(chgcc_limit_ranges),
+ regval, &val);
+ return ret ? ret : val;
+}
+
+static int set_fast_charge_current_limit(struct max77759_charger *chg,
+ u32 cc_max_ua)
+{
+ bool found;
+ u32 regval;
+
+ linear_range_get_selector_high_array(chgcc_limit_ranges,
+ ARRAY_SIZE(chgcc_limit_ranges),
+ cc_max_ua, ®val, &found);
+ if (!found)
+ return -EINVAL;
+
+ return regmap_update_bits(chg->regmap, MAX77759_CHGR_REG_CHG_CNFG_02,
+ MAX77759_CHGR_REG_CHG_CNFG_02_CHGCC, regval);
+}
+
+static int get_float_voltage(struct max77759_charger *chg)
+{
+ u32 regval, val;
+ int ret;
+
+ ret = regmap_read(chg->regmap, MAX77759_CHGR_REG_CHG_CNFG_04, ®val);
+ if (ret)
+ return ret;
+
+ regval = FIELD_GET(MAX77759_CHGR_REG_CHG_CNFG_04_CHG_CV_PRM, regval);
+ ret = linear_range_get_value_array(chg_cv_prm_ranges,
+ ARRAY_SIZE(chg_cv_prm_ranges),
+ regval, &val);
+
+ return ret ? ret : val;
+}
+
+static int set_float_voltage_limit(struct max77759_charger *chg, u32 fv_mv)
+{
+ u32 regval;
+ bool found;
+
+ linear_range_get_selector_high_array(chg_cv_prm_ranges,
+ ARRAY_SIZE(chg_cv_prm_ranges),
+ fv_mv, ®val, &found);
+ if (!found)
+ return -EINVAL;
+
+ return regmap_update_bits(chg->regmap, MAX77759_CHGR_REG_CHG_CNFG_04,
+ MAX77759_CHGR_REG_CHG_CNFG_04_CHG_CV_PRM,
+ regval);
+}
+
+static int get_input_current_limit(struct max77759_charger *chg)
+{
+ u32 regval, val;
+ int ret;
+
+ ret = regmap_read(chg->regmap, MAX77759_CHGR_REG_CHG_CNFG_09, ®val);
+ if (ret)
+ return ret;
+
+ regval = FIELD_GET(MAX77759_CHGR_REG_CHG_CNFG_09_CHGIN_ILIM, regval);
+ regval = umax(regval, chgin_ilim_ranges[0].min_sel);
+
+ ret = linear_range_get_value_array(chgin_ilim_ranges,
+ ARRAY_SIZE(chgin_ilim_ranges),
+ regval, &val);
+
+ return ret ? ret : val;
+}
+
+static int set_input_current_limit(struct max77759_charger *chg, int ilim_ua)
+{
+ u32 regval;
+
+ if (ilim_ua < 0)
+ return -EINVAL;
+
+ linear_range_get_selector_within(chgin_ilim_ranges, ilim_ua, ®val);
+
+ return regmap_update_bits(chg->regmap, MAX77759_CHGR_REG_CHG_CNFG_09,
+ MAX77759_CHGR_REG_CHG_CNFG_09_CHGIN_ILIM,
+ regval);
+}
+
+static const enum power_supply_property max77759_charger_props[] = {
+ POWER_SUPPLY_PROP_ONLINE,
+ POWER_SUPPLY_PROP_PRESENT,
+ POWER_SUPPLY_PROP_STATUS,
+ POWER_SUPPLY_PROP_CHARGE_TYPE,
+ POWER_SUPPLY_PROP_HEALTH,
+ POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX,
+ POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX,
+ POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT,
+};
+
+static int max77759_charger_get_property(struct power_supply *psy,
+ enum power_supply_property psp,
+ union power_supply_propval *pval)
+{
+ struct max77759_charger *chg = power_supply_get_drvdata(psy);
+ int ret;
+
+ switch (psp) {
+ case POWER_SUPPLY_PROP_ONLINE:
+ ret = get_online(chg);
+ break;
+ case POWER_SUPPLY_PROP_PRESENT:
+ ret = charger_input_valid(chg);
+ break;
+ case POWER_SUPPLY_PROP_STATUS:
+ ret = get_status(chg);
+ break;
+ case POWER_SUPPLY_PROP_CHARGE_TYPE:
+ ret = get_charge_type(chg);
+ break;
+ case POWER_SUPPLY_PROP_HEALTH:
+ ret = get_health(chg);
+ break;
+ case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX:
+ ret = get_fast_charge_current(chg);
+ break;
+ case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX:
+ ret = get_float_voltage(chg);
+ break;
+ case POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT:
+ ret = get_input_current_limit(chg);
+ break;
+ default:
+ ret = -EINVAL;
+ }
+
+ pval->intval = ret;
+ return ret < 0 ? ret : 0;
+}
+
+static const struct power_supply_desc max77759_charger_desc = {
+ .name = "max77759-charger",
+ .type = POWER_SUPPLY_TYPE_USB,
+ .properties = max77759_charger_props,
+ .num_properties = ARRAY_SIZE(max77759_charger_props),
+ .get_property = max77759_charger_get_property,
+};
+
+static int charger_set_mode(struct max77759_charger *chg,
+ enum max77759_chgr_mode mode)
+{
+ int ret;
+
+ guard(mutex)(&chg->lock);
+
+ if (chg->mode == mode)
+ return 0;
+
+ if ((mode == MAX77759_CHGR_MODE_CHG_BUCK_ON ||
+ mode == MAX77759_CHGR_MODE_OTG_BOOST_ON) &&
+ chg->mode != MAX77759_CHGR_MODE_OFF) {
+ dev_err(chg->dev, "Invalid mode transition from %d to %d",
+ chg->mode, mode);
+ return -EINVAL;
+ }
+
+ ret = regmap_update_bits(chg->regmap, MAX77759_CHGR_REG_CHG_CNFG_00,
+ MAX77759_CHGR_REG_CHG_CNFG_00_MODE, mode);
+ if (ret)
+ return ret;
+
+ chg->mode = mode;
+ return 0;
+}
+
+static int enable_chgin_otg(struct regulator_dev *rdev)
+{
+ struct max77759_charger *chg = rdev_get_drvdata(rdev);
+
+ return charger_set_mode(chg, MAX77759_CHGR_MODE_OTG_BOOST_ON);
+}
+
+static int disable_chgin_otg(struct regulator_dev *rdev)
+{
+ struct max77759_charger *chg = rdev_get_drvdata(rdev);
+
+ return charger_set_mode(chg, MAX77759_CHGR_MODE_OFF);
+}
+
+static int chgin_otg_status(struct regulator_dev *rdev)
+{
+ struct max77759_charger *chg = rdev_get_drvdata(rdev);
+
+ guard(mutex)(&chg->lock);
+
+ return chg->mode == MAX77759_CHGR_MODE_OTG_BOOST_ON;
+}
+
+static const struct regulator_ops chgin_otg_reg_ops = {
+ .enable = enable_chgin_otg,
+ .disable = disable_chgin_otg,
+ .is_enabled = chgin_otg_status,
+};
+
+static const struct regulator_desc chgin_otg_reg_desc = {
+ .name = "chgin-otg",
+ .of_match = of_match_ptr("chgin-otg-regulator"),
+ .owner = THIS_MODULE,
+ .ops = &chgin_otg_reg_ops,
+ .fixed_uV = 5000000,
+ .n_voltages = 1,
+};
+
+static irqreturn_t irq_handler(int irq, void *data)
+{
+ struct max77759_charger *chg = data;
+
+ power_supply_changed(chg->psy);
+
+ return IRQ_HANDLED;
+}
+
+static irqreturn_t bat_oilo_irq_handler(int irq, void *data)
+{
+ struct max77759_charger *chg = data;
+
+ dev_warn_ratelimited(chg->dev, "Battery over-current threshold crossed");
+
+ return irq_handler(irq, data);
+}
+
+static int max77759_init_irqhandler(struct max77759_charger *chg)
+{
+ struct device *dev = chg->dev;
+ irq_handler_t thread_fn;
+ char *name;
+ int i, ret;
+
+ for (i = 0; i < ARRAY_SIZE(chgr_irqs_str); i++) {
+ ret = platform_get_irq_byname(to_platform_device(dev),
+ chgr_irqs_str[i]);
+ if (ret < 0)
+ return dev_err_probe(dev, ret,
+ "Failed to get irq resource for %s",
+ chgr_irqs_str[i]);
+
+ chg->irqs[i] = ret;
+ name = devm_kasprintf(dev, GFP_KERNEL, "%s:%s", dev_name(dev),
+ chgr_irqs_str[i]);
+ if (!name)
+ return dev_err_probe(dev, -ENOMEM,
+ "Failed to allocate space for irqname: %s",
+ chgr_irqs_str[i]);
+
+ if (i == BAT_OILO)
+ thread_fn = bat_oilo_irq_handler;
+ else
+ thread_fn = irq_handler;
+
+ ret = devm_request_threaded_irq(dev, chg->irqs[i], NULL,
+ thread_fn, 0, name, chg);
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "Unable to register irq handler for %s",
+ chgr_irqs_str[i]);
+ }
+
+ return 0;
+}
+
+static int max77759_charger_init(struct max77759_charger *chg)
+{
+ struct power_supply_battery_info *info;
+ u32 regval, fast_chg_curr, fv;
+ int ret;
+
+ ret = regmap_read(chg->regmap, MAX77759_CHGR_REG_CHG_CNFG_00, ®val);
+ if (ret)
+ return ret;
+
+ chg->mode = FIELD_GET(MAX77759_CHGR_REG_CHG_CNFG_00_MODE, regval);
+ ret = charger_set_mode(chg, MAX77759_CHGR_MODE_OFF);
+ if (ret)
+ return ret;
+
+ if (power_supply_get_battery_info(chg->psy, &info)) {
+ fv = CHG_FV_DEFAULT_MV;
+ fast_chg_curr = CHG_CC_DEFAULT_UA;
+ } else {
+ fv = info->constant_charge_voltage_max_uv / 1000;
+ fast_chg_curr = info->constant_charge_current_max_ua;
+ }
+
+ ret = set_fast_charge_current_limit(chg, fast_chg_curr);
+ if (ret)
+ return ret;
+
+ ret = set_float_voltage_limit(chg, fv);
+ if (ret)
+ return ret;
+
+ ret = unlock_prot_regs(chg, true);
+ if (ret)
+ return ret;
+
+ /* Disable wireless charging input */
+ ret = regmap_update_bits(chg->regmap, MAX77759_CHGR_REG_CHG_CNFG_12,
+ MAX77759_CHGR_REG_CHG_CNFG_12_WCINSEL, 0);
+ if (ret)
+ return ret;
+
+ ret = regmap_update_bits(chg->regmap, MAX77759_CHGR_REG_CHG_CNFG_18,
+ MAX77759_CHGR_REG_CHG_CNFG_18_WDTEN, 0);
+ if (ret)
+ return ret;
+
+ return unlock_prot_regs(chg, false);
+}
+
+static void psy_work_item(struct work_struct *work)
+{
+ struct max77759_charger *chg =
+ container_of(work, struct max77759_charger, psy_work.work);
+ union power_supply_propval current_limit, online;
+ int ret;
+
+ ret = power_supply_get_property(chg->tcpm_psy,
+ POWER_SUPPLY_PROP_CURRENT_MAX,
+ ¤t_limit);
+ if (ret) {
+ dev_err(chg->dev,
+ "Failed to get CURRENT_MAX psy property, ret=%d",
+ ret);
+ goto err;
+ }
+
+ ret = power_supply_get_property(chg->tcpm_psy, POWER_SUPPLY_PROP_ONLINE,
+ &online);
+ if (ret) {
+ dev_err(chg->dev,
+ "Failed to get ONLINE psy property, ret=%d",
+ ret);
+ goto err;
+ }
+
+ if (online.intval && current_limit.intval) {
+ ret = set_input_current_limit(chg, current_limit.intval);
+ if (ret) {
+ dev_err(chg->dev,
+ "Unable to set current limit, ret=%d", ret);
+ goto err;
+ }
+
+ charger_set_mode(chg, MAX77759_CHGR_MODE_CHG_BUCK_ON);
+ } else {
+ charger_set_mode(chg, MAX77759_CHGR_MODE_OFF);
+ }
+
+ guard(mutex)(&chg->retry_lock);
+
+ if (chg->psy_work_retry_cnt)
+ dev_dbg(chg->dev, "chg psy_work succeeded after %u tries",
+ chg->psy_work_retry_cnt);
+ chg->psy_work_retry_cnt = 0;
+ return;
+
+err:
+ charger_set_mode(chg, MAX77759_CHGR_MODE_OFF);
+ guard(mutex)(&chg->retry_lock);
+
+ if (chg->psy_work_retry_cnt >= MAX_NUM_RETRIES) {
+ dev_err(chg->dev, "chg psy work failed, giving up");
+ return;
+ }
+
+ ++chg->psy_work_retry_cnt;
+ dev_dbg(chg->dev, "Retrying %u/%u chg psy_work",
+ chg->psy_work_retry_cnt, MAX_NUM_RETRIES);
+ schedule_delayed_work(&chg->psy_work,
+ msecs_to_jiffies(PSY_WORK_RETRY_DELAY_MS));
+}
+
+static int psy_changed(struct notifier_block *nb, unsigned long evt, void *data)
+{
+ struct max77759_charger *chg = container_of(nb, struct max77759_charger,
+ nb);
+ static const char *psy_name = "tcpm-source";
+ struct power_supply *psy = data;
+
+ if (!strnstr(psy->desc->name, psy_name, strlen(psy_name)) ||
+ evt != PSY_EVENT_PROP_CHANGED)
+ return NOTIFY_OK;
+
+ chg->tcpm_psy = psy;
+ scoped_guard(mutex, &chg->retry_lock)
+ chg->psy_work_retry_cnt = 0;
+
+ schedule_delayed_work(&chg->psy_work, 0);
+
+ return NOTIFY_OK;
+}
+
+static void max_tcpci_unregister_psy_notifier(void *nb)
+{
+ power_supply_unreg_notifier(nb);
+}
+
+static int max77759_charger_probe(struct platform_device *pdev)
+{
+ struct regulator_config chgin_otg_reg_cfg;
+ struct power_supply_config psy_cfg;
+ struct device *dev = &pdev->dev;
+ struct max77759_charger *chg;
+ int ret;
+
+ device_set_of_node_from_dev(dev, dev->parent);
+ chg = devm_kzalloc(dev, sizeof(*chg), GFP_KERNEL);
+ if (!chg)
+ return -ENOMEM;
+
+ platform_set_drvdata(pdev, chg);
+ chg->dev = dev;
+ chg->regmap = dev_get_regmap(dev->parent, "charger");
+ if (!chg->regmap)
+ return dev_err_probe(dev, -ENODEV, "Missing regmap");
+
+ ret = devm_mutex_init(dev, &chg->lock);
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to initialize lock");
+
+ ret = devm_mutex_init(dev, &chg->retry_lock);
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "Failed to initialize retry_lock");
+
+ psy_cfg.fwnode = dev_fwnode(dev);
+ psy_cfg.drv_data = chg;
+ chg->psy = devm_power_supply_register(dev, &max77759_charger_desc,
+ &psy_cfg);
+ if (IS_ERR(chg->psy))
+ return dev_err_probe(dev, -EPROBE_DEFER,
+ "Failed to register psy, ret=%ld",
+ PTR_ERR(chg->psy));
+
+ ret = max77759_charger_init(chg);
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "Failed to initialize max77759 charger");
+
+ chgin_otg_reg_cfg.dev = dev;
+ chgin_otg_reg_cfg.driver_data = chg;
+ chgin_otg_reg_cfg.of_node = dev_of_node(dev);
+ chg->chgin_otg_rdev = devm_regulator_register(dev, &chgin_otg_reg_desc,
+ &chgin_otg_reg_cfg);
+ if (IS_ERR(chg->chgin_otg_rdev))
+ return dev_err_probe(dev, PTR_ERR(chg->chgin_otg_rdev),
+ "Failed to register chgin otg regulator");
+
+ ret = devm_delayed_work_autocancel(dev, &chg->psy_work, psy_work_item);
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to initialize psy work");
+
+ chg->nb.notifier_call = psy_changed;
+ ret = power_supply_reg_notifier(&chg->nb);
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "Unable to register psy notifier");
+
+ ret = devm_add_action_or_reset(dev, max_tcpci_unregister_psy_notifier,
+ &chg->nb);
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "Failed to add devm action to unregister psy notifier");
+
+ return max77759_init_irqhandler(chg);
+}
+
+static const struct platform_device_id max77759_charger_id[] = {
+ { .name = "max77759-charger", },
+ { }
+};
+MODULE_DEVICE_TABLE(platform, max77759_charger_id);
+
+static struct platform_driver max77759_charger_driver = {
+ .driver = {
+ .name = "max77759-charger",
+ .probe_type = PROBE_PREFER_ASYNCHRONOUS,
+ },
+ .probe = max77759_charger_probe,
+ .id_table = max77759_charger_id,
+};
+module_platform_driver(max77759_charger_driver);
+
+MODULE_AUTHOR("Amit Sunil Dhamne <amitsd@google.com>");
+MODULE_DESCRIPTION("Maxim MAX77759 charger driver");
+MODULE_LICENSE("GPL");
--
2.53.0.273.g2a3d683680-goog
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v6 6/6] usb: typec: tcpm/tcpci_maxim: deprecate WAR for setting charger mode
2026-02-14 3:12 [PATCH v6 0/6] Introduce MAX77759 charger driver Amit Sunil Dhamne via B4 Relay
` (4 preceding siblings ...)
2026-02-14 3:12 ` [PATCH v6 5/6] power: supply: max77759: add charger driver Amit Sunil Dhamne via B4 Relay
@ 2026-02-14 3:12 ` Amit Sunil Dhamne via B4 Relay
5 siblings, 0 replies; 15+ messages in thread
From: Amit Sunil Dhamne via B4 Relay @ 2026-02-14 3:12 UTC (permalink / raw)
To: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
André Draszik, Lee Jones, Greg Kroah-Hartman,
Badhri Jagan Sridharan, Heikki Krogerus, Peter Griffin,
Tudor Ambarus, Alim Akhtar, Mark Brown, Matti Vaittinen,
Andrew Morton
Cc: linux-kernel, linux-pm, devicetree, linux-usb, linux-arm-kernel,
linux-samsung-soc, RD Babiera, Kyle Tso, Amit Sunil Dhamne
From: Amit Sunil Dhamne <amitsd@google.com>
TCPCI maxim driver directly writes to the charger's register space to
set charger mode depending on the power role. As MAX77759 chg driver
exists, this WAR is not required.
Instead, use a regulator interface to source vbus when typec is in
source power mode. In other power modes, this regulator will be turned
off if active.
Signed-off-by: Amit Sunil Dhamne <amitsd@google.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: André Draszik <andre.draszik@linaro.org>
---
drivers/usb/typec/tcpm/tcpci_maxim.h | 1 +
drivers/usb/typec/tcpm/tcpci_maxim_core.c | 54 +++++++++++++++++++------------
2 files changed, 34 insertions(+), 21 deletions(-)
diff --git a/drivers/usb/typec/tcpm/tcpci_maxim.h b/drivers/usb/typec/tcpm/tcpci_maxim.h
index b33540a42a95..b314606eb0f6 100644
--- a/drivers/usb/typec/tcpm/tcpci_maxim.h
+++ b/drivers/usb/typec/tcpm/tcpci_maxim.h
@@ -60,6 +60,7 @@ struct max_tcpci_chip {
struct tcpm_port *port;
enum contamiant_state contaminant_state;
bool veto_vconn_swap;
+ struct regulator *vbus_reg;
};
static inline int max_tcpci_read16(struct max_tcpci_chip *chip, unsigned int reg, u16 *val)
diff --git a/drivers/usb/typec/tcpm/tcpci_maxim_core.c b/drivers/usb/typec/tcpm/tcpci_maxim_core.c
index 19f638650796..e9e2405c5ca0 100644
--- a/drivers/usb/typec/tcpm/tcpci_maxim_core.c
+++ b/drivers/usb/typec/tcpm/tcpci_maxim_core.c
@@ -10,6 +10,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/regmap.h>
+#include <linux/regulator/consumer.h>
#include <linux/usb/pd.h>
#include <linux/usb/tcpci.h>
#include <linux/usb/tcpm.h>
@@ -35,12 +36,6 @@
*/
#define TCPC_RECEIVE_BUFFER_LEN 32
-#define MAX_BUCK_BOOST_SID 0x69
-#define MAX_BUCK_BOOST_OP 0xb9
-#define MAX_BUCK_BOOST_OFF 0
-#define MAX_BUCK_BOOST_SOURCE 0xa
-#define MAX_BUCK_BOOST_SINK 0x5
-
static const struct regmap_range max_tcpci_tcpci_range[] = {
regmap_reg_range(0x00, 0x95)
};
@@ -202,32 +197,49 @@ static void process_rx(struct max_tcpci_chip *chip, u16 status)
tcpm_pd_receive(chip->port, &msg, rx_type);
}
+static int get_vbus_regulator_handle(struct max_tcpci_chip *chip)
+{
+ if (IS_ERR_OR_NULL(chip->vbus_reg)) {
+ chip->vbus_reg = devm_regulator_get_exclusive(chip->dev,
+ "vbus");
+ if (IS_ERR_OR_NULL(chip->vbus_reg)) {
+ dev_err(chip->dev,
+ "Failed to get vbus regulator handle");
+ return -ENODEV;
+ }
+ }
+
+ return 0;
+}
+
static int max_tcpci_set_vbus(struct tcpci *tcpci, struct tcpci_data *tdata, bool source, bool sink)
{
struct max_tcpci_chip *chip = tdata_to_max_tcpci(tdata);
- u8 buffer_source[2] = {MAX_BUCK_BOOST_OP, MAX_BUCK_BOOST_SOURCE};
- u8 buffer_sink[2] = {MAX_BUCK_BOOST_OP, MAX_BUCK_BOOST_SINK};
- u8 buffer_none[2] = {MAX_BUCK_BOOST_OP, MAX_BUCK_BOOST_OFF};
- struct i2c_client *i2c = chip->client;
int ret;
- struct i2c_msg msgs[] = {
- {
- .addr = MAX_BUCK_BOOST_SID,
- .flags = i2c->flags & I2C_M_TEN,
- .len = 2,
- .buf = source ? buffer_source : sink ? buffer_sink : buffer_none,
- },
- };
-
if (source && sink) {
dev_err(chip->dev, "Both source and sink set\n");
return -EINVAL;
}
- ret = i2c_transfer(i2c->adapter, msgs, 1);
+ ret = get_vbus_regulator_handle(chip);
+ if (ret) {
+ /*
+ * Regulator is not necessary for sink only applications. Return
+ * success in cases where sink mode is being modified.
+ */
+ return source ? ret : 1;
+ }
+
+ if (source) {
+ if (!regulator_is_enabled(chip->vbus_reg))
+ ret = regulator_enable(chip->vbus_reg);
+ } else {
+ if (regulator_is_enabled(chip->vbus_reg))
+ ret = regulator_disable(chip->vbus_reg);
+ }
- return ret < 0 ? ret : 1;
+ return ret < 0 ? ret : 1;
}
static void process_power_status(struct max_tcpci_chip *chip)
--
2.53.0.273.g2a3d683680-goog
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH v6 5/6] power: supply: max77759: add charger driver
2026-02-14 3:12 ` [PATCH v6 5/6] power: supply: max77759: add charger driver Amit Sunil Dhamne via B4 Relay
@ 2026-02-14 8:56 ` kernel test robot
2026-02-17 13:14 ` André Draszik
1 sibling, 0 replies; 15+ messages in thread
From: kernel test robot @ 2026-02-14 8:56 UTC (permalink / raw)
To: Amit Sunil Dhamne via B4 Relay, Sebastian Reichel, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, André Draszik, Lee Jones,
Greg Kroah-Hartman, Badhri Jagan Sridharan, Heikki Krogerus,
Peter Griffin, Tudor Ambarus, Alim Akhtar, Mark Brown,
Matti Vaittinen, Matti Vaittinen, Andrew Morton
Cc: llvm, oe-kbuild-all, Linux Memory Management List, linux-kernel,
linux-pm, devicetree, linux-usb, linux-arm-kernel,
linux-samsung-soc, RD Babiera, Kyle Tso, Amit Sunil Dhamne
Hi Amit,
kernel test robot noticed the following build errors:
[auto build test ERROR on 8dfce8991b95d8625d0a1d2896e42f93b9d7f68d]
url: https://github.com/intel-lab-lkp/linux/commits/Amit-Sunil-Dhamne-via-B4-Relay/dt-bindings-mfd-maxim-max77759-reference-power-supply-schema-and-add-regulator-property/20260214-111637
base: 8dfce8991b95d8625d0a1d2896e42f93b9d7f68d
patch link: https://lore.kernel.org/r/20260214-max77759-charger-v6-5-28c09bda74b4%40google.com
patch subject: [PATCH v6 5/6] power: supply: max77759: add charger driver
config: powerpc64-randconfig-001-20260214 (https://download.01.org/0day-ci/archive/20260214/202602141606.igFDFWAJ-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 9b8addffa70cee5b2acc5454712d9cf78ce45710)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260214/202602141606.igFDFWAJ-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202602141606.igFDFWAJ-lkp@intel.com/
All errors (new ones prefixed by >>):
>> drivers/power/supply/max77759_charger.c:623:4: error: cannot jump from this goto statement to its label
623 | goto err;
| ^
drivers/power/supply/max77759_charger.c:631:2: note: jump bypasses initialization of variable with __attribute__((cleanup))
631 | guard(mutex)(&chg->retry_lock);
| ^
include/linux/cleanup.h:414:15: note: expanded from macro 'guard'
414 | CLASS(_name, __UNIQUE_ID(guard))
| ^
include/linux/compiler.h:168:2: note: expanded from macro '__UNIQUE_ID'
168 | __PASTE(__UNIQUE_ID_, \
| ^
include/linux/compiler_types.h:16:23: note: expanded from macro '__PASTE'
16 | #define __PASTE(a, b) ___PASTE(a, b)
| ^
include/linux/compiler_types.h:15:24: note: expanded from macro '___PASTE'
15 | #define ___PASTE(a, b) a##b
| ^
<scratch space>:18:1: note: expanded from here
18 | __UNIQUE_ID_guard_461
| ^
drivers/power/supply/max77759_charger.c:615:3: error: cannot jump from this goto statement to its label
615 | goto err;
| ^
drivers/power/supply/max77759_charger.c:631:2: note: jump bypasses initialization of variable with __attribute__((cleanup))
631 | guard(mutex)(&chg->retry_lock);
| ^
include/linux/cleanup.h:414:15: note: expanded from macro 'guard'
414 | CLASS(_name, __UNIQUE_ID(guard))
| ^
include/linux/compiler.h:168:2: note: expanded from macro '__UNIQUE_ID'
168 | __PASTE(__UNIQUE_ID_, \
| ^
include/linux/compiler_types.h:16:23: note: expanded from macro '__PASTE'
16 | #define __PASTE(a, b) ___PASTE(a, b)
| ^
include/linux/compiler_types.h:15:24: note: expanded from macro '___PASTE'
15 | #define ___PASTE(a, b) a##b
| ^
<scratch space>:18:1: note: expanded from here
18 | __UNIQUE_ID_guard_461
| ^
drivers/power/supply/max77759_charger.c:606:3: error: cannot jump from this goto statement to its label
606 | goto err;
| ^
drivers/power/supply/max77759_charger.c:631:2: note: jump bypasses initialization of variable with __attribute__((cleanup))
631 | guard(mutex)(&chg->retry_lock);
| ^
include/linux/cleanup.h:414:15: note: expanded from macro 'guard'
414 | CLASS(_name, __UNIQUE_ID(guard))
| ^
include/linux/compiler.h:168:2: note: expanded from macro '__UNIQUE_ID'
168 | __PASTE(__UNIQUE_ID_, \
| ^
include/linux/compiler_types.h:16:23: note: expanded from macro '__PASTE'
16 | #define __PASTE(a, b) ___PASTE(a, b)
| ^
include/linux/compiler_types.h:15:24: note: expanded from macro '___PASTE'
15 | #define ___PASTE(a, b) a##b
| ^
<scratch space>:18:1: note: expanded from here
18 | __UNIQUE_ID_guard_461
| ^
3 errors generated.
vim +623 drivers/power/supply/max77759_charger.c
591
592 static void psy_work_item(struct work_struct *work)
593 {
594 struct max77759_charger *chg =
595 container_of(work, struct max77759_charger, psy_work.work);
596 union power_supply_propval current_limit, online;
597 int ret;
598
599 ret = power_supply_get_property(chg->tcpm_psy,
600 POWER_SUPPLY_PROP_CURRENT_MAX,
601 ¤t_limit);
602 if (ret) {
603 dev_err(chg->dev,
604 "Failed to get CURRENT_MAX psy property, ret=%d",
605 ret);
606 goto err;
607 }
608
609 ret = power_supply_get_property(chg->tcpm_psy, POWER_SUPPLY_PROP_ONLINE,
610 &online);
611 if (ret) {
612 dev_err(chg->dev,
613 "Failed to get ONLINE psy property, ret=%d",
614 ret);
615 goto err;
616 }
617
618 if (online.intval && current_limit.intval) {
619 ret = set_input_current_limit(chg, current_limit.intval);
620 if (ret) {
621 dev_err(chg->dev,
622 "Unable to set current limit, ret=%d", ret);
> 623 goto err;
624 }
625
626 charger_set_mode(chg, MAX77759_CHGR_MODE_CHG_BUCK_ON);
627 } else {
628 charger_set_mode(chg, MAX77759_CHGR_MODE_OFF);
629 }
630
631 guard(mutex)(&chg->retry_lock);
632
633 if (chg->psy_work_retry_cnt)
634 dev_dbg(chg->dev, "chg psy_work succeeded after %u tries",
635 chg->psy_work_retry_cnt);
636 chg->psy_work_retry_cnt = 0;
637 return;
638
639 err:
640 charger_set_mode(chg, MAX77759_CHGR_MODE_OFF);
641 guard(mutex)(&chg->retry_lock);
642
643 if (chg->psy_work_retry_cnt >= MAX_NUM_RETRIES) {
644 dev_err(chg->dev, "chg psy work failed, giving up");
645 return;
646 }
647
648 ++chg->psy_work_retry_cnt;
649 dev_dbg(chg->dev, "Retrying %u/%u chg psy_work",
650 chg->psy_work_retry_cnt, MAX_NUM_RETRIES);
651 schedule_delayed_work(&chg->psy_work,
652 msecs_to_jiffies(PSY_WORK_RETRY_DELAY_MS));
653 }
654
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v6 4/6] lib/linear_ranges: Add linear_range_get_selector_high_array
2026-02-14 3:12 ` [PATCH v6 4/6] lib/linear_ranges: Add linear_range_get_selector_high_array Amit Sunil Dhamne via B4 Relay
@ 2026-02-16 13:58 ` Matti Vaittinen
2026-02-18 1:45 ` Amit Sunil Dhamne
0 siblings, 1 reply; 15+ messages in thread
From: Matti Vaittinen @ 2026-02-16 13:58 UTC (permalink / raw)
To: amitsd, Sebastian Reichel, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, André Draszik, Lee Jones, Greg Kroah-Hartman,
Badhri Jagan Sridharan, Heikki Krogerus, Peter Griffin,
Tudor Ambarus, Alim Akhtar, Mark Brown, Andrew Morton
Cc: linux-kernel, linux-pm, devicetree, linux-usb, linux-arm-kernel,
linux-samsung-soc, RD Babiera, Kyle Tso
On 14/02/2026 05:12, Amit Sunil Dhamne via B4 Relay wrote:
> From: Amit Sunil Dhamne <amitsd@google.com>
>
> Add a helper function to find the selector for a given value in a linear
> range array. The selector should be such that the value it represents
> should be higher or equal to the given value.
>
> Signed-off-by: Amit Sunil Dhamne <amitsd@google.com>
> ---
> include/linux/linear_range.h | 3 +++
> lib/linear_ranges.c | 36 ++++++++++++++++++++++++++++++++++++
> 2 files changed, 39 insertions(+)
>
> diff --git a/include/linux/linear_range.h b/include/linux/linear_range.h
> index 2e4f4c3539c0..0f3037f1a94f 100644
> --- a/include/linux/linear_range.h
> +++ b/include/linux/linear_range.h
> @@ -57,5 +57,8 @@ void linear_range_get_selector_within(const struct linear_range *r,
> int linear_range_get_selector_low_array(const struct linear_range *r,
> int ranges, unsigned int val,
> unsigned int *selector, bool *found);
> +int linear_range_get_selector_high_array(const struct linear_range *r,
> + int ranges, unsigned int val,
> + unsigned int *selector, bool *found);
>
> #endif
> diff --git a/lib/linear_ranges.c b/lib/linear_ranges.c
> index a1a7dfa881de..c85583678f6b 100644
> --- a/lib/linear_ranges.c
> +++ b/lib/linear_ranges.c
> @@ -241,6 +241,42 @@ int linear_range_get_selector_high(const struct linear_range *r,
> }
> EXPORT_SYMBOL_GPL(linear_range_get_selector_high);
>
> +/**
> + * linear_range_get_selector_high_array - return linear range selector for value
> + * @r: pointer to array of linear ranges where selector is looked from
> + * @ranges: amount of ranges to scan from array
> + * @val: value for which the selector is searched
> + * @selector: address where found selector value is updated
> + * @found: flag to indicate that given value was in the range
> + *
> + * Scan array of ranges for selector for which range value matches given
> + * input value. Value is matching if it is equal or higher than given value
> + * If given value is found to be in a range scanning is stopped and @found is
> + * set true. If a range with values greater than given value is found
> + * but the range min is being greater than given value, then the range's
> + * lowest selector is updated to @selector and scanning is stopped.
Is there a reason why the scanning is stopped here? What ensures that
the rest of the ranges wouldn't contain a better match?
The logic is now different from the
linear_range_get_selector_low_array(), and I would like to understand
why? It'd be nice if these APIs were 'symmetric' to avoid confusion.
Hence, I would like to know rationale behind making them different.
> + *
> + * Return: 0 on success, -EINVAL if range array is invalid or does not contain
> + * range with a value greater or equal to given value
> + */
> +int linear_range_get_selector_high_array(const struct linear_range *r,
> + int ranges, unsigned int val,
> + unsigned int *selector, bool *found)
> +{
> + int i;
> + int ret;
> +
> + for (i = 0; i < ranges; i++) {
> + ret = linear_range_get_selector_high(&r[i], val, selector,
> + found);
> + if (!ret)
> + return 0;
> + }
> +
> + return -EINVAL;
> +}
> +EXPORT_SYMBOL_GPL(linear_range_get_selector_high_array);
> +
> /**
> * linear_range_get_selector_within - return linear range selector for value
> * @r: pointer to linear range where selector is looked from
>
--
---
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland
~~ When things go utterly wrong vim users can always type :help! ~~
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v6 3/6] mfd: max77759: add register bitmasks and modify irq configs for charger
2026-02-14 3:12 ` [PATCH v6 3/6] mfd: max77759: add register bitmasks and modify irq configs for charger Amit Sunil Dhamne via B4 Relay
@ 2026-02-17 12:30 ` André Draszik
0 siblings, 0 replies; 15+ messages in thread
From: André Draszik @ 2026-02-17 12:30 UTC (permalink / raw)
To: amitsd, Sebastian Reichel, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Lee Jones, Greg Kroah-Hartman,
Badhri Jagan Sridharan, Heikki Krogerus, Peter Griffin,
Tudor Ambarus, Alim Akhtar, Mark Brown, Matti Vaittinen,
Andrew Morton
Cc: linux-kernel, linux-pm, devicetree, linux-usb, linux-arm-kernel,
linux-samsung-soc, RD Babiera, Kyle Tso
On Sat, 2026-02-14 at 03:12 +0000, Amit Sunil Dhamne via B4 Relay wrote:
> From: Amit Sunil Dhamne <amitsd@google.com>
>
> Add register bitmasks for charger function.
> In addition split the charger IRQs further such that each bit represents
> an IRQ downstream of charger regmap irq chip. In addition populate the
> ack_base to offload irq ack to the regmap irq chip framework.
>
> Signed-off-by: Amit Sunil Dhamne <amitsd@google.com>
> ---
> drivers/mfd/max77759.c | 91 ++++++++++++++++++++--
> include/linux/mfd/max77759.h | 176 ++++++++++++++++++++++++++++++++++++-------
> 2 files changed, 230 insertions(+), 37 deletions(-)
Reviewed-by: André Draszik <andre.draszik@linaro.org>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v6 5/6] power: supply: max77759: add charger driver
2026-02-14 3:12 ` [PATCH v6 5/6] power: supply: max77759: add charger driver Amit Sunil Dhamne via B4 Relay
2026-02-14 8:56 ` kernel test robot
@ 2026-02-17 13:14 ` André Draszik
2026-02-18 5:35 ` Amit Sunil Dhamne
1 sibling, 1 reply; 15+ messages in thread
From: André Draszik @ 2026-02-17 13:14 UTC (permalink / raw)
To: amitsd, Sebastian Reichel, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Lee Jones, Greg Kroah-Hartman,
Badhri Jagan Sridharan, Heikki Krogerus, Peter Griffin,
Tudor Ambarus, Alim Akhtar, Mark Brown, Matti Vaittinen,
Andrew Morton
Cc: linux-kernel, linux-pm, devicetree, linux-usb, linux-arm-kernel,
linux-samsung-soc, RD Babiera, Kyle Tso
Hi Amit,
All below comments are only minor, feel free to ignore them.
On Sat, 2026-02-14 at 03:12 +0000, Amit Sunil Dhamne via B4 Relay wrote:
> From: Amit Sunil Dhamne <amitsd@google.com>
>
> Add support for MAX77759 battery charger driver. This is a 4A 1-Cell
> Li+/LiPoly dual input switch mode charger. While the device can support
> USB & wireless charger inputs, this implementation only supports USB
> input. This implementation supports both buck and boost modes.
>
> Signed-off-by: Amit Sunil Dhamne <amitsd@google.com>
> ---
> MAINTAINERS | 6 +
> drivers/power/supply/Kconfig | 11 +
> drivers/power/supply/Makefile | 1 +
> drivers/power/supply/max77759_charger.c | 768 ++++++++++++++++++++++++++++++++
> 4 files changed, 786 insertions(+)
[...]
> diff --git a/drivers/power/supply/max77759_charger.c b/drivers/power/supply/max77759_charger.c
> new file mode 100644
> index 000000000000..d4e02764ba04
> --- /dev/null
> +++ b/drivers/power/supply/max77759_charger.c
> @@ -0,0 +1,768 @@
[...]
> +
> +/* USB input current limits (in uA) */
> +static const struct linear_range chgin_ilim_ranges[] = {
> + LINEAR_RANGE(100000, 0x3, 0x7F, 25000),
> +};
Shouldn't this one also have a entry for 0x00...0x02:
LINEAR_RANGE(100000, 0x0, 0x2, 0),
Then you can also drop the umax() call in get_input_current_limit().
Ah, I see now there is no linear_range_get_selector_within_array(),
meaning the code is fine as-is, unless you want to add that as
well :-)
[...]
> +static int max77759_charger_init(struct max77759_charger *chg)
> +{
> + struct power_supply_battery_info *info;
> + u32 regval, fast_chg_curr, fv;
> + int ret;
> +
> + ret = regmap_read(chg->regmap, MAX77759_CHGR_REG_CHG_CNFG_00, ®val);
> + if (ret)
> + return ret;
> +
> + chg->mode = FIELD_GET(MAX77759_CHGR_REG_CHG_CNFG_00_MODE, regval);
> + ret = charger_set_mode(chg, MAX77759_CHGR_MODE_OFF);
> + if (ret)
> + return ret;
> +
> + if (power_supply_get_battery_info(chg->psy, &info)) {
> + fv = CHG_FV_DEFAULT_MV;
> + fast_chg_curr = CHG_CC_DEFAULT_UA;
> + } else {
> + fv = info->constant_charge_voltage_max_uv / 1000;
> + fast_chg_curr = info->constant_charge_current_max_ua;
> + }
> +
> + ret = set_fast_charge_current_limit(chg, fast_chg_curr);
> + if (ret)
> + return ret;
> +
> + ret = set_float_voltage_limit(chg, fv);
> + if (ret)
> + return ret;
> +
> + ret = unlock_prot_regs(chg, true);
> + if (ret)
> + return ret;
> +
> + /* Disable wireless charging input */
> + ret = regmap_update_bits(chg->regmap, MAX77759_CHGR_REG_CHG_CNFG_12,
> + MAX77759_CHGR_REG_CHG_CNFG_12_WCINSEL, 0);
> + if (ret)
> + return ret;
> +
> + ret = regmap_update_bits(chg->regmap, MAX77759_CHGR_REG_CHG_CNFG_18,
> + MAX77759_CHGR_REG_CHG_CNFG_18_WDTEN, 0);
> + if (ret)
> + return ret;
> +
> + return unlock_prot_regs(chg, false);
Should early error returns here try to lock the protection again? Something
like:
+ ret = unlock_prot_regs(chg, true);
+ if (ret)
+ return ret;
+
+ /* Disable wireless charging input */
+ ret = regmap_update_bits(chg->regmap, MAX77759_CHGR_REG_CHG_CNFG_12,
+ MAX77759_CHGR_REG_CHG_CNFG_12_WCINSEL, 0);
+ if (ret)
+ goto relock;
+
+ ret = regmap_update_bits(chg->regmap, MAX77759_CHGR_REG_CHG_CNFG_18,
+ MAX77759_CHGR_REG_CHG_CNFG_18_WDTEN, 0);
+ if (ret)
+ goto relock;
+
+ return unlock_prot_regs(chg, false);
+
+relock:
+ (void) unlock_prot_regs(chg, false);
+ return ret;
I guess if one of the regmap_update_bits() failed, then locking the
registers might not work either, so I have no strong opinion on
adding that.
With or without updates:
Reviewed-by: André Draszik <andre.draszik@linaro.org>
Cheers,
Andre'
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v6 4/6] lib/linear_ranges: Add linear_range_get_selector_high_array
2026-02-16 13:58 ` Matti Vaittinen
@ 2026-02-18 1:45 ` Amit Sunil Dhamne
2026-02-18 8:17 ` Matti Vaittinen
0 siblings, 1 reply; 15+ messages in thread
From: Amit Sunil Dhamne @ 2026-02-18 1:45 UTC (permalink / raw)
To: Matti Vaittinen, Sebastian Reichel, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, André Draszik, Lee Jones,
Greg Kroah-Hartman, Badhri Jagan Sridharan, Heikki Krogerus,
Peter Griffin, Tudor Ambarus, Alim Akhtar, Mark Brown,
Andrew Morton
Cc: linux-kernel, linux-pm, devicetree, linux-usb, linux-arm-kernel,
linux-samsung-soc, RD Babiera, Kyle Tso
On 2/16/26 5:58 AM, Matti Vaittinen wrote:
> On 14/02/2026 05:12, Amit Sunil Dhamne via B4 Relay wrote:
>> From: Amit Sunil Dhamne <amitsd@google.com>
>>
>> Add a helper function to find the selector for a given value in a linear
>> range array. The selector should be such that the value it represents
>> should be higher or equal to the given value.
>>
>> Signed-off-by: Amit Sunil Dhamne <amitsd@google.com>
>> ---
>> include/linux/linear_range.h | 3 +++
>> lib/linear_ranges.c | 36 ++++++++++++++++++++++++++++++++++++
>> 2 files changed, 39 insertions(+)
>>
>> diff --git a/include/linux/linear_range.h b/include/linux/linear_range.h
>> index 2e4f4c3539c0..0f3037f1a94f 100644
>> --- a/include/linux/linear_range.h
>> +++ b/include/linux/linear_range.h
>> @@ -57,5 +57,8 @@ void linear_range_get_selector_within(const struct
>> linear_range *r,
>> int linear_range_get_selector_low_array(const struct linear_range *r,
>> int ranges, unsigned int val,
>> unsigned int *selector, bool *found);
>> +int linear_range_get_selector_high_array(const struct linear_range *r,
>> + int ranges, unsigned int val,
>> + unsigned int *selector, bool *found);
>> #endif
>> diff --git a/lib/linear_ranges.c b/lib/linear_ranges.c
>> index a1a7dfa881de..c85583678f6b 100644
>> --- a/lib/linear_ranges.c
>> +++ b/lib/linear_ranges.c
>> @@ -241,6 +241,42 @@ int linear_range_get_selector_high(const struct
>> linear_range *r,
>> }
>> EXPORT_SYMBOL_GPL(linear_range_get_selector_high);
>> +/**
>> + * linear_range_get_selector_high_array - return linear range
>> selector for value
>> + * @r: pointer to array of linear ranges where selector is
>> looked from
>> + * @ranges: amount of ranges to scan from array
>> + * @val: value for which the selector is searched
>> + * @selector: address where found selector value is updated
>> + * @found: flag to indicate that given value was in the range
>> + *
>> + * Scan array of ranges for selector for which range value matches
>> given
>> + * input value. Value is matching if it is equal or higher than
>> given value
>> + * If given value is found to be in a range scanning is stopped and
>> @found is
>> + * set true. If a range with values greater than given value is found
>> + * but the range min is being greater than given value, then the
>> range's
>> + * lowest selector is updated to @selector and scanning is stopped.
>
> Is there a reason why the scanning is stopped here? What ensures that
> the rest of the ranges wouldn't contain a better match?
>
> The logic is now different from the
> linear_range_get_selector_low_array(), and I would like to understand
> why? It'd be nice if these APIs were 'symmetric' to avoid confusion.
> Hence, I would like to know rationale behind making them different.
The rationale for this being asymmetric is to find the tightest upper
bound for `value` < minimum value across the linear range array.
To better illustrate this with an example. I have 2 entries in the
linear range array [ [4, 8], [11, 15] ]. Let's assume I pass a value of "2".
Based on my current approach, the call to get_selector_high() would
successfully return with `found`=false and a selector value
corresponding to "4".
However, if I continued to search, I would end up the selector
corresponding to "11". A selector corresponding to "4" is much
closer/tighter than "2".
For values higher than the highest value in any range, this would keep
iterating and end up returning an -EINVAL.
For in range values this would work as expected.
This implementation assumes that the linear ranges are provided in
sorted order, an assumption that I believe already underlies the
existing *_low_array() logic.
Regards,
Amit
>
>> + *
>> + * Return: 0 on success, -EINVAL if range array is invalid or does
>> not contain
>> + * range with a value greater or equal to given value
>> + */
>> +int linear_range_get_selector_high_array(const struct linear_range *r,
>> + int ranges, unsigned int val,
>> + unsigned int *selector, bool *found)
>> +{
>> + int i;
>> + int ret;
>> +
>> + for (i = 0; i < ranges; i++) {
>> + ret = linear_range_get_selector_high(&r[i], val, selector,
>> + found);
>> + if (!ret)
>> + return 0;
>> + }
>> +
>> + return -EINVAL;
>> +}
>> +EXPORT_SYMBOL_GPL(linear_range_get_selector_high_array);
>> +
>> /**
>> * linear_range_get_selector_within - return linear range selector
>> for value
>> * @r: pointer to linear range where selector is looked from
>>
>
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v6 5/6] power: supply: max77759: add charger driver
2026-02-17 13:14 ` André Draszik
@ 2026-02-18 5:35 ` Amit Sunil Dhamne
0 siblings, 0 replies; 15+ messages in thread
From: Amit Sunil Dhamne @ 2026-02-18 5:35 UTC (permalink / raw)
To: André Draszik, Sebastian Reichel, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Lee Jones, Greg Kroah-Hartman,
Badhri Jagan Sridharan, Heikki Krogerus, Peter Griffin,
Tudor Ambarus, Alim Akhtar, Mark Brown, Matti Vaittinen,
Andrew Morton
Cc: linux-kernel, linux-pm, devicetree, linux-usb, linux-arm-kernel,
linux-samsung-soc, RD Babiera, Kyle Tso
Hi André,
On 2/17/26 5:14 AM, André Draszik wrote:
> Hi Amit,
>
> All below comments are only minor, feel free to ignore them.
>
> On Sat, 2026-02-14 at 03:12 +0000, Amit Sunil Dhamne via B4 Relay wrote:
>> From: Amit Sunil Dhamne <amitsd@google.com>
>>
>> Add support for MAX77759 battery charger driver. This is a 4A 1-Cell
>> Li+/LiPoly dual input switch mode charger. While the device can support
>> USB & wireless charger inputs, this implementation only supports USB
>> input. This implementation supports both buck and boost modes.
>>
>> Signed-off-by: Amit Sunil Dhamne <amitsd@google.com>
>> ---
>> MAINTAINERS | 6 +
>> drivers/power/supply/Kconfig | 11 +
>> drivers/power/supply/Makefile | 1 +
>> drivers/power/supply/max77759_charger.c | 768 ++++++++++++++++++++++++++++++++
>> 4 files changed, 786 insertions(+)
> [...]
>
>> diff --git a/drivers/power/supply/max77759_charger.c b/drivers/power/supply/max77759_charger.c
>> new file mode 100644
>> index 000000000000..d4e02764ba04
>> --- /dev/null
>> +++ b/drivers/power/supply/max77759_charger.c
>> @@ -0,0 +1,768 @@
> [...]
>
>> +
>> +/* USB input current limits (in uA) */
>> +static const struct linear_range chgin_ilim_ranges[] = {
>> + LINEAR_RANGE(100000, 0x3, 0x7F, 25000),
>> +};
> Shouldn't this one also have a entry for 0x00...0x02:
> LINEAR_RANGE(100000, 0x0, 0x2, 0),
>
> Then you can also drop the umax() call in get_input_current_limit().
>
> Ah, I see now there is no linear_range_get_selector_within_array(),
> meaning the code is fine as-is, unless you want to add that as
> well :-)
>
>
> [...]
I would go with the code being as is for now. :-)
>
>> +static int max77759_charger_init(struct max77759_charger *chg)
>> +{
>> + struct power_supply_battery_info *info;
>> + u32 regval, fast_chg_curr, fv;
>> + int ret;
>> +
>> + ret = regmap_read(chg->regmap, MAX77759_CHGR_REG_CHG_CNFG_00, ®val);
>> + if (ret)
>> + return ret;
>> +
>> + chg->mode = FIELD_GET(MAX77759_CHGR_REG_CHG_CNFG_00_MODE, regval);
>> + ret = charger_set_mode(chg, MAX77759_CHGR_MODE_OFF);
>> + if (ret)
>> + return ret;
>> +
>> + if (power_supply_get_battery_info(chg->psy, &info)) {
>> + fv = CHG_FV_DEFAULT_MV;
>> + fast_chg_curr = CHG_CC_DEFAULT_UA;
>> + } else {
>> + fv = info->constant_charge_voltage_max_uv / 1000;
>> + fast_chg_curr = info->constant_charge_current_max_ua;
>> + }
>> +
>> + ret = set_fast_charge_current_limit(chg, fast_chg_curr);
>> + if (ret)
>> + return ret;
>> +
>> + ret = set_float_voltage_limit(chg, fv);
>> + if (ret)
>> + return ret;
>> +
>> + ret = unlock_prot_regs(chg, true);
>> + if (ret)
>> + return ret;
>> +
>> + /* Disable wireless charging input */
>> + ret = regmap_update_bits(chg->regmap, MAX77759_CHGR_REG_CHG_CNFG_12,
>> + MAX77759_CHGR_REG_CHG_CNFG_12_WCINSEL, 0);
>> + if (ret)
>> + return ret;
>> +
>> + ret = regmap_update_bits(chg->regmap, MAX77759_CHGR_REG_CHG_CNFG_18,
>> + MAX77759_CHGR_REG_CHG_CNFG_18_WDTEN, 0);
>> + if (ret)
>> + return ret;
>> +
>> + return unlock_prot_regs(chg, false);
> Should early error returns here try to lock the protection again? Something
> like:
>
> + ret = unlock_prot_regs(chg, true);
> + if (ret)
> + return ret;
> +
> + /* Disable wireless charging input */
> + ret = regmap_update_bits(chg->regmap, MAX77759_CHGR_REG_CHG_CNFG_12,
> + MAX77759_CHGR_REG_CHG_CNFG_12_WCINSEL, 0);
> + if (ret)
> + goto relock;
> +
> + ret = regmap_update_bits(chg->regmap, MAX77759_CHGR_REG_CHG_CNFG_18,
> + MAX77759_CHGR_REG_CHG_CNFG_18_WDTEN, 0);
> + if (ret)
> + goto relock;
> +
> + return unlock_prot_regs(chg, false);
> +
> +relock:
> + (void) unlock_prot_regs(chg, false);
> + return ret;
>
> I guess if one of the regmap_update_bits() failed, then locking the
> registers might not work either, so I have no strong opinion on
> adding that.
Nice catch!
I need to send a next revision to keep the Linux Test Robot happy. I
will address this issue in that.
>
> With or without updates:
>
> Reviewed-by: André Draszik <andre.draszik@linaro.org>
>
LGTM! Thanks!
Regards,
Amit
> Cheers,
> Andre'
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v6 4/6] lib/linear_ranges: Add linear_range_get_selector_high_array
2026-02-18 1:45 ` Amit Sunil Dhamne
@ 2026-02-18 8:17 ` Matti Vaittinen
2026-02-18 20:05 ` Amit Sunil Dhamne
0 siblings, 1 reply; 15+ messages in thread
From: Matti Vaittinen @ 2026-02-18 8:17 UTC (permalink / raw)
To: Amit Sunil Dhamne, Sebastian Reichel, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, André Draszik, Lee Jones,
Greg Kroah-Hartman, Badhri Jagan Sridharan, Heikki Krogerus,
Peter Griffin, Tudor Ambarus, Alim Akhtar, Mark Brown,
Andrew Morton
Cc: linux-kernel, linux-pm, devicetree, linux-usb, linux-arm-kernel,
linux-samsung-soc, RD Babiera, Kyle Tso
On 18/02/2026 03:45, Amit Sunil Dhamne wrote:
>
> On 2/16/26 5:58 AM, Matti Vaittinen wrote:
>> On 14/02/2026 05:12, Amit Sunil Dhamne via B4 Relay wrote:
>>> From: Amit Sunil Dhamne <amitsd@google.com>
// snip
>>> --- a/lib/linear_ranges.c
>>> +++ b/lib/linear_ranges.c
>>> @@ -241,6 +241,42 @@ int linear_range_get_selector_high(const struct
>>> linear_range *r,
>>> }
>>> EXPORT_SYMBOL_GPL(linear_range_get_selector_high);
>>> +/**
>>> + * linear_range_get_selector_high_array - return linear range
>>> selector for value
>>> + * @r: pointer to array of linear ranges where selector is
>>> looked from
>>> + * @ranges: amount of ranges to scan from array
>>> + * @val: value for which the selector is searched
>>> + * @selector: address where found selector value is updated
>>> + * @found: flag to indicate that given value was in the range
>>> + *
>>> + * Scan array of ranges for selector for which range value matches
>>> given
>>> + * input value. Value is matching if it is equal or higher than
>>> given value
>>> + * If given value is found to be in a range scanning is stopped and
>>> @found is
>>> + * set true. If a range with values greater than given value is found
>>> + * but the range min is being greater than given value, then the
>>> range's
>>> + * lowest selector is updated to @selector and scanning is stopped.
>>
>> Is there a reason why the scanning is stopped here? What ensures that
>> the rest of the ranges wouldn't contain a better match?
>>
>> The logic is now different from the
>> linear_range_get_selector_low_array(), and I would like to understand
>> why? It'd be nice if these APIs were 'symmetric' to avoid confusion.
>> Hence, I would like to know rationale behind making them different.
>
>
> The rationale for this being asymmetric is to find the tightest upper
> bound for `value` < minimum value across the linear range array.
>
> To better illustrate this with an example. I have 2 entries in the
> linear range array [ [4, 8], [11, 15] ]. Let's assume I pass a value of
> "2".
>
> Based on my current approach, the call to get_selector_high() would
> successfully return with `found`=false and a selector value
> corresponding to "4".
>
> However, if I continued to search, I would end up the selector
> corresponding to "11". A selector corresponding to "4" is much closer/
> tighter than "2".
>
> For values higher than the highest value in any range, this would keep
> iterating and end up returning an -EINVAL.
>
> For in range values this would work as expected.
>
> This implementation assumes that the linear ranges are provided in
> sorted order, an assumption that I believe already underlies the
> existing *_low_array() logic.
Ah. I think ... I didn't think. :)
It definitely makes sense to stop scanning if the range_min already was
greater than the given target value. Thanks for the patience and for
adding this missing piece :)
Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com>
---
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland
~~ When things go utterly wrong vim users can always type :help! ~~
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v6 4/6] lib/linear_ranges: Add linear_range_get_selector_high_array
2026-02-18 8:17 ` Matti Vaittinen
@ 2026-02-18 20:05 ` Amit Sunil Dhamne
0 siblings, 0 replies; 15+ messages in thread
From: Amit Sunil Dhamne @ 2026-02-18 20:05 UTC (permalink / raw)
To: Matti Vaittinen, Sebastian Reichel, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, André Draszik, Lee Jones,
Greg Kroah-Hartman, Badhri Jagan Sridharan, Heikki Krogerus,
Peter Griffin, Tudor Ambarus, Alim Akhtar, Mark Brown,
Andrew Morton
Cc: linux-kernel, linux-pm, devicetree, linux-usb, linux-arm-kernel,
linux-samsung-soc, RD Babiera, Kyle Tso
On 2/18/26 12:17 AM, Matti Vaittinen wrote:
> On 18/02/2026 03:45, Amit Sunil Dhamne wrote:
>>
>> On 2/16/26 5:58 AM, Matti Vaittinen wrote:
>>> On 14/02/2026 05:12, Amit Sunil Dhamne via B4 Relay wrote:
>>>> From: Amit Sunil Dhamne <amitsd@google.com>
>
> // snip
>
>>>> --- a/lib/linear_ranges.c
>>>> +++ b/lib/linear_ranges.c
>>>> @@ -241,6 +241,42 @@ int linear_range_get_selector_high(const
>>>> struct linear_range *r,
>>>> }
>>>> EXPORT_SYMBOL_GPL(linear_range_get_selector_high);
>>>> +/**
>>>> + * linear_range_get_selector_high_array - return linear range
>>>> selector for value
>>>> + * @r: pointer to array of linear ranges where selector is
>>>> looked from
>>>> + * @ranges: amount of ranges to scan from array
>>>> + * @val: value for which the selector is searched
>>>> + * @selector: address where found selector value is updated
>>>> + * @found: flag to indicate that given value was in the range
>>>> + *
>>>> + * Scan array of ranges for selector for which range value matches
>>>> given
>>>> + * input value. Value is matching if it is equal or higher than
>>>> given value
>>>> + * If given value is found to be in a range scanning is stopped
>>>> and @found is
>>>> + * set true. If a range with values greater than given value is found
>>>> + * but the range min is being greater than given value, then the
>>>> range's
>>>> + * lowest selector is updated to @selector and scanning is stopped.
>>>
>>> Is there a reason why the scanning is stopped here? What ensures
>>> that the rest of the ranges wouldn't contain a better match?
>>>
>>> The logic is now different from the
>>> linear_range_get_selector_low_array(), and I would like to
>>> understand why? It'd be nice if these APIs were 'symmetric' to avoid
>>> confusion. Hence, I would like to know rationale behind making them
>>> different.
>>
>>
>> The rationale for this being asymmetric is to find the tightest upper
>> bound for `value` < minimum value across the linear range array.
>>
>> To better illustrate this with an example. I have 2 entries in the
>> linear range array [ [4, 8], [11, 15] ]. Let's assume I pass a value
>> of "2".
>>
>> Based on my current approach, the call to get_selector_high() would
>> successfully return with `found`=false and a selector value
>> corresponding to "4".
>>
>> However, if I continued to search, I would end up the selector
>> corresponding to "11". A selector corresponding to "4" is much
>> closer/ tighter than "2".
>>
>> For values higher than the highest value in any range, this would
>> keep iterating and end up returning an -EINVAL.
>>
>> For in range values this would work as expected.
>>
>> This implementation assumes that the linear ranges are provided in
>> sorted order, an assumption that I believe already underlies the
>> existing *_low_array() logic.
>
> Ah. I think ... I didn't think. :)
>
> It definitely makes sense to stop scanning if the range_min already
> was greater than the given target value. Thanks for the patience and
> for adding this missing piece :)
>
> Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com>
Thanks for the review! :)
Regards,
Amit
>
>
> ---
> Matti Vaittinen
> Linux kernel developer at ROHM Semiconductors
> Oulu Finland
>
> ~~ When things go utterly wrong vim users can always type :help! ~~
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2026-02-18 20:05 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-14 3:12 [PATCH v6 0/6] Introduce MAX77759 charger driver Amit Sunil Dhamne via B4 Relay
2026-02-14 3:12 ` [PATCH v6 1/6] dt-bindings: mfd: maxim,max77759: reference power-supply schema and add regulator property Amit Sunil Dhamne via B4 Relay
2026-02-14 3:12 ` [PATCH v6 2/6] dt-bindings: usb: maxim,max33359: Add supply property for vbus Amit Sunil Dhamne via B4 Relay
2026-02-14 3:12 ` [PATCH v6 3/6] mfd: max77759: add register bitmasks and modify irq configs for charger Amit Sunil Dhamne via B4 Relay
2026-02-17 12:30 ` André Draszik
2026-02-14 3:12 ` [PATCH v6 4/6] lib/linear_ranges: Add linear_range_get_selector_high_array Amit Sunil Dhamne via B4 Relay
2026-02-16 13:58 ` Matti Vaittinen
2026-02-18 1:45 ` Amit Sunil Dhamne
2026-02-18 8:17 ` Matti Vaittinen
2026-02-18 20:05 ` Amit Sunil Dhamne
2026-02-14 3:12 ` [PATCH v6 5/6] power: supply: max77759: add charger driver Amit Sunil Dhamne via B4 Relay
2026-02-14 8:56 ` kernel test robot
2026-02-17 13:14 ` André Draszik
2026-02-18 5:35 ` Amit Sunil Dhamne
2026-02-14 3:12 ` [PATCH v6 6/6] usb: typec: tcpm/tcpci_maxim: deprecate WAR for setting charger mode Amit Sunil Dhamne via B4 Relay
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox