Message ID | 20230420192402.3695265-1-Naresh.Solanki@9elements.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp578102vqo; Thu, 20 Apr 2023 12:53:40 -0700 (PDT) X-Google-Smtp-Source: AKy350ZDsU5fcBZf2tBGxnFVmcArwHpGuCSvMoBI28nk8ptag2gRfTaNjZo11DU7dNy5mjO9NToK X-Received: by 2002:a17:90a:c404:b0:247:2da0:8f42 with SMTP id i4-20020a17090ac40400b002472da08f42mr7892896pjt.20.1682020419692; Thu, 20 Apr 2023 12:53:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682020419; cv=none; d=google.com; s=arc-20160816; b=KxMtrxCNrZjfOpqglyI/4ZPTK2WJfpf6LDpboKTfvhUcKH99miZh5ShnDbfjSz+rsp nyXbmgeso7ZLUgTrOY3HL3UpeAyFNrJ3+Rj8Kqsf1OvC04TV5k983ZTntJ0qcnTvqE1i 9BNe10o2PQumem92CKnc10pk9Kn6BInjCjv97IUCsEpKSNSTi8B3T1XLrMFeVSJNTZVw m76yJJyyG0h/+RFHpccRypn6VMKHd5qfpbUSgv8CmAiwBRG8wVb3+0CMvx9fV6wK7mut 2QlLCrVfZCmk+IfT3BAy/kDlaGddvkYJjkJpwpuzGxQ7pgmFufVTx+aWjXTxiDg6DSF1 mI8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=5qbGFeXrDs3WrhBf+lvrgBNLjjhcPXH+cPYhZsQiewQ=; b=k4QuqSfai2KFUlnREIO0rBAMbxakgfL3IctOCiz5s4vUbr0DuOXJnbRFhewahg0M1M bJJ+9ViuIj6xB7mhZNqmoR9quIUHIbiT157kUfJaWs1q4Nqg68DvPpto0jgH4mx2E8W0 m0ru7Ogf+8XSUkXFVioV/CED+pqgzkUv8GXNev2n/inpDdhDqlsd7eeYDRbpbi30gzy9 16CnywbhAyRVYeH11w8WFxee8w3VeY9/GA4PQC9bhf8Ky4vYykBM43OuTQ4kfhZvnWZl tsA9IDFVQzTEUVBvstaPhz/Ax2KEy2UVthhboXqDEtNK95y0YS/AyU2VYR3rbCwFZfki O+9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@9elements.com header.s=google header.b="Ac93lBa/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=9elements.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r7-20020a632047000000b0051b35cb52b2si2204396pgm.565.2023.04.20.12.53.25; Thu, 20 Apr 2023 12:53:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@9elements.com header.s=google header.b="Ac93lBa/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=9elements.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231733AbjDTTYj (ORCPT <rfc822;cjcooper78@gmail.com> + 99 others); Thu, 20 Apr 2023 15:24:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230190AbjDTTYh (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 20 Apr 2023 15:24:37 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A4FE2D6A for <linux-kernel@vger.kernel.org>; Thu, 20 Apr 2023 12:24:32 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-2f40b891420so865294f8f.0 for <linux-kernel@vger.kernel.org>; Thu, 20 Apr 2023 12:24:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=9elements.com; s=google; t=1682018670; x=1684610670; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=5qbGFeXrDs3WrhBf+lvrgBNLjjhcPXH+cPYhZsQiewQ=; b=Ac93lBa/9BLRzbTUcFMyNcv0LR2mn86n/7LatpQPOmPnIeoIVS8CMN5ZA4Iiz1PkjZ k7LurRp9dERgJMIKohVtx2XFerLcvtT5P7XychnJe/uyHOW8OrpB7+9bv/UK5bKJsF0R 8CjUlmeFciVl84uA73WfydbjH1kKJ6p2QhMpxSsY9X8httdTo+kuoT3F34O/gbd3J1/b 077FldUCsxn9J1s8HoAg8seAPzexZiBy28xqZ3yjUUW1/C12KIvwV4n3MdTbIN8QT2RJ 04ifTJHe+F9y0D7nmU85oTFm+xDCXZgLwp1/3w2zWMhr6zsf5tna9dhewowre5/cX4R4 DX5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682018670; x=1684610670; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=5qbGFeXrDs3WrhBf+lvrgBNLjjhcPXH+cPYhZsQiewQ=; b=fXiLLNzF6baI/tT+QfslOD4dXpSC+mhlWyCGFZtO51vXpfAj1pmmSHPFhdFK2u1pgU AXqfEI2AtBU54eCDaNihSlAx2vXgdNePV5lsddHYfoNCbCOlt+W61h9o8nSHszD3wqC9 fT4RH5MAwlwalxJQABMwn9/fIDudcjXRj82/LzdSm12gV/xoFJ8zmOiqBN/MhXNFrCfw LzFDXoIc702CkIju2j5j8JON/JPMRjGV61t6CD1Do7+1F+KajZoGNa3gwzJOWT057U50 JprvftzgA1kckT/6yKZaADxx/DKbFT6Sc0gLjbpY35QaeIhv19Ra2TyyWHPwZhrPKE7H crVQ== X-Gm-Message-State: AAQBX9dSsxxh6+26UEZEmHkZcH6NIr1akyp/Ik2mYGwc9tTP4H1C7QD+ SIabwcW5oY5mPz4KpUce/aD1RwxP62prDdvG7Dxf0A== X-Received: by 2002:a05:6000:1c9:b0:2fb:ad8:288f with SMTP id t9-20020a05600001c900b002fb0ad8288fmr2015321wrx.11.1682018670573; Thu, 20 Apr 2023 12:24:30 -0700 (PDT) Received: from stroh80.sec.9e.network (ip-078-094-000-051.um19.pools.vodafone-ip.de. [78.94.0.51]) by smtp.gmail.com with ESMTPSA id u3-20020a7bcb03000000b003f16f3cc9fcsm2825651wmj.9.2023.04.20.12.24.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 12:24:30 -0700 (PDT) From: Naresh Solanki <naresh.solanki@9elements.com> X-Google-Original-From: Naresh Solanki <Naresh.Solanki@9elements.com> To: zev@bewilderbeest.net, Liam Girdwood <lgirdwood@gmail.com>, Mark Brown <broonie@kernel.org>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org> Cc: Naresh Solanki <Naresh.Solanki@9elements.com>, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v2 1/2] dt-bindings: regulator: Add support for multiple supplies Date: Thu, 20 Apr 2023 21:24:01 +0200 Message-Id: <20230420192402.3695265-1-Naresh.Solanki@9elements.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763726243770273911?= X-GMAIL-MSGID: =?utf-8?q?1763726243770273911?= |
Series |
[v2,1/2] dt-bindings: regulator: Add support for multiple supplies
|
|
Commit Message
Naresh Solanki
April 20, 2023, 7:24 p.m. UTC
Add optional DT property 'regulator-supplies' to handle connectors with
multiple supplies.
If this property is present, it will determine all regulator supplies.
Otherwise, the 'vout' supply will be used as a fallback.
This change improves support for connector like PCIe connectors on
mainboards that can be powered by 12V and 3.3V supplies.
Signed-off-by: Naresh Solanki <Naresh.Solanki@9elements.com>
...
Change in V2:
- Added example
- Update property type & description.
- Improve commit message
---
.../bindings/regulator/regulator-output.yaml | 21 ++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
base-commit: 43c75e470e5b56a992acb08474810e6822f0989c
Comments
On Thu, Apr 20, 2023 at 09:24:01PM +0200, Naresh Solanki wrote: > Add optional DT property 'regulator-supplies' to handle connectors with > multiple supplies. > If this property is present, it will determine all regulator supplies. > Otherwise, the 'vout' supply will be used as a fallback. > > This change improves support for connector like PCIe connectors on > mainboards that can be powered by 12V and 3.3V supplies. > > Signed-off-by: Naresh Solanki <Naresh.Solanki@9elements.com> > ... > Change in V2: > - Added example > - Update property type & description. > - Improve commit message > --- > .../bindings/regulator/regulator-output.yaml | 21 ++++++++++++++++--- > 1 file changed, 18 insertions(+), 3 deletions(-) > > diff --git a/Documentation/devicetree/bindings/regulator/regulator-output.yaml b/Documentation/devicetree/bindings/regulator/regulator-output.yaml > index 078b37a1a71a..a9dce26991ff 100644 > --- a/Documentation/devicetree/bindings/regulator/regulator-output.yaml > +++ b/Documentation/devicetree/bindings/regulator/regulator-output.yaml > @@ -21,13 +21,22 @@ properties: > compatible: > const: regulator-output > > - vout-supply: > + regulator-supplies: > + $ref: /schemas/types.yaml#/definitions/string-array > description: > - Phandle of the regulator supplying the output. > + Optional property that specifies supply names provided by > + the regulator. Defaults to "vout" if not specified. The > + array contains a list of supply names. > + Each supply name corresponds to a phandle in the > + patternProperties. > + > +patternProperties: > + ".*-supply": > + description: > + Specifies the phandle for various supplies While you say use 'vout-supply' for a single supply, nothing enforces that anymore. > > required: > - compatible > - - vout-supply > > additionalProperties: false > > @@ -37,3 +46,9 @@ examples: > compatible = "regulator-output"; > vout-supply = <&output_reg>; > }; > + out2 { > + compatible = "regulator-output"; > + regulator-supplies = "sw0", "sw1"; > + sw0-supply = <&out2_sw0>; > + sw1-supply = <&out2_sw1>; Names in the consumer are relative to the consumer. You appear to be naming these by the supplier. Just add vout[0-9]-supply and iterate over that name in the driver. Then you don't need "regulator-supplies". Really, you never did. You could just find all properties ending in "-supply". Rob
Hi Rob, On 22-04-2023 03:06 am, Rob Herring wrote: > On Thu, Apr 20, 2023 at 09:24:01PM +0200, Naresh Solanki wrote: >> Add optional DT property 'regulator-supplies' to handle connectors with >> multiple supplies. >> If this property is present, it will determine all regulator supplies. >> Otherwise, the 'vout' supply will be used as a fallback. >> >> This change improves support for connector like PCIe connectors on >> mainboards that can be powered by 12V and 3.3V supplies. >> >> Signed-off-by: Naresh Solanki <Naresh.Solanki@9elements.com> >> ... >> Change in V2: >> - Added example >> - Update property type & description. >> - Improve commit message >> --- >> .../bindings/regulator/regulator-output.yaml | 21 ++++++++++++++++--- >> 1 file changed, 18 insertions(+), 3 deletions(-) >> >> diff --git a/Documentation/devicetree/bindings/regulator/regulator-output.yaml b/Documentation/devicetree/bindings/regulator/regulator-output.yaml >> index 078b37a1a71a..a9dce26991ff 100644 >> --- a/Documentation/devicetree/bindings/regulator/regulator-output.yaml >> +++ b/Documentation/devicetree/bindings/regulator/regulator-output.yaml >> @@ -21,13 +21,22 @@ properties: >> compatible: >> const: regulator-output >> >> - vout-supply: >> + regulator-supplies: >> + $ref: /schemas/types.yaml#/definitions/string-array >> description: >> - Phandle of the regulator supplying the output. >> + Optional property that specifies supply names provided by >> + the regulator. Defaults to "vout" if not specified. The >> + array contains a list of supply names. >> + Each supply name corresponds to a phandle in the >> + patternProperties. >> + >> +patternProperties: >> + ".*-supply": >> + description: >> + Specifies the phandle for various supplies > > While you say use 'vout-supply' for a single supply, nothing enforces > that anymore. > >> >> required: >> - compatible >> - - vout-supply >> >> additionalProperties: false >> >> @@ -37,3 +46,9 @@ examples: >> compatible = "regulator-output"; >> vout-supply = <&output_reg>; >> }; >> + out2 { >> + compatible = "regulator-output"; >> + regulator-supplies = "sw0", "sw1"; >> + sw0-supply = <&out2_sw0>; >> + sw1-supply = <&out2_sw1>; > > Names in the consumer are relative to the consumer. You appear to be > naming these by the supplier. Just add vout[0-9]-supply and iterate over > that name in the driver. Then you don't need "regulator-supplies". > Really, you never did. You could just find all properties ending in > "-supply". Please correct me if I have misunderstood anything What I understood is: 1. Use 'for_each_property_of_node' & iterate each property, 2. String compare each property name ending with '-supply', 3. If there is match then initialize accordingly. This way all *-supply property are also included including vout-supply. This way, regulator-supplies isn't needed. Shall I go ahead in this way ? > > Rob Regards, Naresh
Hi Rob, On 24-04-2023 02:22 pm, Naresh Solanki wrote: > Hi Rob, > > On 22-04-2023 03:06 am, Rob Herring wrote: >> On Thu, Apr 20, 2023 at 09:24:01PM +0200, Naresh Solanki wrote: >>> Add optional DT property 'regulator-supplies' to handle connectors with >>> multiple supplies. >>> If this property is present, it will determine all regulator supplies. >>> Otherwise, the 'vout' supply will be used as a fallback. >>> >>> This change improves support for connector like PCIe connectors on >>> mainboards that can be powered by 12V and 3.3V supplies. >>> >>> Signed-off-by: Naresh Solanki <Naresh.Solanki@9elements.com> >>> ... >>> Change in V2: >>> - Added example >>> - Update property type & description. >>> - Improve commit message >>> --- >>> .../bindings/regulator/regulator-output.yaml | 21 ++++++++++++++++--- >>> 1 file changed, 18 insertions(+), 3 deletions(-) >>> >>> diff --git >>> a/Documentation/devicetree/bindings/regulator/regulator-output.yaml >>> b/Documentation/devicetree/bindings/regulator/regulator-output.yaml >>> index 078b37a1a71a..a9dce26991ff 100644 >>> --- a/Documentation/devicetree/bindings/regulator/regulator-output.yaml >>> +++ b/Documentation/devicetree/bindings/regulator/regulator-output.yaml >>> @@ -21,13 +21,22 @@ properties: >>> compatible: >>> const: regulator-output >>> - vout-supply: >>> + regulator-supplies: >>> + $ref: /schemas/types.yaml#/definitions/string-array >>> description: >>> - Phandle of the regulator supplying the output. >>> + Optional property that specifies supply names provided by >>> + the regulator. Defaults to "vout" if not specified. The >>> + array contains a list of supply names. >>> + Each supply name corresponds to a phandle in the >>> + patternProperties. >>> + >>> +patternProperties: >>> + ".*-supply": >>> + description: >>> + Specifies the phandle for various supplies >> >> While you say use 'vout-supply' for a single supply, nothing enforces >> that anymore. >> >>> required: >>> - compatible >>> - - vout-supply >>> additionalProperties: false >>> @@ -37,3 +46,9 @@ examples: >>> compatible = "regulator-output"; >>> vout-supply = <&output_reg>; >>> }; >>> + out2 { >>> + compatible = "regulator-output"; >>> + regulator-supplies = "sw0", "sw1"; >>> + sw0-supply = <&out2_sw0>; >>> + sw1-supply = <&out2_sw1>; >> >> Names in the consumer are relative to the consumer. You appear to be >> naming these by the supplier. Just add vout[0-9]-supply and iterate over >> that name in the driver. Then you don't need "regulator-supplies". >> Really, you never did. You could just find all properties ending in >> "-supply". > Please correct me if I have misunderstood anything > What I understood is: > 1. Use 'for_each_property_of_node' & iterate each property, > 2. String compare each property name ending with '-supply', > 3. If there is match then initialize accordingly. > This way all *-supply property are also included including vout-supply. > This way, regulator-supplies isn't needed. > Shall I go ahead in this way ? I wanted to follow up on our previous discussion regarding the naming of properties in the consumer. Based on your feedback, I believe that I should use 'for_each_property_of_node' to iterate over each property and then string compare each property name to find those that end with '-supply'. This way, all *-supply properties will be included, including vout-supply, and the 'regulator-supplies' won't be needed. Can you please confirm if my understanding is correct? Thank you. > >> >> Rob > Regards, > Naresh
diff --git a/Documentation/devicetree/bindings/regulator/regulator-output.yaml b/Documentation/devicetree/bindings/regulator/regulator-output.yaml index 078b37a1a71a..a9dce26991ff 100644 --- a/Documentation/devicetree/bindings/regulator/regulator-output.yaml +++ b/Documentation/devicetree/bindings/regulator/regulator-output.yaml @@ -21,13 +21,22 @@ properties: compatible: const: regulator-output - vout-supply: + regulator-supplies: + $ref: /schemas/types.yaml#/definitions/string-array description: - Phandle of the regulator supplying the output. + Optional property that specifies supply names provided by + the regulator. Defaults to "vout" if not specified. The + array contains a list of supply names. + Each supply name corresponds to a phandle in the + patternProperties. + +patternProperties: + ".*-supply": + description: + Specifies the phandle for various supplies required: - compatible - - vout-supply additionalProperties: false @@ -37,3 +46,9 @@ examples: compatible = "regulator-output"; vout-supply = <&output_reg>; }; + out2 { + compatible = "regulator-output"; + regulator-supplies = "sw0", "sw1"; + sw0-supply = <&out2_sw0>; + sw1-supply = <&out2_sw1>; + };