Re: [PATCH 1/2] dt-bindings: power: supply: maxim,max8903: add DC and USB input current-limit controls
From: Sebastian Reichel
Date: Thu Jun 04 2026 - 18:43:41 EST
Hi,
On Wed, Jun 03, 2026 at 09:15:18AM +0200, Herman van Hazendonk wrote:
> Add four optional properties to the MAX8903 charger binding to
> describe board-level GPIO control of the DC and USB input current
> limits:
>
> DC input (TA / DOK pin):
> - dc-current-limit-gpios (1..4 GPIOs): mux control lines feeding
> the MAX8903 IDC resistor mux;
> - dc-current-limit-mapping (uint32-matrix of {microamps,
> gpio_bit_pattern} pairs): the available current levels and the
> GPIO bit pattern that selects each level.
>
> USB input (USB / UOK pin):
> - usb-current-limit-gpios: a single GPIO driving the IUSB
> tri-state pin (low / high);
> - usb-current-limit-values: the two microamp values that the IUSB
> pin selects.
>
> These let userspace clamp the input draw via the standard
> POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT power_supply attribute. The HP
> TouchPad uses both: two TLMM lines select between 0.5 A, 1.0 A,
> 1.5 A and 2.0 A DC input current limits behind the MAX8903B
> charger, and a third TLMM line picks the IUSB 100 mA / 500 mA
> limit.
>
> These are purely additive; existing platforms remain unaffected.
>
> Signed-off-by: Herman van Hazendonk <github.com@xxxxxxxxxx>
> ---
> .../bindings/power/supply/maxim,max8903.yaml | 58 +++++++++++++++++++
> 1 file changed, 58 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/power/supply/maxim,max8903.yaml b/Documentation/devicetree/bindings/power/supply/maxim,max8903.yaml
> index 86af38378999..5e970ebc08df 100644
> --- a/Documentation/devicetree/bindings/power/supply/maxim,max8903.yaml
> +++ b/Documentation/devicetree/bindings/power/supply/maxim,max8903.yaml
> @@ -44,6 +44,41 @@ properties:
> maxItems: 1
> description: USB suspend pin (active high, output)
>
> + dc-current-limit-gpios:
> + minItems: 1
> + maxItems: 4
> + description:
> + GPIOs controlling DC input current limit via resistor mux.
> + Used with dc-current-limit-mapping to select charging current.
> +
> + dc-current-limit-mapping:
> + $ref: /schemas/types.yaml#/definitions/uint32-matrix
> + minItems: 2
> + maxItems: 16
> + description: |
> + Array of (current_microamps, gpio_bit_pattern) pairs defining available
> + DC current limits. The gpio_bit_pattern is applied to dc-current-limit-gpios
> + to select that current level.
> + items:
> + items:
> + - description: Current limit in microamps
> + - description: GPIO bit pattern value
> +
> + usb-current-limit-gpios:
> + maxItems: 1
> + description:
> + GPIO controlling USB input current limit.
> + Low = usb-current-limit-values[0], High = usb-current-limit-values[1].
> +
> + usb-current-limit-values:
> + $ref: /schemas/types.yaml#/definitions/uint32-array
> + minItems: 2
> + maxItems: 2
> + default: [100000, 500000]
> + description:
> + USB current limits in microamps for GPIO low and high states.
> + Default is 100mA (low) and 500mA (high) per USB specification.
The IUSB pin always selects between 100mA and 500mA for the MAX8903
according to the datasheet, so why is there a DT property?
Greetings,
-- Sebastian
> +
> required:
> - compatible
>
> @@ -65,3 +100,26 @@ examples:
> chg-gpios = <&gpio3 15 GPIO_ACTIVE_LOW>;
> cen-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>;
> };
> + - |
> + /* Example with DC and USB current limit control */
> + #include <dt-bindings/gpio/gpio.h>
> + charger-with-current-limit {
> + compatible = "maxim,max8903";
> + dok-gpios = <&gpio2 3 GPIO_ACTIVE_LOW>;
> + flt-gpios = <&gpio2 2 GPIO_ACTIVE_LOW>;
> + chg-gpios = <&gpio3 15 GPIO_ACTIVE_LOW>;
> + cen-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>;
> + dcm-gpios = <&gpio2 6 GPIO_ACTIVE_HIGH>;
> +
> + /* DC input current limit via IDC resistor mux */
> + dc-current-limit-gpios = <&gpio1 0 GPIO_ACTIVE_HIGH>,
> + <&gpio1 1 GPIO_ACTIVE_HIGH>;
> + dc-current-limit-mapping = <750000 0>, /* GPIO[1:0]=0b00 */
> + <900000 1>, /* GPIO[1:0]=0b01 */
> + <1400000 3>, /* GPIO[1:0]=0b11 */
> + <2000000 2>; /* GPIO[1:0]=0b10 */
> +
> + /* USB current control */
> + usb-current-limit-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
> + usb-current-limit-values = <100000 500000>; /* 100mA / 500mA */
> + };
> --
> 2.43.0
>
Attachment:
signature.asc
Description: PGP signature