Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp1649075lqz; Mon, 1 Apr 2024 12:38:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUTpFT+z9mr5+JbTwnDWGgGkALB+kvbdC7tgiuRpdkIM2dCjJzQ2ToQR7fM6H5gapqoKMpNyQtL14vQPuodbv2tXTbVL8QVtPEB/KZHbg== X-Google-Smtp-Source: AGHT+IGklmULr6uGXChvirgd7uBsXqCiYzo7LrpfpqqOTRBQTppvS3kag4ng69AxtWkdhl7tO3sw X-Received: by 2002:a05:6a00:1a8c:b0:6e6:451c:a519 with SMTP id e12-20020a056a001a8c00b006e6451ca519mr10632738pfv.5.1712000297076; Mon, 01 Apr 2024 12:38:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712000297; cv=pass; d=google.com; s=arc-20160816; b=WIQUxf8BzL55UHI2lQxI4+XEH7YniDr+I4f/P0e4agHc8kzBicnJ75cSfj99CqEKw6 SYwXnxDkM3hEnTucXX94jKRlDorCHDVbwSODGxFgR3BlSZ9EboOBGEZzfQInkpZs9CPd v1MyhBRuP9bYlNLUVNG0NU7y/uzPjrWnqgu8tss2al3su8vt8yZlrB+xO9BKZLmdbGHs qm1/vKHiJ7s6awWesmYzgJGRtnsrZmLtelut4qwdbmo0VpjQ0oScdPri6PptLMgfZ2NC WTh/IAzXTyblwtnvy5OHtf0N9UBWm9OHsNHPXXpxPPB/dbEELfSd0PpQJloqGJoyw5Ko 9WRg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=Ud/NuSHYkcJgOcZcI1q1wClx6fmxezAeXXOYZJFZkjI=; fh=4uAXUXlMpRLZlyxW/oY40FdUBCCedanjnF1I9E1RtV0=; b=NM9jojlkKxoOw57eIuiG/r+8Bq3F0nk2lBjfZMz3+5gyDFYZ6mrdGzkO4YSE2NaCYz RXbSFxjNewXLp5g5UEXqksV49qSEBrphMG+/wwsSBu1PSrmNXX6xF5DotxFFf314qj3b W8fyx/L38FeAJ+LRS5ixK5Q5uCXzkWjX8aaAO6TxVt9GHaiMG/0qDny9TtXumrYxA3hE U3IqYLuGlpFG4CEGc+tmSGmjPELPk8rJjGujNDM+6JzKh3rCrHmRfobPyqnQchR+2RfT XSwswDYphMjyW6H9PNNBVTgrYlTXEMbxOkkk7F32X8HSI2XPdOoj145qrsH41FAenDA6 9i4Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=XnqFa7q2; arc=pass (i=1 spf=pass spfdomain=baylibre.com dkim=pass dkdomain=baylibre-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-126995-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-126995-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id x9-20020a056a00188900b006eabc1f0602si10316886pfh.124.2024.04.01.12.38.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Apr 2024 12:38:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-126995-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=XnqFa7q2; arc=pass (i=1 spf=pass spfdomain=baylibre.com dkim=pass dkdomain=baylibre-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-126995-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-126995-linux.lists.archive=gmail.com@vger.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 B494D281CDC for ; Mon, 1 Apr 2024 19:38:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3927C53380; Mon, 1 Apr 2024 19:38:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="XnqFa7q2" Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7B40F1EB37 for ; Mon, 1 Apr 2024 19:38:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712000286; cv=none; b=cb/q+KIn/EkKr49q4LtievjcTsixYVylllUJuB6/VDMDCKxYRXYvjpHJfKLzZPV3mVml6PCc0fQjTMtwwQRHx+f4rF4Z20xw3gYf7FAIgVnDXb0SQiv31/ghZgDw2nCZ0QyD/NpdkzGRPB/eXlzY8DA3GKv7umvNNZaRurDYqy8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712000286; c=relaxed/simple; bh=kAU0aYIXhgkFLYZSUSg5PZ1VapVsVEfo2juD1x2+LDY=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=ppX33oFiLeJx3gIJd451BXvkaQClo2D6I1ol4kCuPrGApTJnx/tMTGiwOC+O9ihr7Gi6hnTCWPr4IJQD8MtTzSrayPYFTy1f2k3PLJhI4uUwaWcGVI0YR3lTV3eDd0Z/3fX1+niYeCfWq1Qrn98RsWvKysVe5CvUDZDCyzBzGd8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=XnqFa7q2; arc=none smtp.client-ip=209.85.208.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-2d4a8bddc21so60748581fa.0 for ; Mon, 01 Apr 2024 12:38:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1712000281; x=1712605081; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Ud/NuSHYkcJgOcZcI1q1wClx6fmxezAeXXOYZJFZkjI=; b=XnqFa7q2kaUbh9akksIsO9vGrmTzNSofNeX5i4+JyFzL3ABvQjWYeAkAUZtrYBFIu8 EMDZJSMQuFnZwuD4iSm8SVLp2lX/Onzu+xtesypCAPmKqKSq19pZnniJNgIUA7bUfpOe CyWmWkLktJMCilb9LTChYDECqlskNDmw1SzeFmpiB+ABuAAkCPwqs8vaoHCzxFmduF2q gqK6UV0ZI2GB/2XbyQDUrhYbHFwejKjc8OWNN5rndcfz4FKAwmfd1NiVvRr2higpg+8V zFQR7rnszjsuzD+eoUzw3c/c+MBRNaJLh8/vQRNKr/DQ/vl3LnNE0xF4PAlL+MoGHuA6 Vufg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712000282; x=1712605082; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ud/NuSHYkcJgOcZcI1q1wClx6fmxezAeXXOYZJFZkjI=; b=mMFvEhd8U0ZfdhmpQzVF+BBTWbK/ejzOo4TrZE9tsIFXkzqOh/bA6WDg0ngNc5CCat JkmE1jN/EqMEzJN4hQ3qtd8yI7dddQjjq3ho/6bgJB8La9OXbWR5TEBgaupQ+jSZJLV0 Hw2Nku6Gymh+LWv3eS38GGSIz82qUgo7RW9kUY8PYELkR4+pk2Rh5i9LUWIYaV2184yc /qJTQqz6W2v0Mw3EkpGjBIcrJ6zIwTCe1UJMzNsX5ydk/5Wafe+ELE/QnHNjzS3uYN1G Q3GTdF2Oq/YxeVIYrXUp+nM9tHuWf08VrfOy7f4/RGAl+XtyIMFFezE/lzYLwU1rmlQJ osdg== X-Forwarded-Encrypted: i=1; AJvYcCXPBBYtqISxDxLYUfu9ZAoy7R9F3Uq8DjgwmHFndVafRGXPDfsNkxwL9BdMhDR0g9upsz41AMFdhVIokmNHG8fYXJAr5qRgU7ZslnHb X-Gm-Message-State: AOJu0YyJn2UcQMoePDQar/FKG3fMRjvrR5Ic0NJYFy9qcVqTGVlq9wVt cquTctV5NcdbadE3nWcGWczZUEWGxirVozj8e5orL7pW8q+969mxxZBkwQbYj9qddlpYY0WGBPx 4vaO9vCgctM/6oUAlNPboPOartAkwcT/BhJbZAPDvIx7sfTVq X-Received: by 2002:a2e:98d8:0:b0:2d8:113c:d58 with SMTP id s24-20020a2e98d8000000b002d8113c0d58mr3269028ljj.20.1712000281529; Mon, 01 Apr 2024 12:38:01 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240401-ad4111-v1-0-34618a9cc502@analog.com> <20240401-ad4111-v1-1-34618a9cc502@analog.com> In-Reply-To: <20240401-ad4111-v1-1-34618a9cc502@analog.com> From: David Lechner Date: Mon, 1 Apr 2024 14:37:50 -0500 Message-ID: Subject: Re: [PATCH 1/6] dt-bindings: adc: ad7173: add support for ad411x To: dumitru.ceclan@analog.com Cc: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Dumitru Ceclan Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Apr 1, 2024 at 10:10=E2=80=AFAM Dumitru Ceclan via B4 Relay wrote: > > From: Dumitru Ceclan > > Add support for: AD4111, AD4112, AD4114, AD4115, AD4116. > > AD411x family ADCs support a VCOM pin, dedicated for single-ended usage. > AD4111/AD4112 support current channels, usage is implemented by > specifying channel reg values bigger than 15. > > Signed-off-by: Dumitru Ceclan > --- > .../devicetree/bindings/iio/adc/adi,ad7173.yaml | 59 ++++++++++++++++= +++++- > 1 file changed, 57 insertions(+), 2 deletions(-) > > diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7173.yaml b/= Documentation/devicetree/bindings/iio/adc/adi,ad7173.yaml > index ea6cfcd0aff4..bba2de0a52f3 100644 > --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7173.yaml > +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7173.yaml > @@ -19,7 +19,18 @@ description: | > primarily for measurement of signals close to DC but also delivers > outstanding performance with input bandwidths out to ~10kHz. > > + Analog Devices AD411x ADC's: > + The AD411X family encompasses a series of low power, low noise, 24-bit= , > + sigma-delta analog-to-digital converters that offer a versatile range = of > + specifications. They integrate an analog front end suitable for proces= sing > + fully differential/single-ended and bipolar voltage inputs. > + > Datasheets for supported chips: > + https://www.analog.com/media/en/technical-documentation/data-sheets/= AD4111.pdf > + https://www.analog.com/media/en/technical-documentation/data-sheets/= AD4112.pdf > + https://www.analog.com/media/en/technical-documentation/data-sheets/= AD4114.pdf > + https://www.analog.com/media/en/technical-documentation/data-sheets/= AD4115.pdf > + https://www.analog.com/media/en/technical-documentation/data-sheets/= AD4116.pdf > https://www.analog.com/media/en/technical-documentation/data-sheets/= AD7172-2.pdf > https://www.analog.com/media/en/technical-documentation/data-sheets/= AD7172-4.pdf > https://www.analog.com/media/en/technical-documentation/data-sheets/= AD7173-8.pdf > @@ -31,6 +42,11 @@ description: | > properties: > compatible: > enum: > + - adi,ad4111 > + - adi,ad4112 > + - adi,ad4114 > + - adi,ad4115 > + - adi,ad4116 > - adi,ad7172-2 > - adi,ad7172-4 > - adi,ad7173-8 > @@ -125,10 +141,19 @@ patternProperties: > > properties: > reg: > + description: > + Reg values 16-19 are only permitted for ad4111/ad4112 current = channels. > minimum: 0 > - maximum: 15 > + maximum: 19 This looks wrong. Isn't reg describing the number of logical channels (# of channel config registers)? After reviewing the driver, I see that > 16 is used as a way of flagging current inputs, but still seems like the wrong way to do it. See suggestion below. > > diff-channels: > + description: > + For using current channels specify only the positive channel. > + (IIN2+, IIN2=E2=88=92) -> diff-channels =3D <2 0> I find this a bit confusing since 2 is already VIN2 and 0 is already VIN0. I think it would make more sense to assign unique channel numbers individually to the negative and positive current inputs. Also, I think it makes sense to use the same numbers that the registers in the datasheet use (8 - 11 for negative and 12 to 15 for positive). So: (IIN2+, IIN2=E2=88=92) -> diff-channels =3D <13 10> > + > + Family AD411x supports a dedicated VCOM voltage input. > + To select it set the second channel to 16. > + (VIN2, VCOM) -> diff-channels =3D <2 16> The 411x datasheets call this pin VINCOM so calling it VCOM here is a bit confusing. Also, do we need to add a vincom-supply to get this voltage? Or is it safe to assume it is always connected to AVSS? The datasheet seems to indicate that the latter is the case. But then it also has this special case (at least for AD4116, didn't check all datasheets) "VIN10, VINCOM (single-ended or differential pair)". If it can be used as part of a fully differential input, we probably need some extra flag to indicate that case. Similarly, do we need special handling for ADCIN15 on AD4116? It has a "(pseudo differential or differential pair)" notation that other inputs don't. In other words, it is more like VINCOM than it is to the other ADCINxx pins. So we probably need an adcin15-supply for this pin to properly get the right channel configuration. I.e. the logic in the IIO driver would be if adcin15-supply is present, any channels that use this input are pseudo-differential, otherwise any channels that use it are fully differential. > items: > minimum: 0 > maximum: 31 > @@ -166,7 +191,6 @@ allOf: > - $ref: /schemas/spi/spi-peripheral-props.yaml# > > # Only ad7172-4, ad7173-8 and ad7175-8 support vref2 > - # Other models have [0-3] channel registers Did you forget to remove reg: maximum: 3 from this if statement that this comment is referring to? > - if: > properties: > compatible: > @@ -187,6 +211,37 @@ allOf: > - vref > - refout-avss > - avdd > + > + - if: > + properties: > + compatible: > + contains: > + enum: > + - adi,ad4114 > + - adi,ad4115 > + - adi,ad4116 > + - adi,ad7173-8 > + - adi,ad7175-8 > + then: > + patternProperties: > + "^channel@[0-9a-f]$": > + properties: > + reg: > + maximum: 15 As with the previous reg comment, this if statement should not be needed since maximum should not be changed to 19. > + > + - if: > + properties: > + compatible: > + contains: > + enum: > + - adi,ad7172-2 > + - adi,ad7175-2 > + - adi,ad7176-2 > + - adi,ad7177-2 > + then: > + patternProperties: > + "^channel@[0-9a-f]$": > + properties: > reg: > maximum: 3 It looks to me like AD7172-4 actually has 8 possible channels rather than 16. So it would need a special condition as well. But that is a bug in the previous bindings and should therefore be fixed in a separate patch.