Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2475405rdg; Mon, 16 Oct 2023 05:55:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGKkj97ZTOzlN1huZTU7nzFE1Z4CGnois9YRv+7uOD4VSh1ei935XSLWhOJW+2p9zFNaVF1 X-Received: by 2002:a62:8492:0:b0:68a:582b:6b62 with SMTP id k140-20020a628492000000b0068a582b6b62mr8788796pfd.7.1697460903592; Mon, 16 Oct 2023 05:55:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697460903; cv=none; d=google.com; s=arc-20160816; b=sMZMNtsX6EQPwUoRR4ciHVRYKujQLWC9bKR6fHKxUQvDWEasUvYR+8M3m+BIL0xwNG NJ/lbLdcrjOvq4s3n9A/Y6tlDyJJS2Gpl5l7IIbAkK4qi+jKD/dOnum6ofF6e/xI+N1I cdN7sWNlEmFu6mlU7yvJLfpbt2EgVC5lGvEtq2vZCwa9ydHGU1oIEO87LUCmMrUFi439 sF6XtHaPksSmpLLmS5UJsHHJrUiZPNHaY7pNsX/xFa2uvxzCkGY1wnysflRqsJvypKVw +mHqfysCBr+t7SZqucTSPrC0hPXtf77pWhmDllIsHr8Ej6DVlqzkKNuU0SYm1ceM+qGi c5Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=m/f+7YFh/6osBiwAV+h/Emo8XmTTY549abIctApwupw=; fh=ZOEikdEIDkIqTto/ZVp7+Yvs8cACMemCPKP2g5/JgWM=; b=EVTasz/Xf6dpbjrq2wHuTqNB8SumKOXoYptzHNjEN79QapLGQo6lUl8wY3Kmzk9qDu ueZDFT00TR7molcvYkipJhOLB48tH+vAudvQKQYI96enpqC+R9DR6mnxgZOhCEPkruoO B/YaF2nBN1/tczc8lBI5vknCYwYYvn6I34VXA2+p2Z/dX6/b7orcRwSX1o5i7dyDe1Hg SDcVpZBVGgKwGGXXaGkYbkVudsbsl1S4cmTnah1lm5jmBbt+vuiQNjTyY5cQv7Hb5Kml Y3qUa0HHv2UCjk54PFJZFPawfDEY2A4GB41RCCXjTWvS68x5wOT/1+1aaTwy1potAE8z AVxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ixExQdjI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id e12-20020a630f0c000000b00578bacd7fc7si10016270pgl.713.2023.10.16.05.55.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 05:55:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ixExQdjI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 59ED780A4ACD; Mon, 16 Oct 2023 05:55:01 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231896AbjJPMyk (ORCPT + 99 others); Mon, 16 Oct 2023 08:54:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231569AbjJPMyj (ORCPT ); Mon, 16 Oct 2023 08:54:39 -0400 Received: from mail-yw1-x1134.google.com (mail-yw1-x1134.google.com [IPv6:2607:f8b0:4864:20::1134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07396A2 for ; Mon, 16 Oct 2023 05:54:38 -0700 (PDT) Received: by mail-yw1-x1134.google.com with SMTP id 00721157ae682-59e88a28b98so37729497b3.1 for ; Mon, 16 Oct 2023 05:54:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697460877; x=1698065677; 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=m/f+7YFh/6osBiwAV+h/Emo8XmTTY549abIctApwupw=; b=ixExQdjICwf7Hh80IFNCXjM+ha1PVKOk1BJr7t2CTgdNzENilrtNFWYsGW2hWk/OjM DcjD0IP0y1Q9iY99KVt4PcvWC+2HWxtiExhaFKG9nTqUZuDlUjl/aDb95DU8w8emE46B wi0WfcdqH5xe8XB7yr6wlQ0fiwP4JaA8Co0guWaBNX4QGdShkLDbmnNisax+3NBoY92U tNXl826VSCPYQktPFvWXO1zpm6eO8K9jmRMrJN8/R4IWdhpNuEPiA4pievALaltcpxnl JASEWtDdNuSE/+MuIvbEJv1FF1/vf0A6NZapmgACHn8jdLDZ6b5mcQ+HH1vQPwaPTGdZ pivA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697460877; x=1698065677; 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=m/f+7YFh/6osBiwAV+h/Emo8XmTTY549abIctApwupw=; b=X+ZGBbytiYgxtijvj+6zg9aF5tQ8Bfjrleh9yFp+igMWQ5MfoeEZDJgamyukIC58SA TTzH4P52V0di1yU6hoQZMcVV3NwpfmoqXaovyAc0oelmGjWT+C7fGU/+/c2EobFOiofw Rf/gid/O0E7FJfxqILKWb8hhvj3D2DtcwPPYxDZIx27t9bUFDvlNjrZwbRTf06hMQC0v tx088kdfeB1IMkc0Wdh09q/BhtyfuggGvk8F1qkYlFYb558J1HbpIFJWEa+ZO4nK3KhR 22d4seKhN2cfgMNKPedLBFE/HKCinUVizWs9a5dxFF/nmcU8BjqRv8fVN29jTZIWNIJh RgCQ== X-Gm-Message-State: AOJu0YxDWybEdj3egLAZKuWoSDhdDtBS4gIsnp9cPU4A8fIacGM54hax ZfRiHU4bo908Tt3z8qMUjFEyRezlXTDw9JAFU1m4Zg== X-Received: by 2002:a81:520a:0:b0:5a5:575:e944 with SMTP id g10-20020a81520a000000b005a50575e944mr4339145ywb.4.1697460877194; Mon, 16 Oct 2023 05:54:37 -0700 (PDT) MIME-Version: 1.0 References: <20230902-iio-rescale-only-offset-v2-1-988b807754c8@linaro.org> <948548a0-d132-4f5c-819e-40bacb367be4@axentia.se> In-Reply-To: <948548a0-d132-4f5c-819e-40bacb367be4@axentia.se> From: Linus Walleij Date: Mon, 16 Oct 2023 14:54:24 +0200 Message-ID: Subject: Re: [PATCH v2] iio: afe: rescale: Accept only offset channels To: Peter Rosin Cc: Jonathan Cameron , Lars-Peter Clausen , Liam Beguin , Jonathan Cameron , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Mon, 16 Oct 2023 05:55:01 -0700 (PDT) On Mon, Oct 16, 2023 at 12:05=E2=80=AFPM Peter Rosin wrot= e: > > Just raw (with neither offset or rescale) doesn't make sense, since > > And I don't see why not. That's the crux. OK I can implement that, but then we need to define the priority of "just raw" vs "processed". It is quite common that ADC drivers provide raw and processed. Which one goes first? Right now the priority is: 1. Raw + scale, if scale exists else 2. Processed After this patch the priority would be: 1. Raw+scale OR Raw+offset if either scale or offset exists else 2. Processed How do you expect a raw channel to be prioritized? I can only put it last, as putting it second would break existing users that provide both raw and processed. Is this how you imagine this to work? Further, that could be a separate patch on top of this so it is a little bit of feature creepy to push into this patch, but I can make a 2-patch series if you like. It basically does not block applying this one patch on the way there. > > the AFE rescaler does just offsetting and rescaling, in that case the > > user should just use the raw channel. Also it would then take > > precedence over a processed channel (which applies rescale and > > offset internally) which doesn't make sense to me. > > Why isn't it perfectly fine for a device to provide only a raw > channel and then expect that to be interpreted as the real unit? You're right there is no problem with that. The only problem I have with it is how to prioritize it. Would need Jonathan's feedback here too though, I might be missing something. > Why would it need a processed channel when no processing is > going on? E.g. a device reporting the temp in the expected unit > in one of its registers. Or whatever with such a friendly > register. Good point. Unless someone would call that a "processed channel" albeit processed in hardware. But this definition of raw =3D=3D raw register reads works for me. > > I'm not sure I fully understood the remark, please elaborate if I got i= t wrong! > > I agree that the patch does exactly as you intend. I question if > what you intend is correct, but since I don't know the rules, I'd > simply like to have the rules clarified. Like I know the rules :D Whenever I do anything in IIO I feel like Socrates, all I know is that I know nothing. Yours, Linus Walleij