From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76582CCA479 for ; Mon, 20 Jun 2022 18:13:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243887AbiFTSNP (ORCPT ); Mon, 20 Jun 2022 14:13:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238101AbiFTSNP (ORCPT ); Mon, 20 Jun 2022 14:13:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B38018B31 for ; Mon, 20 Jun 2022 11:13:14 -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 B621F6158D for ; Mon, 20 Jun 2022 18:13:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A295C341C0; Mon, 20 Jun 2022 18:13:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655748792; bh=rTVi+CZnfXIIaf1Tml2S8hS6rE1h2GFg9RZggGDbPJw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=FliM5GVQZT0hpjYRAVSohOO+orrPRL+xV3lF/066FX5ejOw1GIEwC7DhKXV8YhdwV 3xEvpTz0KnGeFO67pj54h0c9BKQu7Mi+DEE4wIYmEsGAr/4676lCNmZoe2lPKh7Mvz jblXVylhcTE71mIdzc4942ke8AcP9vmGp+yDD1heNNUsJaQUH7HwcLEWG80qQwS+Lr b0iYlHciGcicFzZEgQtshrLb6/mJQIB6zfD5b6yP1aqTrsKbo7o6fplGjT2jcIZjNz uQ9NUYMa4HHLz+wul9T5IHg56ccVtT1bqyu9HmVb/GZSrs0y88gLzznuzfVwhaeQhn pzEHCZ3r0U6hg== Date: Mon, 20 Jun 2022 19:13:07 +0100 From: Jonathan Cameron To: Andy Shevchenko Cc: linux-iio , Peter Rosin , Michael Hennerich , Lars-Peter Clausen , Vincent Whitchurch , Jonathan Cameron Subject: Re: [PATCH v2 11/17] iio: core: Introduce _inputoffset for differential channels Message-ID: <20220620191307.7f8fefa7@jic23-huawei> In-Reply-To: References: <20220619185839.1363503-1-jic23@kernel.org> <20220619185839.1363503-12-jic23@kernel.org> X-Mailer: Claws Mail 4.1.0 (GTK 3.24.34; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org On Mon, 20 Jun 2022 01:20:08 +0200 Andy Shevchenko wrote: > On Sun, Jun 19, 2022 at 8:59 PM Jonathan Cameron wrote: > > > > From: Jonathan Cameron > > > > Address an ABI gap for device where the offset of both lines in a > > differential pair may be controlled so as to allow a wider range of > > inputs, but without having any direct effect of the differential > > measurement. > > > > _offset cannot be used as to remain in line with existing usage, > > userspace would be expected to apply it as (_raw + _offset) * scale > > whereas _inputoffset is not. > > Similarly calibbias is expected to tweak the measurement seen, not > > the adjust the two lines of the differential pair. > > > > Needed for in_capacitanceX-capacitanceY_inputoffset for the > > AD7746 CDC driver. > > > > Signed-off-by: Jonathan Cameron > > > > --- > > I''m not entirely happy with the naming on this one, so if anyone > > has a better idea I'm definitely open to it! =20 >=20 > I'm not sure I got the idea behind this, but would be "tare" / > "tarepoint" / alike suitable here? > Hmm I don't think tare maps well as I've never seen it applied to a differential channel like this. Not really seen it much used outside of checkweighing (the mention brought back some horrible memories of debugging software for high speed check weighers :) So to try and explain what this is doing in more depth. This is basically applying a negative offset X to both the P(ostitive) and N(egative) lines. Hence measured capacitance =3D (P - X) - (N - X) =3D P - N the aim of X being to keep the signal hitting some internal point on the device within a range that is measurable. The relevant text on the datasheet is: "The CAPDAC can be understood as a negative capacitance connected internally to the CIN pin." "Each of the two input capacitances CX and CY between the EXC and CIN pins must be less than 4 pF (without using the CAPDACs) or must be less than 21 pF and balanced by the CAPDACs. Balancing by the CAPDACs means that both CX=E2=80=93CAPDAC(+) and CY=E2=80=93CAPDAC(=E2=80=93) are less than 4 pF." So basically if you have both sides of the differential pair that are too large (>4 pF) then you can drag them together down to that range by adding negative capacitance. Ouch that's confusing :) Jonathan