Received: by 2002:ab2:68c1:0:b0:1fd:9a81:d0e4 with SMTP id e1csp441055lqp; Sun, 9 Jun 2024 03:18:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU/iW5z248GBH8gMR+s3NviC46RtI2rTU00/7NSBIOL8Vuh5PLbXPEYeo2LB/MPsbcHPfcURXF5O4wxPMhq+f+Px+aYYbb8Wx8g18D8QA== X-Google-Smtp-Source: AGHT+IG4eHptsLt3ZAr/6IX5A2556F6amaM3E6bjlChj5mdliI2zWT7kqpQTCxsi8QhlOKagmGIv X-Received: by 2002:a05:6e02:19c6:b0:375:9cb9:9cec with SMTP id e9e14a558f8ab-3759cb9a07bmr24126185ab.24.1717928329766; Sun, 09 Jun 2024 03:18:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717928329; cv=pass; d=google.com; s=arc-20160816; b=jGs5OKdxPe3/HVhYOeVxMjs//eQViv5hJZYK17nTll8KDL76E1Qp74UgOmixra6KL4 L3U+HYGUy+AqW12+K+55xjN32KBVdp3nxXOyaBLmcEpQ7FzsHGKESWcMOAOoIV8mIxzm J1Clk2FL0+QJ3CNEX3O+VAUfSHyYGVZKZcPvuMHP2EeTaf01F1KF/eWzhPAQ/Nr68czF AbxXYcDsMVYOR0rG19WOAkZ7WiHjv9oxH0OBBt2wCF3zOKUHyUpH6YFKpYP9pMORXYD1 V57k38yVEURl81wbhgi462DACJNBo5YYVe4D4VqG6c68dBJZZtKB5+IkkqT1tvOr+q82 7h3A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=eSJuUjm0Vugmquxus9GuJWbtsV72tsfkptFhdPAAVUo=; fh=6hjnas98iuJU0pq46SGujuGvoniaXNlsDWG5D1l5cxU=; b=D4YgW+m7t8KNHsC9iGH5H/E7qrOkw/13jX9nF+1MChtrYXRZkY33DFVDMujDAD7e4G UUMdmqMorsIE0L+8shSDSwcq4C0QIj8x2AObQs9Ywzki9nF5tVSJpbq7S3CdZTo816qw e6+O6VG0+gloFy6nm3boTAcjdqWvl+O9V6IwxXIMT8OgKesLm3FwzPoUKlYcXae1oNo5 5pTPxK8nu34SYvXUxivkCW1SIEGCCacewkI1BSKzi9O1g+WatWH+7IilzCGSVy1ic37z x4T6sHTGlwqGobsoN4I4/z5LqkuFveeOTBFhRV59zukG3dpXtR7l8TnWZDrqPHBPe/P/ JYyg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=I3h9CX1G; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-207318-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207318-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6eae54a53d2si1042908a12.76.2024.06.09.03.18.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jun 2024 03:18:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-207318-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=I3h9CX1G; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-207318-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207318-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 53ED9281825 for ; Sun, 9 Jun 2024 10:18:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A019322EF0; Sun, 9 Jun 2024 10:18:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="I3h9CX1G" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9ABEA22619; Sun, 9 Jun 2024 10:18:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717928318; cv=none; b=QObW4J2AoOutSQ7kp2ZkmRkHXizHgwbtsAe1ODzXzu7cHEIn71xbhgBuA0F4rRDKtb02T2c8FO2n5x+JcMnKhXMO4DIM+HQzjn9URgHEktg04wqfWF699qpqtQ3nKR81BAvaN0MWGplhHQSXh6LHQwkpFgZ69ZsEHiHgNOFKlfg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717928318; c=relaxed/simple; bh=fy4wqIGP/0XPQnNOrnmxbqYJ84UFY/vN3hZc+RbEo2E=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=DFuOiIfev8tlNApnZkrRzqAE9dKHaMnY7YuNn6uQUcFf7wOvSrPwbA4Xx1pjHR0vjDvDrw9k/G531gL8BjFmp/QXofolGY40uKUBUQcbZ8/ov/GxrSntUrzQQ8xjItCxjJVDzmkD1eS8GTAQUHNPBlzK/dOk0hd05UAeFZBz5g4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=I3h9CX1G; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3CBCC2BD10; Sun, 9 Jun 2024 10:18:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717928318; bh=fy4wqIGP/0XPQnNOrnmxbqYJ84UFY/vN3hZc+RbEo2E=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=I3h9CX1GPHvxMGFCT0woGd59deltw5THyyUnHqHwwGn357o/S5lO/m6ft/Vj4HuvZ m4iRydXXf1Z8tbGu5ME+nkSY5kF5xhJC8P2lQGIhXUouDYbgeSwmwlltuCsoR8dr7i Pm7Sir7aOVVQCxu5eb44zTDuo6oJH8TY1XhNhbS/RurFdDWXrHcaZVuwN10MOXNVsc S4PeMybJwU0qCTxFajs4o26hADH7gfxraZtdLyEJfk7Ubnv9tp8q3+Ha6td0PPRN7L JDbhCcJyAeYIrxNr9AqQp5q2unefpATxjA1iDewKmuJLc1pyhv6ivtw7N+BGNTSTlE v18AETj417kjA== Date: Sun, 9 Jun 2024 11:17:40 +0100 From: Jonathan Cameron To: Francesco Dolcini Cc: =?UTF-8?B?Sm/Do28=?= Paulo =?UTF-8?B?R29uw6dhbHZlcw==?= , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , =?UTF-8?B?Sm/Do28=?= Paulo =?UTF-8?B?R29uw6dhbHZlcw==?= , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Francesco Dolcini Subject: Re: [PATCH v2 1/2] dt-bindings: iio: adc: add ti,ads1119 Message-ID: <20240609111740.1c61ce07@jic23-huawei> In-Reply-To: <20240606163529.87528-2-francesco@dolcini.it> References: <20240606163529.87528-1-francesco@dolcini.it> <20240606163529.87528-2-francesco@dolcini.it> X-Mailer: Claws Mail 4.2.0 (GTK 3.24.42; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Thu, 6 Jun 2024 18:35:28 +0200 Francesco Dolcini wrote: > From: Jo=C3=A3o Paulo Gon=C3=A7alves >=20 > Add devicetree bindings for Texas Instruments ADS1119 16-bit ADC > with I2C interface. >=20 > Datasheet: https://www.ti.com/lit/gpn/ads1119 > Signed-off-by: Jo=C3=A3o Paulo Gon=C3=A7alves > Signed-off-by: Francesco Dolcini I missed it on previous version but you only have description in here for vref and few devices power them selves from something called vref! The binding should describe the other power supplies as well and mark them as required. We've left these out too many times in the past and ended up having a patch very soon after adding them. Better to have them from the start. Driver should just use devm_regulator_get_enabled() to turn them on and register them to be turned off on driver removal, and ignore them after that. If anyone has controlled supplies and wants to do more sophisticated handling they can add it later. Note that even though the dt-binding will list them as required, if a particular DTS doesn't provide them the regulator framework will give a dummy uncontrolled regulator to represent the assumption that the power is always there. We still document them as required in the dt-binding though as other OS may not be so clever. Only needs minimal entries though - see inline Jonathan > --- > v2: > - add diff-channels and single-channel > - add XOR check to make diff/single channel property required=20 > - add interrupts, reset-gpios and vref-supply to the example=20 > - fix missing additionalProperties/unevaluatedProperties warning in chan= nels > - remove ti,gain and ti,datarate as they aren't fixed hw properties > - remove unnecessary |=20 > --- > .../bindings/iio/adc/ti,ads1119.yaml | 148 ++++++++++++++++++ > MAINTAINERS | 7 + > 2 files changed, 155 insertions(+) > create mode 100644 Documentation/devicetree/bindings/iio/adc/ti,ads1119.= yaml >=20 > diff --git a/Documentation/devicetree/bindings/iio/adc/ti,ads1119.yaml b/= Documentation/devicetree/bindings/iio/adc/ti,ads1119.yaml > new file mode 100644 > index 000000000000..cbf0d4ef3a11 > --- /dev/null > +++ b/Documentation/devicetree/bindings/iio/adc/ti,ads1119.yaml > @@ -0,0 +1,148 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/iio/adc/ti,ads1119.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Texas Instruments ADS1119 ADC > + > +maintainers: > + - Jo=C3=A3o Paulo Gon=C3=A7alves > + > +description: > + The TI ADS1119 is a precision 16-bit ADC over I2C that offers single-e= nded and > + differential measurements using a multiplexed input. It features a pro= grammable > + gain, a programmable sample rate, an internal oscillator and voltage r= eference, > + and a 50/60Hz rejection filter. > + > +properties: > + compatible: > + const: ti,ads1119 > + > + reg: > + maxItems: 1 > + > + interrupts: > + maxItems: 1 > + > + reset-gpios: > + maxItems: 1 > + avdd-supply: true dvdd-supply: true > + vref-supply: > + description: > + ADC external reference voltage (VREF). > + > + "#address-cells": > + const: 1 > + > + "#size-cells": > + const: 0 > + > + "#io-channel-cells": > + const: 1 > + > +required: > + - compatible > + - reg > + - "#address-cells" > + - "#size-cells" - avdd-supply - dvdd-supply > + > +patternProperties: > + "^channel@([0-6])$": > + $ref: adc.yaml > + type: object > + properties: > + reg: > + minimum: 0 > + maximum: 6 > + > + diff-channels: > + description: > + Differential input channels AIN0-AIN1, AIN2-AIN3 and AIN1-AIN2. > + oneOf: > + - items: > + - const: 0 > + - const: 1 > + - items: > + - const: 2 > + - const: 3 > + - items: > + - const: 1 > + - const: 2 > + > + single-channel: > + description: > + Single-ended input channels AIN0, AIN1, AIN2 and AIN3. > + minimum: 0 > + maximum: 3 > + > + oneOf: > + - required: > + - diff-channels > + - required: > + - single-channel > + > + required: > + - reg > + > + unevaluatedProperties: false > + > +additionalProperties: false > + > +examples: > + - | > + > + #include > + #include > + > + i2c { > + #address-cells =3D <1>; > + #size-cells =3D <0>; > + > + adc@40 { > + compatible =3D "ti,ads1119"; > + reg =3D <0x40>; > + interrupt-parent =3D <&gpio1>; > + interrupts =3D <25 IRQ_TYPE_EDGE_FALLING>; > + reset-gpios =3D <&gpio1 10 GPIO_ACTIVE_LOW>; > + vref-supply =3D <®_vref_ads1119>; > + #address-cells =3D <1>; > + #size-cells =3D <0>; > + #io-channel-cells =3D <1>; > + > + channel@0 { > + reg =3D <0>; > + single-channel =3D <0>; > + }; > + > + channel@1 { > + reg =3D <1>; > + diff-channels =3D <0 1>; > + }; > + > + channel@2 { > + reg =3D <2>; > + single-channel =3D <3>; > + }; > + > + channel@3 { > + reg =3D <3>; > + single-channel =3D <1>; > + }; > + > + channel@4 { > + reg =3D <4>; > + single-channel =3D <2>; > + }; > + > + channel@5 { > + reg =3D <5>; > + diff-channels =3D <1 2>; > + }; > + > + channel@6 { > + reg =3D <6>; > + diff-channels =3D <2 3>; > + }; > + }; > + }; > diff --git a/MAINTAINERS b/MAINTAINERS > index d6c90161c7bf..f1b2c4b815e2 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -22380,6 +22380,13 @@ M: Robert Richter > S: Odd Fixes > F: drivers/gpio/gpio-thunderx.c > =20 > +TI ADS1119 ADC DRIVER > +M: Francesco Dolcini > +M: Jo=C3=A3o Paulo Gon=C3=A7alves > +L: linux-iio@vger.kernel.org > +S: Maintained > +F: Documentation/devicetree/bindings/iio/adc/ti,ads1119.yaml > + > TI ADS7924 ADC DRIVER > M: Hugo Villeneuve > L: linux-iio@vger.kernel.org