Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp573038lqp; Sat, 13 Apr 2024 09:07:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWEVuNay7pjnot+Wlokt/iJI59ZTYAzGhzaWZ8USMV2ynmA5AhZ3i0seZody4pfHsqyGofPxAeCLlhKs4af1jzym5MdAHaQrNUW/9t4Cg== X-Google-Smtp-Source: AGHT+IGdBfFxpYdvt6C2/i1bpfYk8A9BQFp3Hm4tzV3zDOrnGoY+A+ZPQpUOMgqYhPiYQ5sqQ5Yx X-Received: by 2002:a05:622a:64d:b0:434:622b:d054 with SMTP id a13-20020a05622a064d00b00434622bd054mr5950125qtb.66.1713024468003; Sat, 13 Apr 2024 09:07:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713024467; cv=pass; d=google.com; s=arc-20160816; b=lnIpfIFDBuae+28YhlmVh8dP2RpTX1u1ZycBMV+RmY72S5h27ZybE2yevvFrn4+O/H 0R/ltO9JepAYj8HFnQsD8uMEqdhglOqQbhy0nCDSoL2tDcI+dPIpuWrudxt/5oJjn3Sh MMB6rYE0xVfIpj9h/9wgSBXYHtZpIP+OCIqqEf2Qt5xhY0aMjiXt7papDXxU87FX+rsC FFsY9WOm6evfqIfhzKMNmyx9G/4N/2yHxilVr2Y9dSDRi/MHnsmzjsY6wCv+verbd8im rPKdktl3AKqR9wza9YpoQ/NbDU3y69IjRYZTIeRgcJvGUiH23Gi97kVU+GwN00sdOwWz hHSA== 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=jr2Q386wjiVGMXKu2YxllI+rdwysZePI8uG9axTzVg8=; fh=me8kXRm7+Lz05CdPwDPXfozsIIcxHWzDZpOnSIzWcMk=; b=NIfzfX/dA48cVYwM1EzOCZFKDEWtADFBA5ejodg6SSLEBYwaiZ1UCgOmVqehVn7U65 n8Bab87EB30/UyhVkBG4bfaNXsG+UHQsv6n7WnYbEhQIo76Ta1/+FAUMl5S8dET8XCnO 1gSfGv4op7Xyud3CoVheTEpbdJ/IkwGUxrx2PQHTQsX8gcTevIMUtvxZZrryMBcri7LQ p9PA0RBf3aCnW/ugvpxA9RcfPBSjp17PcgT391meMMnM9KQWb+ooV071wTLCQbIDFGi5 063yF0dypb86VcBlz3ekxN1PTyOlXGBElCOvoDZ6fxErvK2ccnyT8xMTIlVVAr6fSGcf r5Rw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Mzcw2efK; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-143800-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143800-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id w5-20020a05622a134500b004367f2caf39si4659890qtk.380.2024.04.13.09.07.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Apr 2024 09:07:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-143800-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Mzcw2efK; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-143800-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143800-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id B6A371C20AF9 for ; Sat, 13 Apr 2024 16:07:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7CA1D4CB41; Sat, 13 Apr 2024 16:07:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Mzcw2efK" 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 91D033D68; Sat, 13 Apr 2024 16:07: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=1713024458; cv=none; b=AXByBnSg2HpxaTI5+wIJ39KxFhJiO7lADXwPJGTTfZ7/aMPqqsoGAWLzMfMorSO1rBf7EzO8mbj4+VXyifD6ke7WNLhcJJPl0FWlWJwZ3FCgtGNvt8b55m3m7ZuhkjJmmM+00v8fFplypzevjSPvPG016ZKEritB0xabGBZNs2o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713024458; c=relaxed/simple; bh=Q0/0rpvxAebSkQxJM0MspGBlJ94tc5YKn/wuQsvYPOY=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RAfO/8y647w9djzNm7BT8RutVw43eCLlUv5p8ClP1NYFpuyIYffBvniJt7bTO1ADloaOcf9h1uEohXQzaCJpkzQ/tWLyFq3uzygY6eksPY6x0o0n2imjwYkwqt/z7rE3U79q1AtCK+s0ccbAN9WgtG3IzbXiqPKTFGmiC8ZV7AY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Mzcw2efK; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0A4AC3277B; Sat, 13 Apr 2024 16:07:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713024458; bh=Q0/0rpvxAebSkQxJM0MspGBlJ94tc5YKn/wuQsvYPOY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Mzcw2efKX/5hB0dsAbm+IM0eJaUYCk4JEHJA7esEchc+oBSNlquHjj0h5tbkccMzU Fh5Sz+GoRvwE47ZZ3u1HZAKQGZefSKQ6AAvS2jVp+JaVn6VpDOASaQjGKG7Wu6KtT1 oxpPfxJEXOmtSbGi7pf6xWZumtpaI9yLaqKVnxKjwBS3SifgRHeJVC2OtZE27EUvlB zKW41vpVUYmTxujwO45+WoRteq3Us3wdY4alOI8pAMtbZAKV2kApnPXZFL9RXPKcot LCP9hdlPb8B/oHzpcXovOlWImemlK9FuqscwUlm7AuEOxWrebmkZ/K9bzsHh3rW4f+ Dm8tey5JNoI7A== Date: Sat, 13 Apr 2024 17:07:22 +0100 From: Jonathan Cameron To: David Lechner Cc: Marcelo Schmitt , lars@metafoo.de, Michael.Hennerich@analog.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, marcelo.schmitt1@gmail.com, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 0/2] Add support for AD4000 series Message-ID: <20240413170722.44399921@jic23-huawei> In-Reply-To: References: X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; 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=US-ASCII Content-Transfer-Encoding: 7bit > > > > - Span compression and offset. > > For non-differential ADCs, enabling the span compression requires an input offset. > > Link: https://www.analog.com/media/en/technical-documentation/data-sheets/AD4000-4004-4008.pdf > > page 18 > > and > > Link: https://www.analog.com/media/en/technical-documentation/data-sheets/ad4002-4006-4010.pdf > > page 19 > > I updated the _offset attribute for those ADCs according to span compression > > being enabled or not. Is it okay to have an attribute update cause an update to > > another one? Yes. Happens all the time and it's not possible in general to define an ABI where this doesn't happen on some combinations. scale in particular can be affected in lots of fun non linear ways by other attributes. How you handle it is a bit up to the driver writer and interpretation of what is most natural for a given combination. Sometimes: a) Stash previously set value of the other attributes and try to find a new value as near as possible give constraint of whatever else was just written b) Just use whatever the register value now corresponds to given the other attribute changed Either way userspace needs to take another look at other attributes to see if they changed after changing anything that might have an influence. It can then update them however it likes. > > Maybe also make the span compression a dt property and have it fixed after probe? > > This doesn't sound like something that belongs in DT since it doesn't > depend on the physical properties of what is wired to the input. > > But the fact that offset should not be read until after scale is set > sounds like a quirk that would be worth documenting in some > chip-specific docs. Agreed - it is useful to hint at this but in general software has to check everything as there are lots of these sorts of interactions :( Jonathan