Message ID | 20230623113327.1062170-2-linux@rasmusvillemoes.dk |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp5708196vqr; Fri, 23 Jun 2023 04:46:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7ul/uBwWDnvXXw4RqEuVfwd7y8CmZvO95Ajkx5IHeY1OVk+Ppv/XvDSNxa5r84VSoCY8Zf X-Received: by 2002:a05:6a00:124f:b0:66a:4dd2:7b43 with SMTP id u15-20020a056a00124f00b0066a4dd27b43mr6622047pfi.9.1687520800658; Fri, 23 Jun 2023 04:46:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687520800; cv=none; d=google.com; s=arc-20160816; b=Dm6Y4q83Uclqqrp5bPnIdf3TMoDe6FlfyG5x1hvyhEaiUG8HeaVuXzmiOth7kFqX2+ 9sfl9Yq+k71tL6G/NsyyH5kGqXkvBcA2p4mIyGIb1gysTSMdZWDhThu55rGRphZVio2N OYIokN77mbXiRHLW1n+2hP10Mkmis8LUiBi/L68YPlunbMhMuyDH8vTtbHHD2FYWgOcj WTjGF5RW4mfm6AGpBRQyVV+P3mXCGEVoucAHSE6JyNxXcsdO/4XcJ0rT/Ue0Dyh2ChOO H/A1xLL0ETdegZkgYwOVW06UjPXTuQCaMxFqWryQqkWZtBmSXlHlwzjNWNeUrhK08TMs vbgA== 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=ItH4Pg7jxqco9mS/zUwcLIsvKjoWsb65kGsf9QvB3Qs=; b=oRaK9JZcer7J3PoXcnKgJF+HtV8m11tInslLEQX43m/F/8igyNEQvXm9CngV2Kc7Yy JQcSTBaHan1Sl7W5CJsoJ+ylNDstx7V4uXSYs9UxMx3Dr/qAcsgrZdp8iPOEe/n8bQ0o haku5m6CqNA9KL729jn0v7qestYR0KnimozpmWutlcEqvezGqErZoNKxQwkgcZjQotha zs5kUelhWd4qLOKhCnd4tzNLI3+xqi2juPxTaY1NUUpPEnqJHBdZzliX2rnDqlnSPThY yKzL/cSUR09gYjPNNryeRFSLGx9FH9NqAON9mk2LwEdzDMJTQGGI6gv1Lpc6WuzvNdDe 5S7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=UOJiSnXV; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x2-20020aa79562000000b0065df7ca02ffsi8525932pfq.42.2023.06.23.04.46.28; Fri, 23 Jun 2023 04:46:40 -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=@rasmusvillemoes.dk header.s=google header.b=UOJiSnXV; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231547AbjFWLdk (ORCPT <rfc822;maxin.john@gmail.com> + 99 others); Fri, 23 Jun 2023 07:33:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231292AbjFWLdh (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 23 Jun 2023 07:33:37 -0400 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0C2CD3 for <linux-kernel@vger.kernel.org>; Fri, 23 Jun 2023 04:33:35 -0700 (PDT) Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2b45bc83f26so9558211fa.0 for <linux-kernel@vger.kernel.org>; Fri, 23 Jun 2023 04:33:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; t=1687520014; x=1690112014; 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=ItH4Pg7jxqco9mS/zUwcLIsvKjoWsb65kGsf9QvB3Qs=; b=UOJiSnXVBXDwtiw7hkY3RS495zKUvrRo3305RzR5u/Ea5HWCNy8TZb6T2DYp45BYc1 7Eli8yLXnwF7pmC4Cm253Z1VzQId5Xov5p6hhPu/OO5TXM5rg7pmqSzogWxG5pO0rDs3 RdqUvzIoMuw1zQDKcNCcu2d7pZKca19joPPcs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687520014; x=1690112014; 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=ItH4Pg7jxqco9mS/zUwcLIsvKjoWsb65kGsf9QvB3Qs=; b=IIobY1wXd0qDX+ashm1PiYGXMTqgLwh9HSlV6JNqzc43R92XcwBbQ2WnQvROgtJ1Py 6N/YYixgo9g6LUMwsApv+dCIhK0q5QvhC7Wq2Yr3sfsQalubs1l7LDQT7cGUpu13OpaM VQCR0zAXPernF7h4d3+tDEk3lbTelixRzz5abL5bb2urG4sCr+tOs2lEULpOsXE6hnuG Hkoa9PMfZSeoQIJy6oXkwapE6gD/FluzHVlvIzSj/Nh81hcRSiXyHmUbQJ4DCoZuxcRP 2Bc2AJiA5TrG05KQOEYrSGckMwgUe+rbFuW09+f1dMnNUTtEoNAQjvbYpNaRY5Y/luie PWfg== X-Gm-Message-State: AC+VfDz2sUHmUh67czrD4Cz4LpPQyElmXljv1NwTZ30VqWnj2DCIjzF+ Z7eZiZrA5FRvldlbxrxjwnxiyDWY0/Gy8CGYG57VaA== X-Received: by 2002:a2e:961a:0:b0:2b5:7af9:f390 with SMTP id v26-20020a2e961a000000b002b57af9f390mr7940759ljh.47.1687520014000; Fri, 23 Jun 2023 04:33:34 -0700 (PDT) Received: from prevas-ravi.prevas.se ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id n10-20020a2e720a000000b002b471efb253sm1711605ljc.46.2023.06.23.04.33.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 04:33:33 -0700 (PDT) From: Rasmus Villemoes <linux@rasmusvillemoes.dk> To: Cosmin Tanislav <cosmin.tanislav@analog.com>, Lars-Peter Clausen <lars@metafoo.de>, Michael Hennerich <Michael.Hennerich@analog.com>, Jonathan Cameron <jic23@kernel.org>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Conor Dooley <conor+dt@kernel.org> Cc: devicetree@vger.kernel.org, Rasmus Villemoes <linux@rasmusvillemoes.dk>, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] dt-bindings: iio: ad74413r: add binding for digital input threshold Date: Fri, 23 Jun 2023 13:33:25 +0200 Message-Id: <20230623113327.1062170-2-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230623113327.1062170-1-linux@rasmusvillemoes.dk> References: <20230623113327.1062170-1-linux@rasmusvillemoes.dk> 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,URIBL_BLOCKED autolearn=unavailable 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?1769493810830821122?= X-GMAIL-MSGID: =?utf-8?q?1769493810830821122?= |
Series |
iio: ad74413r: allow configuring digital input threshold
|
|
Commit Message
Rasmus Villemoes
June 23, 2023, 11:33 a.m. UTC
Allow specifying the threshold for which the channels configured as
digital input change state.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
Running dt_binding_check on this with a too small or large value in
the example does give me an error, but the multipleOf does not seem to
be enforced; the value 1234567 is not flagged. I don't know if that's
expected (maybe I have too old versions of something).
.../devicetree/bindings/iio/addac/adi,ad74413r.yaml | 10 ++++++++++
1 file changed, 10 insertions(+)
Comments
On Fri, Jun 23, 2023 at 01:33:25PM +0200, Rasmus Villemoes wrote: > Allow specifying the threshold for which the channels configured as > digital input change state. > > Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> > --- > > Running dt_binding_check on this with a too small or large value in > the example does give me an error, but the multipleOf does not seem to > be enforced; the value 1234567 is not flagged. I don't know if that's > expected (maybe I have too old versions of something). That's one for Rob. I checked a few others and behaviour was the same there. > .../devicetree/bindings/iio/addac/adi,ad74413r.yaml | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml b/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml > index 590ea7936ad7..1f90ce3c7932 100644 > --- a/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml > +++ b/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml > @@ -51,6 +51,14 @@ properties: > Shunt (sense) resistor value in micro-Ohms. > default: 100000000 > > + digital-input-threshold-microvolt: Should this not have an adi vendor prefix, similar to "adi,digital-input-threshold-mode-fixed"? Cheers, Conor. > + description: > + Comparator threshold used by the channels configured to use the > + digital input function. > + minimum: 500000 > + maximum: 16000000 > + multipleOf: 500000 > + > reset-gpios: > maxItems: 1 > > @@ -143,6 +151,8 @@ examples: > refin-supply = <&ad74413r_refin>; > reset-gpios = <&gpio2 6 GPIO_ACTIVE_LOW>; > > + digital-input-threshold-microvolt = <4000000>; > + > channel@0 { > reg = <0>; > > -- > 2.37.2 >
On Fri, Jun 23, 2023 at 01:33:25PM +0200, Rasmus Villemoes wrote: > Allow specifying the threshold for which the channels configured as > digital input change state. > > Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> > --- > > Running dt_binding_check on this with a too small or large value in > the example does give me an error, but the multipleOf does not seem to > be enforced; the value 1234567 is not flagged. I don't know if that's > expected (maybe I have too old versions of something). Thanks for the report. Indeed, 'multipleOf' was not handled correctly. I'll push a fix to dtschema shortly. Rob
On Fri, Jun 23, 2023 at 05:44:50PM +0100, Conor Dooley wrote: > On Fri, Jun 23, 2023 at 01:33:25PM +0200, Rasmus Villemoes wrote: > > Allow specifying the threshold for which the channels configured as > > digital input change state. > > > > Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> > > --- > > > > Running dt_binding_check on this with a too small or large value in > > the example does give me an error, but the multipleOf does not seem to > > be enforced; the value 1234567 is not flagged. I don't know if that's > > expected (maybe I have too old versions of something). > > That's one for Rob. I checked a few others and behaviour was the same > there. > > > .../devicetree/bindings/iio/addac/adi,ad74413r.yaml | 10 ++++++++++ > > 1 file changed, 10 insertions(+) > > > > diff --git a/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml b/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml > > index 590ea7936ad7..1f90ce3c7932 100644 > > --- a/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml > > +++ b/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml > > @@ -51,6 +51,14 @@ properties: > > Shunt (sense) resistor value in micro-Ohms. > > default: 100000000 > > > > + digital-input-threshold-microvolt: > > Should this not have an adi vendor prefix, similar to > "adi,digital-input-threshold-mode-fixed"? Yes. Rob
On 23/06/2023 23.57, Rob Herring wrote: > On Fri, Jun 23, 2023 at 05:44:50PM +0100, Conor Dooley wrote: >> On Fri, Jun 23, 2023 at 01:33:25PM +0200, Rasmus Villemoes wrote: >>> diff --git a/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml b/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml >>> index 590ea7936ad7..1f90ce3c7932 100644 >>> --- a/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml >>> +++ b/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml >>> @@ -51,6 +51,14 @@ properties: >>> Shunt (sense) resistor value in micro-Ohms. >>> default: 100000000 >>> >>> + digital-input-threshold-microvolt: >> >> Should this not have an adi vendor prefix, similar to >> "adi,digital-input-threshold-mode-fixed"? > > Yes. OK. But I'm not really sure what the rules are for when such a prefix must be added, so some guidance would be appreciated. There's - DO use a vendor prefix on device specific property names. Consider if properties could be common among devices of the same class. And my thinking was that a threshold for when a digital input should count as high/low would be a rather generic thing, so not particularly device specific. Also, this very binding has a shunt-resistor-micro-ohms, and the individual channels have a drive-strength-microamp (granted, that latter one is a recent one of mine and may have slipped through review?). I can certainly understand that when a property specifies a raw value to put into some register (or field), that's very specific to that chip (or small family of chips) - the adi,ch-func properties fall into that category. Rasmus
On 26/06/2023 10:15, Rasmus Villemoes wrote: > On 23/06/2023 23.57, Rob Herring wrote: >> On Fri, Jun 23, 2023 at 05:44:50PM +0100, Conor Dooley wrote: >>> On Fri, Jun 23, 2023 at 01:33:25PM +0200, Rasmus Villemoes wrote: >>>> diff --git a/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml b/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml >>>> index 590ea7936ad7..1f90ce3c7932 100644 >>>> --- a/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml >>>> +++ b/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml >>>> @@ -51,6 +51,14 @@ properties: >>>> Shunt (sense) resistor value in micro-Ohms. >>>> default: 100000000 >>>> >>>> + digital-input-threshold-microvolt: >>> >>> Should this not have an adi vendor prefix, similar to >>> "adi,digital-input-threshold-mode-fixed"? >> >> Yes. > > OK. But I'm not really sure what the rules are for when such a prefix > must be added, so some guidance would be appreciated. There's > > - DO use a vendor prefix on device specific property names. Consider if > properties could be common among devices of the same class. > > And my thinking was that a threshold for when a digital input should > count as high/low would be a rather generic thing, so not particularly > device specific. Then find some more users of it. > > Also, this very binding has a shunt-resistor-micro-ohms, and the > individual channels have a drive-strength-microamp (granted, that latter > one is a recent one of mine and may have slipped through review?). I can > certainly understand that when a property specifies a raw value to put > into some register (or field), that's very specific to that chip (or > small family of chips) - the adi,ch-func properties fall into that category. Best regards, Krzysztof
On Mon, 26 Jun 2023 10:29:22 +0200 Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote: > On 26/06/2023 10:15, Rasmus Villemoes wrote: > > On 23/06/2023 23.57, Rob Herring wrote: > >> On Fri, Jun 23, 2023 at 05:44:50PM +0100, Conor Dooley wrote: > >>> On Fri, Jun 23, 2023 at 01:33:25PM +0200, Rasmus Villemoes wrote: > >>>> diff --git a/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml b/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml > >>>> index 590ea7936ad7..1f90ce3c7932 100644 > >>>> --- a/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml > >>>> +++ b/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml > >>>> @@ -51,6 +51,14 @@ properties: > >>>> Shunt (sense) resistor value in micro-Ohms. > >>>> default: 100000000 > >>>> > >>>> + digital-input-threshold-microvolt: > >>> > >>> Should this not have an adi vendor prefix, similar to > >>> "adi,digital-input-threshold-mode-fixed"? > >> > >> Yes. > > > > OK. But I'm not really sure what the rules are for when such a prefix > > must be added, so some guidance would be appreciated. There's > > > > - DO use a vendor prefix on device specific property names. Consider if > > properties could be common among devices of the same class. > > > > And my thinking was that a threshold for when a digital input should > > count as high/low would be a rather generic thing, so not particularly > > device specific. > > Then find some more users of it. The hi8435 could make use of this, but it currently doesn't get these thresholds from DT (despite there being a reasonable argument that these should be characteristics of the board wiring etc) but rather from userspace controls. Might well be something in gpio drivers? Linus / Bartosz, any of the input gpio devices really threshold detectors? If so is there any precedence for a DT binding to set the threshold? > > > > > Also, this very binding has a shunt-resistor-micro-ohms, and the > > individual channels have a drive-strength-microamp (granted, that latter > > one is a recent one of mine and may have slipped through review?). I can > > certainly understand that when a property specifies a raw value to put > > into some register (or field), that's very specific to that chip (or > > small family of chips) - the adi,ch-func properties fall into that category. > > Best regards, > Krzysztof >
diff --git a/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml b/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml index 590ea7936ad7..1f90ce3c7932 100644 --- a/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml +++ b/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml @@ -51,6 +51,14 @@ properties: Shunt (sense) resistor value in micro-Ohms. default: 100000000 + digital-input-threshold-microvolt: + description: + Comparator threshold used by the channels configured to use the + digital input function. + minimum: 500000 + maximum: 16000000 + multipleOf: 500000 + reset-gpios: maxItems: 1 @@ -143,6 +151,8 @@ examples: refin-supply = <&ad74413r_refin>; reset-gpios = <&gpio2 6 GPIO_ACTIVE_LOW>; + digital-input-threshold-microvolt = <4000000>; + channel@0 { reg = <0>;