Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3704142pxf; Mon, 15 Mar 2021 16:45:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy00hQkeGBVA/81fE+Cgw5MDnqhtJtizPS8o0U3c5WpJIYunhPAQHfrsedwzdHNDmlWg73O X-Received: by 2002:a17:906:5295:: with SMTP id c21mr26491732ejm.67.1615851909298; Mon, 15 Mar 2021 16:45:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615851909; cv=none; d=google.com; s=arc-20160816; b=wsJVR4Vn/aI7YokN7ELYRWs+U5VNVMIVjq71ly+QopKoPhDEf1JzK59Biquqe8DTzl QKn336l3oIKK2drbMKByV40h7PU3GmkRToWcjU/uTBzOyueEbCHSERNab9PFv/SHOX4n LJSSPjNXcGfnsIUR+FqTOYaq44j2u3ZQAfzNcShDrYOtM7L68SSc0AEfXfMF1smE1hqc Dfd5RjWn1g9PpSd7CR860Ove1fMBKiI2VXald0G+KK7T4ADmAV4Qly5/AWGVITJHPEgK VpxkGpRDhw0ty+GeEt9cgMpnpstPz3RG9zPni8F3IxfFLG9Jvx7StIgHyQkucYNJGNh3 Svcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=lywU79cgPhwzXKjiVGg/yYvJ4uYyEK/9UK5RnhAeS3E=; b=W0P981dzOiJJaDPGHUZeCcm/N8KMh94U4xOwk0EXRgtqaWF6S5nt6G7Mx0GrUzJf39 Ox79D3jl/bmiYZwcNumoToEV5H22TdrZ+sigpjiblOM6oWAGX1RE7N0RYryZQTIanX8j UICSWtst5zTVATwBKY79/YI4DeZUMorcE9m2cO8SDQVPg62DP9PYQLW3hNS0YWRzovA8 NRrzLtsnI0pOgwHthtw8bg8BDZ604PpHttnZOuKn3gOZGsqY1lTVpHLIj2fVnWb2yhVY 7Grlm8nUL8i3F/hltbZ9PJsVBxPSA0f5qo+SxDcUIKcAd6OU2zRLeqHeJYmeA9L44cZK XEAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WY3ykGyu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d15si11782886edu.375.2021.03.15.16.44.47; Mon, 15 Mar 2021 16:45:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WY3ykGyu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229929AbhCOSiT (ORCPT + 99 others); Mon, 15 Mar 2021 14:38:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:54850 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231801AbhCOSiD (ORCPT ); Mon, 15 Mar 2021 14:38:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4544264F3F; Mon, 15 Mar 2021 18:38:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1615833483; bh=uF298eM0LgGS85hwZQZdhr2Tvj40xbTDjSMSlStBdiE=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=WY3ykGyuf2z16E//2lN9Ht4BBF7x9q9KAlNOEsa3TVvelBahqe/tGWegrMKsNhzHX phPZe+Wpi00XbfBRmrjKzI+ZbNVtUUKasaegNWyRoCqpJ5zcpR8sc/BJWhf6VV3a4f c44sLRf8C8rsk+Ewhx12kvZRjEr2mHrGHZV8Q5R/6A3lC4V7P4d1oUyGZ5u6SLG+Cp 4fEq7VpyA51Ne70DgHNTg329XW/sbk2vjSC2xOSd3+scDieO4laW3OB+hLd/KE+Lm5 CBYVdz1nP28jV+SzNa8Ycv7XEUTq4+lCGtGmGgvNzqJ9swhmC8hjrNIKCuX0mfx1qF nBMOyJl8QvUiQ== Received: by mail-ed1-f44.google.com with SMTP id bx7so18533511edb.12; Mon, 15 Mar 2021 11:38:03 -0700 (PDT) X-Gm-Message-State: AOAM531WKOyqOjbM6nkTr3yUTxf3DgqhrQpu09EUM1Vvn6NrMip5/s90 urBz9vlJybvFQL09Cbyl8TWNDSj4Fz2rhfV+Xg== X-Received: by 2002:a05:6402:2d0:: with SMTP id b16mr31943444edx.194.1615833481821; Mon, 15 Mar 2021 11:38:01 -0700 (PDT) MIME-Version: 1.0 References: <20210312154357.1561730-1-sebastian.reichel@collabora.com> <20210312154357.1561730-31-sebastian.reichel@collabora.com> In-Reply-To: <20210312154357.1561730-31-sebastian.reichel@collabora.com> From: Rob Herring Date: Mon, 15 Mar 2021 12:37:50 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 30/38] dt-bindings: power: supply: lp8727: Convert to DT schema format To: Sebastian Reichel Cc: Sebastian Reichel , "open list:THERMAL" , devicetree@vger.kernel.org, "linux-kernel@vger.kernel.org" , Collabora Kernel ML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 12, 2021 at 8:52 AM Sebastian Reichel wrote: > > Convert the binding to DT schema format. > > Signed-off-by: Sebastian Reichel > --- > .../bindings/power/supply/lp8727_charger.txt | 43 ------- > .../bindings/power/supply/ti,lp8727.yaml | 112 ++++++++++++++++++ > 2 files changed, 112 insertions(+), 43 deletions(-) > delete mode 100644 Documentation/devicetree/bindings/power/supply/lp8727_charger.txt > create mode 100644 Documentation/devicetree/bindings/power/supply/ti,lp8727.yaml > > diff --git a/Documentation/devicetree/bindings/power/supply/lp8727_charger.txt b/Documentation/devicetree/bindings/power/supply/lp8727_charger.txt > deleted file mode 100644 > index 0355a4b68f79..000000000000 > --- a/Documentation/devicetree/bindings/power/supply/lp8727_charger.txt > +++ /dev/null > @@ -1,43 +0,0 @@ > -Binding for TI/National Semiconductor LP8727 Charger > - > -Required properties: > -- compatible: "ti,lp8727" > -- reg: I2C slave address 27h > - > -Optional properties: > -- interrupts: interrupt specifier (see interrupt binding[0]) > -- debounce-ms: interrupt debounce time. (u32) > - > -AC and USB charging parameters > -- charger-type: "ac" or "usb" (string) > -- eoc-level: value of 'enum lp8727_eoc_level' (u8) > -- charging-current: value of 'enum lp8727_ichg' (u8) > - > -[0]: Documentation/devicetree/bindings/interrupt-controller/interrupts.txt > - > -Example) > - > -lp8727@27 { > - compatible = "ti,lp8727"; > - reg = <0x27>; > - > - /* GPIO 134 is used for LP8728 interrupt pin */ > - interrupt-parent = <&gpio5>; /* base = 128 */ > - interrupts = <6 0x2>; /* offset = 6, falling edge type */ > - > - debounce-ms = <300>; > - > - /* AC charger: 5% EOC and 500mA charging current */ > - ac { > - charger-type = "ac"; > - eoc-level = /bits/ 8 <0>; > - charging-current = /bits/ 8 <4>; > - }; > - > - /* USB charger: 10% EOC and 400mA charging current */ > - usb { > - charger-type = "usb"; > - eoc-level = /bits/ 8 <1>; > - charging-current = /bits/ 8 <2>; > - }; > -}; > diff --git a/Documentation/devicetree/bindings/power/supply/ti,lp8727.yaml b/Documentation/devicetree/bindings/power/supply/ti,lp8727.yaml > new file mode 100644 > index 000000000000..65894b36a69d > --- /dev/null > +++ b/Documentation/devicetree/bindings/power/supply/ti,lp8727.yaml > @@ -0,0 +1,112 @@ > +# SPDX-License-Identifier: GPL-2.0 > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/power/supply/ti,lp8727.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Binding for TI/National Semiconductor LP8727 Charger > + > +maintainers: > + - Sebastian Reichel > + > +allOf: > + - $ref: power-supply.yaml# > + > +properties: > + compatible: > + const: ti,lp8727 > + > + reg: > + const: 0x27 > + > + interrupts: > + maxItems: 1 > + > + debounce-ms: > + $ref: /schemas/types.yaml#/definitions/uint32 > + description: interrupt debounce time in ms > + > + ac: > + type: object > + description: AC charging parameters > + properties: > + charger-type: > + const: ac > + > + eoc-level: > + $ref: /schemas/types.yaml#/definitions/uint8 > + minimum: 0 > + maximum: 6 > + description: | > + End of Charge Percentage with the following mapping: > + 0 = 5%, 1 = 10%, 2 = 16%, 3 = 20%, 4 = 25%, 5 = 33%, 6 = 50% > + > + charging-current: > + $ref: /schemas/types.yaml#/definitions/uint8 > + minimum: 0 > + maximum: 9 > + description: | > + Charging current with the following mapping: > + 0 = 90mA, 1 = 100mA, 2 = 400mA, 3 = 450mA, 4 = 500mA, 5 = 600mA, > + 6 = 700mA, 7 = 800mA, 8 = 900mA, 9 = 1000mA > + > + usb: > + type: object > + description: USB charging parameters > + properties: > + charger-type: > + const: usb > + > + eoc-level: > + $ref: /schemas/types.yaml#/definitions/uint8 > + minimum: 0 > + maximum: 6 > + description: | > + End of Charge Percentage with the following mapping: > + 0 = 5%, 1 = 10%, 2 = 16%, 3 = 20%, 4 = 25%, 5 = 33%, 6 = 50% > + > + charging-current: > + $ref: /schemas/types.yaml#/definitions/uint8 > + minimum: 0 > + maximum: 9 > + description: | > + Charging current with the following mapping: > + 0 = 90mA, 1 = 100mA, 2 = 400mA, 3 = 450mA, 4 = 500mA, 5 = 600mA, > + 6 = 700mA, 7 = 800mA, 8 = 900mA, 9 = 1000mA You can avoid the duplication here with: patternProperties: '^(ac|usb)$': type: object ... > + > +required: > + - compatible > + - reg > + > +additionalProperties: false > + > +examples: > + - | > + #include > + i2c0 { > + #address-cells = <1>; > + #size-cells = <0>; > + > + lp8727: charger@27 { > + compatible = "ti,lp8727"; > + reg = <0x27>; > + interrupt-parent = <&gpio5>; > + interrupts = <6 IRQ_TYPE_EDGE_FALLING>; > + debounce-ms = <300>; > + > + /* AC charger: 5% EOC and 500mA charging current */ > + ac { > + charger-type = "ac"; > + eoc-level = /bits/ 8 <0>; > + charging-current = /bits/ 8 <4>; > + }; > + > + /* USB charger: 10% EOC and 400mA charging current */ > + usb { > + charger-type = "usb"; > + eoc-level = /bits/ 8 <1>; > + charging-current = /bits/ 8 <2>; > + }; > + }; > + }; > + > -- > 2.30.1 >