Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1919213rwl; Thu, 30 Mar 2023 03:29:03 -0700 (PDT) X-Google-Smtp-Source: AK7set/F++aw5LeILG46LKe7d14XVzu6v/MH2rdxIhfXF4tNZFFD9lhWU46i8plT3c82Swm2Snd6 X-Received: by 2002:a17:90b:1241:b0:233:a836:15f4 with SMTP id gx1-20020a17090b124100b00233a83615f4mr18897419pjb.1.1680172143650; Thu, 30 Mar 2023 03:29:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680172143; cv=none; d=google.com; s=arc-20160816; b=VDoahXeCfDwKlRVsn5AkSdSN70vSQgOPCN4DfEhyiGsk7Oolo+onXo58sbAquDENhv 9/0LSFSkTq69VFfH8TRpGs1Tvm7G5Df+ltwFlLN9IRqAsoJaOAvR+a80L9+25ucnajJM Gyl1duPfe6DCzeCx4B6IswuiYUrRwX5x3Em0BRxOJeqKw0/wNHw6gKTzKkCS8v4B9Cpc Wd9ThwgpepKmjWNFKMy0ZDtahR+wMpEMBK/ajQ9LcNkeedulzz9YKhgeWcs77D+kqxS5 iUcNOPCtv4S4OFPDyu/2mShiYOPGB+6I98CCzIvEgPDftYrXCyICELjT40jiLAp4FN8s GsfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=VGHsFX//OaGQNkF65N1mnptJa5eabIq/GSa6LSUjVbg=; b=lBB2T+DJGh9OtsraBUBeuZ+mjkOvt0oQeo6N34Nl6nX5M/5amD4c4MIQHY6lmGsMO6 cZeGA1i3+CnGwNiCxQQ3bwzDtm/J7qzlFOJACPoy1enr52+PPkbII+nXUaFZ5/qOPVrA OywDfPpMZwKJRrgye6m5cpAjXtRHTuvGM5q+GIL6yk5s1a9YQ6hqDrjE0wO6hW9F4sjD 7HUh0p9wF/SXo6QR7izbgVPk9QcZy5V9Dvzw3YoxXFLQNPXLoiPFFFTUnMP8/Mc8PYzl 1dj11OQIT9PzRDGDaNLFmBtxl7E0+flUusx9FSBNNAxWbDmJyvaxD4+e43LQwD6NBwae rZVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=33l8t7HM; 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=crapouillou.net Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d9-20020a17090ab30900b002377ed22060si1165248pjr.178.2023.03.30.03.28.50; Thu, 30 Mar 2023 03:29:03 -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=@crapouillou.net header.s=mail header.b=33l8t7HM; 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=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231280AbjC3KW3 (ORCPT + 99 others); Thu, 30 Mar 2023 06:22:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230030AbjC3KW1 (ORCPT ); Thu, 30 Mar 2023 06:22:27 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5A1B72A7; Thu, 30 Mar 2023 03:22:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1680171745; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VGHsFX//OaGQNkF65N1mnptJa5eabIq/GSa6LSUjVbg=; b=33l8t7HMuPIVgsJvevZRWWGlBxpXeIbbtIXK0HZABd6ySQ8ArDFD/R0Dguky78AIjAUxu5 Y4NSZAPBIRjBdMF2LrEh8sdpJLJBc+jRvK2CFbiFdFIV/mgkiCxrZwPiZxY2D2tYB5lCX3 qNBjK/sV5ERLdK5ugN5h2HwsezYlSVo= Message-ID: Subject: Re: [PATCH] iio: adc: ad7192: Change "shorted" channels to differential From: Paul Cercueil To: Jonathan Cameron , Lars-Peter Clausen , Michael Hennerich Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Alisa Roman Date: Thu, 30 Mar 2023 12:22:23 +0200 In-Reply-To: <20230330102100.17590-1-paul@crapouillou.net> References: <20230330102100.17590-1-paul@crapouillou.net> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS 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: X-Mailing-List: linux-kernel@vger.kernel.org Le jeudi 30 mars 2023 =C3=A0 12:21 +0200, Paul Cercueil a =C3=A9crit=C2=A0: > The AD7192 provides a specific channel configuration where both > negative > and positive inputs are connected to AIN2. This was represented in > the > ad7192 driver as a IIO channel with .channel =3D 2 and .extended_name > set > to "shorted". >=20 > The problem with this approach, is that the driver provided two IIO > channels with the identifier .channel =3D 2; one "shorted" and the > other > not. This goes against the IIO ABI, as a channel identifier should be > unique. >=20 > Address this issue by changing "shorted" channels to being > differential > instead, with channel 2 vs. itself, as we're actually measuring AIN2 > vs. > itself. >=20 > Note that the fix tag is for the commit that moved the driver out of > staging. The bug existed before that, but backporting would become > very > complex further down and unlikely to happen. >=20 > Fixes: b581f748cce0 ("staging: iio: adc: ad7192: move out of > staging") Forgot to Cc: stable@vger.kernel.org D'oh. -Paul > Signed-off-by: Paul Cercueil > Co-developed-by: Alisa Roman > Signed-off-by: Alisa Roman > --- > =C2=A0drivers/iio/adc/ad7192.c | 8 ++------ > =C2=A01 file changed, 2 insertions(+), 6 deletions(-) >=20 > diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c > index 55a6ab591016..99bb604b78c8 100644 > --- a/drivers/iio/adc/ad7192.c > +++ b/drivers/iio/adc/ad7192.c > @@ -897,10 +897,6 @@ static const struct iio_info ad7195_info =3D { > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0__AD719x_CHANNEL(_si, _ch= annel1, -1, _address, NULL, > IIO_VOLTAGE, \ > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0BIT(IIO_CHAN_INFO_SCALE), ad7192_calibsys_ext_info) > =C2=A0 > -#define AD719x_SHORTED_CHANNEL(_si, _channel1, _address) \ > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0__AD719x_CHANNEL(_si, _channel= 1, -1, _address, "shorted", > IIO_VOLTAGE, \ > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0BIT(IIO_CHAN_INFO_SCALE), ad7192_calibsys_ext_info) > - > =C2=A0#define AD719x_TEMP_CHANNEL(_si, _address) \ > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0__AD719x_CHANNEL(_si, 0, = -1, _address, NULL, IIO_TEMP, 0, > NULL) > =C2=A0 > @@ -908,7 +904,7 @@ static const struct iio_chan_spec > ad7192_channels[] =3D { > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0AD719x_DIFF_CHANNEL(0, 1,= 2, AD7192_CH_AIN1P_AIN2M), > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0AD719x_DIFF_CHANNEL(1, 3,= 4, AD7192_CH_AIN3P_AIN4M), > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0AD719x_TEMP_CHANNEL(2, AD= 7192_CH_TEMP), > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0AD719x_SHORTED_CHANNEL(3, 2, A= D7192_CH_AIN2P_AIN2M), > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0AD719x_DIFF_CHANNEL(3, 2, 2, A= D7192_CH_AIN2P_AIN2M), > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0AD719x_CHANNEL(4, 1, AD71= 92_CH_AIN1), > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0AD719x_CHANNEL(5, 2, AD71= 92_CH_AIN2), > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0AD719x_CHANNEL(6, 3, AD71= 92_CH_AIN3), > @@ -922,7 +918,7 @@ static const struct iio_chan_spec > ad7193_channels[] =3D { > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0AD719x_DIFF_CHANNEL(2, 5,= 6, AD7193_CH_AIN5P_AIN6M), > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0AD719x_DIFF_CHANNEL(3, 7,= 8, AD7193_CH_AIN7P_AIN8M), > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0AD719x_TEMP_CHANNEL(4, AD= 7193_CH_TEMP), > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0AD719x_SHORTED_CHANNEL(5, 2, A= D7193_CH_AIN2P_AIN2M), > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0AD719x_DIFF_CHANNEL(5, 2, 2, A= D7193_CH_AIN2P_AIN2M), > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0AD719x_CHANNEL(6, 1, AD71= 93_CH_AIN1), > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0AD719x_CHANNEL(7, 2, AD71= 93_CH_AIN2), > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0AD719x_CHANNEL(8, 3, AD71= 93_CH_AIN3),