Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp5665405rwr; Mon, 1 May 2023 09:02:28 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6hzUtJuyxhaITaj8ddW31us0xVQ/qFFSzI+nvxHBs//688rryiX97bAuEVvHF6EiBkuYkx X-Received: by 2002:a05:6a00:1913:b0:63d:3d2b:a7ee with SMTP id y19-20020a056a00191300b0063d3d2ba7eemr20973393pfi.18.1682956947655; Mon, 01 May 2023 09:02:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682956947; cv=none; d=google.com; s=arc-20160816; b=RKRKFGj4iCZVBpME7t2T/1/8EyR2pnxB++Df2klA0wsitZ6lOnEYcxiX9ZWpTbDQBQ 6tyqA+tFyCWxECiRqDLsdmuyOGs78P8Wyv6XJtBVVJc7SYGTkhdkW3vcxERtXlMP+sG7 Cya2iDQHdyCwB8uQh1mL02Z7qDSlJQvfZHmKBoW0jO6DIUQzgsm9ZodUcOp1CnVBIpzE LvV1e8wM+thuHDJAvY1C2FjR27raM7SdLpBIPCsY8H6Ic9sUcXblKsPbThcFB5YIQ/J3 Hg/nXDJ2NYofG5KYYE3ttWfwPfwlB0isIQLkdYe5IQhOupJllYS/Mv87x0hevzQrPO1J 2XRg== 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:subject:cc:to:from:date :dkim-signature; bh=JGQRTpNTV1i9FPaVK/yaK7Wrkj4AMhOfR+CoBb+nhCY=; b=mNODUM8vAQTofC6xT0ep/gLjO4m5bTl6cLzJJ+kIzdz7z6G0XQu8elXiNKm0IlOLdO 09XzInySTyeZIxad2Y8BPsDcG2K0GSOyBT6Z5O0GgYRh2LgIrqbdpKve2NlS+8fX0XnW RXRnUgqqYNbp8eArTo06/PpI82NbcUkdExDd0SBlaZWPXTQ/u1efk2nk34mqfSCj/bVo fd3lvJZbhC4c/LsTXnZS6zhwaTneSAR8ZCqfopjWEWEoEkEumFTvNLUlaSgxL9ECztNg TLDV8iiZRrwDYTPf/Xzbyz5X9WD7Bx0ToFKkg1UATbZL84+DQckkS2sKIFc1MT5FxxI/ anZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QbbqJgwm; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j65-20020a638b44000000b005138c1f1fccsi29958205pge.31.2023.05.01.09.02.10; Mon, 01 May 2023 09:02:27 -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=@kernel.org header.s=k20201202 header.b=QbbqJgwm; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232604AbjEAPvY (ORCPT + 99 others); Mon, 1 May 2023 11:51:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232231AbjEAPvW (ORCPT ); Mon, 1 May 2023 11:51:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94F01A9; Mon, 1 May 2023 08:51:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 34B9C614E4; Mon, 1 May 2023 15:51:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 509D0C433D2; Mon, 1 May 2023 15:51:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1682956280; bh=aV+Dz7671E26jI690tHeBhxMC+FmcjFpgAnZr8gc0lg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=QbbqJgwmf7HvS5iu5RPnIwP1Ipkay85U98dgrCh7/9PHZXrB3WW/7BZP+oK30OGWq 6eYwqSb2vdslSKdp+i/RvRjRAbCxnUyiCyNOJCXGwiVVlP9ZF7/jvjhvD1kHrraNcS zAfunxEdzWiuX+TQ5M5A7wJSbJNaa/M1jLaYix01QfxthjHdebaMJ2w1JLvjjx86KG fKgdQ8xF0HOxtC2yAX8vPk9AaDxfP508f1apmTjYvam0MnbqqMAc6Sr4lrL/c6Nte1 /MJ3YvQWRxeL9fPcryldrhix0+6arcsU3fEaRTtGflt0Ferzidlg3VMUcGRzcGO6KB eAHnclVGkujaw== Date: Mon, 1 May 2023 17:07:06 +0100 From: Jonathan Cameron To: Paul Cercueil Cc: Lars-Peter Clausen , Michael Hennerich , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Alisa Roman , Fabrizio Lamarque Subject: Re: [PATCH] iio: adc: ad7192: Change "shorted" channels to differential Message-ID: <20230501170706.415768be@jic23-huawei> In-Reply-To: <86b68c3a06aecfbdb58ddff77b4e5059f6acd2b5.camel@crapouillou.net> References: <20230330102100.17590-1-paul@crapouillou.net> <20230401154220.755e52cb@jic23-huawei> <86b68c3a06aecfbdb58ddff77b4e5059f6acd2b5.camel@crapouillou.net> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.37; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 25 Apr 2023 11:07:11 +0200 Paul Cercueil wrote: > Hi Jonathan, >=20 > Le samedi 01 avril 2023 =C3=A0 15:42 +0100, Jonathan Cameron a =C3=A9crit= =C2=A0: > > On Thu, 30 Mar 2023 12:21:00 +0200 > > Paul Cercueil wrote: > > =20 > > > 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") > > > Signed-off-by: Paul Cercueil > > > Co-developed-by: Alisa Roman > > > Signed-off-by: Alisa Roman =20 > >=20 > > +CC Fabrizio who has a fix series under review for the same driver. > >=20 > > I'm going to let this one sit on the list for a little while. > > It is a breaking ABI change (that hopefully no one will notice - > > given > > the first fix from Fabrizio shows the driver crashes on probe > > currently we > > should be safe on that). > >=20 > > Arguably just changing the index would also have been an ABI change, > > but > > that would have gotten past any code that didn't take much notice of > > the > > channel index whereas this won't. > >=20 > > Anyhow, will give it a little while for comments then pick this up > > on top of Fabrizio's fixes series.=C2=A0 Give me a poke in 2-3 weeks if= I > > seem to have lost it. =20 >=20 > Friendly ping :) Wise move :) Applied to the fixes-togreg branch of iio.git and marked for stable. Thanks, Jonathan >=20 > Cheers, > -Paul >=20 > >=20 > > Jonathan > >=20 > > =20 > > > --- > > > =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,= _channel1, -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_in= fo) > > > =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, _cha= nnel1, -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= , AD7192_CH_TEMP), > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0AD719x_SHORTED_CHANNEL(3, = 2, AD7192_CH_AIN2P_AIN2M), > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0AD719x_DIFF_CHANNEL(3, 2, = 2, AD7192_CH_AIN2P_AIN2M), > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0AD719x_CHANNEL(4, 1, = AD7192_CH_AIN1), > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0AD719x_CHANNEL(5, 2, = AD7192_CH_AIN2), > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0AD719x_CHANNEL(6, 3, = AD7192_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= , AD7193_CH_TEMP), > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0AD719x_SHORTED_CHANNEL(5, = 2, AD7193_CH_AIN2P_AIN2M), > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0AD719x_DIFF_CHANNEL(5, 2, = 2, AD7193_CH_AIN2P_AIN2M), > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0AD719x_CHANNEL(6, 1, = AD7193_CH_AIN1), > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0AD719x_CHANNEL(7, 2, = AD7193_CH_AIN2), > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0AD719x_CHANNEL(8, 3, = AD7193_CH_AIN3), =20 > > =20 >=20