Message ID | 20230308094024.14115-2-clamor95@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp234299wrd; Wed, 8 Mar 2023 01:44:43 -0800 (PST) X-Google-Smtp-Source: AK7set9NYI/TZXavmAlAA1fpsC6miFyqxQBPv7N8I3t15DTUH2zC0KBK05bkxAeHmiwwUjdjtrzk X-Received: by 2002:a17:906:5857:b0:878:81d7:9f77 with SMTP id h23-20020a170906585700b0087881d79f77mr16039203ejs.34.1678268683318; Wed, 08 Mar 2023 01:44:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678268683; cv=none; d=google.com; s=arc-20160816; b=flZPLPfvqzYcOUOwYndwBKr7gDSXIWqO+vT+8kwPqtJhk4Pdjt4znqHiB38KsiWCkS qgqotDPlpPbY/MjDIt7ioOVHN96TRCAmfGUiW6VM82BBDrB3DrO140NaLq2XciMn2yR2 UtGcxSVobBARyPK4iQxcD/xYXuGwVj3eizw5SgTE7d4TXg4L59zHPuqctI4D7hZ359RL owy+sgcjfAEX7z82/3l5LOgqOK8HoT/u6LCo04wEKGhsdbABLklxCQaenH57v+D9qHYa 9UO+hndwUvrDygem91ciJGSAnNZkcV4GjRLCyI1gTuezFovLtPDegjZ7aLpfjcuzu5ef nhIw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=sBRXPiMTjUXngf7UPU3ji30MSYizruFj0On8LBzCAgs=; b=sTWQ87J03GdRgPf/onc1bhNsrNz2mS4T3p+yWhRUpI2xe8J8xSNCVBSJq8nHACgK0A WGPf/cWHFyNDpK5D+3ApWAoxmfCQx82Uincy0KLLFOlU2REOKkSwYG1nGd+/Mgr72lTd /XhYcGYgrai6/vYc3Jg8CoJqxjsLMNBKPq8oQWJW1uFCD5p9QaYSCQI7oEQHy6+WoNsH RZwzZHUHtVYKaVi+1M5gid5bpvYxfsWVOIMaVIlC8WJ1zSUuZpmXqO36QrGWR0wPqbRr eY5aMpBtpb8v0zBrM2OUOd5OmNt85BXssgVcceg+PJSdYWme2fApgAopzAT2HTu85KJF V5RA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Vi49vQhL; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p18-20020a17090653d200b008d02052ed2asi14823140ejo.637.2023.03.08.01.44.19; Wed, 08 Mar 2023 01:44:43 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=Vi49vQhL; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229939AbjCHJkz (ORCPT <rfc822;toshivichauhan@gmail.com> + 99 others); Wed, 8 Mar 2023 04:40:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229875AbjCHJko (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 8 Mar 2023 04:40:44 -0500 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3856FB2571; Wed, 8 Mar 2023 01:40:39 -0800 (PST) Received: by mail-ed1-x531.google.com with SMTP id u9so63282103edd.2; Wed, 08 Mar 2023 01:40:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678268438; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sBRXPiMTjUXngf7UPU3ji30MSYizruFj0On8LBzCAgs=; b=Vi49vQhL808PneaoEQRvf+35yFIL9IOBVqMM69KJ6d/R7TpBDCVKvGJ3rfslt2QLWh aStXDUfJs2EqfkRzSZiJ7JrVDBJcMKOqSzi1/6sxk4temsPjdRddBmfJlmGqEQqWPlNZ 2moGM5WOTHi0RVGG+FaT99c9lz77olCBXIdPSFn3g0OS0c+mcsWug1EkhSAisURKpJ2R NyNFV7sQVwS+JuaBeca4BZvDVOV1z1v1cdIeSqzmUjTc8paEINAHSjrS+pX86N+i3WJu 7rUW7OhpktEsNtYE3lXGf07TNho0kIL+xLCoCtxYMupm7oH/r0bBV9PMhS7znlond90j rKyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678268438; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sBRXPiMTjUXngf7UPU3ji30MSYizruFj0On8LBzCAgs=; b=hCeHAfbF8T86WmvINO62mGpSqScZodFIsVzXr/qywCB7nPZT00kQwds5FTASDdkNAX xnmGTB0JAtQgd23qsngeYp3eQfZiPqfhrIUxB2bGMIoVlaa2B/BKfIhSbzLWKfRCZyW1 9XRN0lNsWcbIEL8xJK9+zd2DIwztY6bU8dyGmFnD7HWWNsyBVMFez4hrHQKRGMKVE9yi v43C4buUSxQ/KiUD1lXIXUD+6YphYtLd819TqTZg9k8nNU0J0qX40pPVWMjXZEVe/p6x H59EvQ4JQjAlr23YuPM2ruQpP/mGqpx+QmmxnRvzu7OSwAaNLcRDYROVQbJHz3yVxu+A TWKQ== X-Gm-Message-State: AO0yUKXm8d0mHBD5CpjGqFNgEXccKa/axpsFb9kx+mCiMLjWQ5ddzV0h JJKGYXcoKLS/qlhxxowzeZo= X-Received: by 2002:a17:907:94c5:b0:8b1:3821:1406 with SMTP id dn5-20020a17090794c500b008b138211406mr22570420ejc.45.1678268437669; Wed, 08 Mar 2023 01:40:37 -0800 (PST) Received: from xeon.. ([188.163.112.76]) by smtp.gmail.com with ESMTPSA id h17-20020a17090634d100b008ee5356801dsm7240014ejb.187.2023.03.08.01.40.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 01:40:37 -0800 (PST) From: Svyatoslav Ryhel <clamor95@gmail.com> To: Guenter Roeck <linux@roeck-us.net>, Jean Delvare <jdelvare@suse.com>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Liam Girdwood <lgirdwood@gmail.com>, Mark Brown <broonie@kernel.org> Cc: linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 1/2] dt-bindings: hwmon: ina2xx: add supply property Date: Wed, 8 Mar 2023 11:40:23 +0200 Message-Id: <20230308094024.14115-2-clamor95@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230308094024.14115-1-clamor95@gmail.com> References: <20230308094024.14115-1-clamor95@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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?1759792263295987246?= X-GMAIL-MSGID: =?utf-8?q?1759792263295987246?= |
Series |
Add optional power supply for INA2XX
|
|
Commit Message
Svyatoslav Ryhel
March 8, 2023, 9:40 a.m. UTC
Add supply property.
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml | 4 ++++
1 file changed, 4 insertions(+)
Comments
On 08/03/2023 10:40, Svyatoslav Ryhel wrote:
> Add supply property.
You have entire commit msg to explain and give background, but instead
there is just sentence duplicating subject. And since you did not
explain anything, we have questions... like: INA238 does not have VDD,
so this does not look correct.
Best regards,
Krzysztof
ср, 8 бер. 2023 р. о 12:27 Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> пише: > > On 08/03/2023 10:40, Svyatoslav Ryhel wrote: > > Add supply property. > > You have entire commit msg to explain and give background, but instead > there is just sentence duplicating subject. And since you did not > explain anything, we have questions... like: INA238 does not have VDD, > so this does not look correct. > This is why a regulator is not mandatory. If ina238 does not have vdd then one who needs ina238 may omit this prop. How about looking from this perspective? > > Best regards, > Krzysztof > Best regards, Svyatoslav R.
On 08/03/2023 11:32, Svyatoslav Ryhel wrote: > ср, 8 бер. 2023 р. о 12:27 Krzysztof Kozlowski > <krzysztof.kozlowski@linaro.org> пише: >> >> On 08/03/2023 10:40, Svyatoslav Ryhel wrote: >>> Add supply property. >> >> You have entire commit msg to explain and give background, but instead >> there is just sentence duplicating subject. And since you did not >> explain anything, we have questions... like: INA238 does not have VDD, >> so this does not look correct. >> > > This is why a regulator is not mandatory. If ina238 does not have vdd > then one who needs ina238 may omit this prop. How about looking from > this perspective? Not required means "optional", not "not existing" or "totally invalid". Best regards, Krzysztof
On 3/8/23 02:32, Svyatoslav Ryhel wrote: > ср, 8 бер. 2023 р. о 12:27 Krzysztof Kozlowski > <krzysztof.kozlowski@linaro.org> пише: >> >> On 08/03/2023 10:40, Svyatoslav Ryhel wrote: >>> Add supply property. >> >> You have entire commit msg to explain and give background, but instead >> there is just sentence duplicating subject. And since you did not >> explain anything, we have questions... like: INA238 does not have VDD, >> so this does not look correct. >> > > This is why a regulator is not mandatory. If ina238 does not have vdd > then one who needs ina238 may omit this prop. How about looking from > this perspective? > If a chip does not have VDD, the driver should not even try to get it for that chip. INS238 is supported by a different driver, so that does not require special code, but it needs to be spelled out in the devicetree bindings. Devicetree has a means to specify if a property is valid for a given device. Having said this, as it turns out, _none_ of the chips supported by the ina2xx and the ina238 drivers have VDD. All of them have Vs, and all but INA219 have Vbus. The bindings don't even explain which one of those is supposed to refer to "VDD". Also, regulator_get_optional() returns -ENODEV if CONFIG_REGULATOR is not enabled, so it isn't entirely optional. We can not suddenly fail to load the driver on systems with CONFIG_REGULATOR=n, so some conditional code will unfortunately be necessary. Guenter >> >> Best regards, >> Krzysztof >> > > Best regards, > Svyatoslav R.
8 березня 2023 р. 13:35:46 GMT+02:00, Guenter Roeck <linux@roeck-us.net> написав(-ла): >On 3/8/23 02:32, Svyatoslav Ryhel wrote: >> ср, 8 бер. 2023 р. о 12:27 Krzysztof Kozlowski >> <krzysztof.kozlowski@linaro.org> пише: >>> >>> On 08/03/2023 10:40, Svyatoslav Ryhel wrote: >>>> Add supply property. >>> >>> You have entire commit msg to explain and give background, but instead >>> there is just sentence duplicating subject. And since you did not >>> explain anything, we have questions... like: INA238 does not have VDD, >>> so this does not look correct. >>> >> >> This is why a regulator is not mandatory. If ina238 does not have vdd >> then one who needs ina238 may omit this prop. How about looking from >> this perspective? >> > >If a chip does not have VDD, the driver should not even try to get it >for that chip. INS238 is supported by a different driver, so that does >not require special code, but it needs to be spelled out in the devicetree >bindings. Devicetree has a means to specify if a property is valid for >a given device. > >Having said this, as it turns out, _none_ of the chips supported by >the ina2xx and the ina238 drivers have VDD. All of them have Vs, and >all but INA219 have Vbus. The bindings don't even explain which one >of those is supposed to refer to "VDD". > So you refer to vdd as to a real name. Now I understand this misunderstand. Regulator I am interested in is Vs. Since you confirmed that Vs is supported by all ina2xx there should be no contraversions further. >Also, regulator_get_optional() returns -ENODEV if CONFIG_REGULATOR >is not enabled, so it isn't entirely optional. We can not suddenly fail >to load the driver on systems with CONFIG_REGULATOR=n, so some conditional >code will unfortunately be necessary. > >Guenter > Hm, then Lars-Peter Clausen suggestion should be applicable in this case. >>> >>> Best regards, >>> Krzysztof >>> >> >> Best regards, >> Svyatoslav R. >
On Wed, Mar 08, 2023 at 11:40:23AM +0200, Svyatoslav Ryhel wrote: > Add supply property. > + vdd-supply: true > + > required: > - compatible > - reg Unless the device can work without power the supply should be required.
8 березня 2023 р. 14:54:34 GMT+02:00, Mark Brown <broonie@kernel.org> написав(-ла): >On Wed, Mar 08, 2023 at 11:40:23AM +0200, Svyatoslav Ryhel wrote: >> Add supply property. > >> + vdd-supply: true >> + >> required: >> - compatible >> - reg > >Unless the device can work without power the supply should be required. Device can work without supply defined on most devices, but in my case power is gated with gpio and devices will not work without fixed regulator.
On 08/03/2023 13:58, Svyatoslav Ryhel wrote: > > > 8 березня 2023 р. 14:54:34 GMT+02:00, Mark Brown <broonie@kernel.org> написав(-ла): >> On Wed, Mar 08, 2023 at 11:40:23AM +0200, Svyatoslav Ryhel wrote: >>> Add supply property. >> >>> + vdd-supply: true >>> + >>> required: >>> - compatible >>> - reg >> >> Unless the device can work without power the supply should be required. > > Device can work without supply defined on most devices, Are you sure they can work without any power? INA231 does not say VS supply is optional. Datasheet says: "The INA231 is typically powered by a separate supply that can range from 2.7 V to 5.5 V." Although it uses word "typically" which could suggest other design, but are you sure it can work without it? From where it gets the power? > but in my case power is gated with gpio and devices will not work without fixed regulator. BTW, wrap your lines to match mailing list style. Best regards, Krzysztof
On Wed, Mar 08, 2023 at 02:58:20PM +0200, Svyatoslav Ryhel wrote: > 8 березня 2023 р. 14:54:34 GMT+02:00, Mark Brown <broonie@kernel.org> написав(-ла): > >On Wed, Mar 08, 2023 at 11:40:23AM +0200, Svyatoslav Ryhel wrote: > >> Add supply property. > >> + vdd-supply: true > >> + > >> required: > >> - compatible > >> - reg > >Unless the device can work without power the supply should be required. > Device can work without supply defined on most devices, but in my case power is gated with gpio and devices will not work without fixed regulator. If there are devices that work without any source of power at all that would be very surprising. It doesn't matter if a particular system has a non-controllable regulator, the binding should still make it mandatory to describe that.
8 березня 2023 р. 15:46:52 GMT+02:00, Mark Brown <broonie@kernel.org> написав(-ла): >On Wed, Mar 08, 2023 at 02:58:20PM +0200, Svyatoslav Ryhel wrote: >> 8 березня 2023 р. 14:54:34 GMT+02:00, Mark Brown <broonie@kernel.org> написав(-ла): >> >On Wed, Mar 08, 2023 at 11:40:23AM +0200, Svyatoslav Ryhel wrote: >> >> Add supply property. > >> >> + vdd-supply: true >> >> + >> >> required: >> >> - compatible >> >> - reg > >> >Unless the device can work without power the supply should be required. > >> Device can work without supply defined on most devices, but in my case power is gated with gpio and devices will not work without fixed regulator. > >If there are devices that work without any source of power at all that >would be very surprising. It doesn't matter if a particular system has >a non-controllable regulator, the binding should still make it mandatory >to describe that. Then question is WHY and WHO passed driver without power supply system implemented? Why it pops only now?
On 08/03/2023 15:01, Svyatoslav Ryhel wrote: >>>>> + vdd-supply: true >>>>> + >>>>> required: >>>>> - compatible >>>>> - reg >> >>>> Unless the device can work without power the supply should be required. >> >>> Device can work without supply defined on most devices, but in my case power is gated with gpio and devices will not work without fixed regulator. >> >> If there are devices that work without any source of power at all that >> would be very surprising. It doesn't matter if a particular system has >> a non-controllable regulator, the binding should still make it mandatory >> to describe that. > > Then question is WHY and WHO passed driver without power supply system implemented? Why it pops only now? Why do you mention driver? We talk about bindings and device. What the driver does, matters less here. Best regards, Krzysztof
On Wed, Mar 08, 2023 at 04:01:44PM +0200, Svyatoslav Ryhel wrote: > 8 березня 2023 р. 15:46:52 GMT+02:00, Mark Brown <broonie@kernel.org> написав(-ла): > >If there are devices that work without any source of power at all that > >would be very surprising. It doesn't matter if a particular system has > >a non-controllable regulator, the binding should still make it mandatory > >to describe that. > Then question is WHY and WHO passed driver without power supply system implemented? Why it pops only now? You are defining a supply property. When you define a supply property that supply property should be mandatory if it's physically mandatory for the device. Please fix your mail client to word wrap within paragraphs at something substantially less than 80 columns. Doing this makes your messages much easier to read and reply to.
diff --git a/Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml b/Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml index 47af97bb4ced..0f494131fa05 100644 --- a/Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml +++ b/Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml @@ -57,6 +57,8 @@ properties: $ref: /schemas/types.yaml#/definitions/uint32 enum: [1, 2, 4, 8] + vdd-supply: true + required: - compatible - reg @@ -73,5 +75,7 @@ examples: compatible = "ti,ina220"; reg = <0x44>; shunt-resistor = <1000>; + + vdd-supply = <&vdd_3v0_sen>; }; };