Re: [PATCHv2 3/6] power: supply: gpio-charger: add charge-current-limit feature

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jun 06, 2020 at 12:44:00AM +0200, Sebastian Reichel wrote:
> Add new charge-current-limit feature to gpio-charger.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@xxxxxxxxxxxxx>
> ---
>  .../bindings/power/supply/gpio-charger.yaml   |  31 ++++
>  drivers/power/supply/gpio-charger.c           | 140 ++++++++++++++++++
>  2 files changed, 171 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/power/supply/gpio-charger.yaml b/Documentation/devicetree/bindings/power/supply/gpio-charger.yaml
> index 30eabbb14ef3..e11cfdc68a51 100644
> --- a/Documentation/devicetree/bindings/power/supply/gpio-charger.yaml
> +++ b/Documentation/devicetree/bindings/power/supply/gpio-charger.yaml
> @@ -39,6 +39,25 @@ properties:
>      maxItems: 1
>      description: GPIO indicating the charging status
>  
> +  charge-current-limit-gpios:
> +    minItems: 1
> +    maxItems: 32
> +    description: GPIOs used for current limiting
> +
> +  charge-current-limit-mapping:
> +    description: List of touples with current in uA and a GPIO bitmap (in

s/touples/tuples/

> +      this order). The touples must be provided in descending order of the

and here.

> +      current limit.
> +    $ref: /schemas/types.yaml#/definitions/uint32-matrix
> +    items:
> +      items:
> +        - description:
> +            Current limit in uA
> +        - description:
> +            Encoded GPIO setting. Bit 0 represents last GPIO from the
> +            charge-current-limit-gpios property. Bit 1 second to last
> +            GPIO and so on.

Seems a bit odd that bit N doesn't represent index N of the gpios.

> +
>  required:
>    - compatible
>  
> @@ -47,6 +66,12 @@ anyOf:
>      - gpios
>    - required:
>      - charge-status-gpios
> +  - required:
> +    - charge-current-limit-gpios
> +
> +dependencies:
> +  charge-current-limit-gpios: [ charge-current-limit-mapping ]
> +  charge-current-limit-mapping: [ charge-current-limit-gpios ]
>  
>  additionalProperties: false
>  
> @@ -60,4 +85,10 @@ examples:
>  
>        gpios = <&gpd 28 GPIO_ACTIVE_LOW>;
>        charge-status-gpios = <&gpc 27 GPIO_ACTIVE_LOW>;
> +
> +      charge-current-limit-gpios = <&gpioA 11 GPIO_ACTIVE_HIGH>,
> +                                   <&gpioA 12 GPIO_ACTIVE_HIGH>;
> +      charge-current-limit-mapping = <2500000 0x00>, // 2.5 A => both GPIOs low
> +                                     <700000 0x01>, // 700 mA => GPIO A.12 high
> +                                     <0 0x02>; // 0 mA => GPIO A.11 high
>      };



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux