Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2101077lqo; Sun, 19 May 2024 13:33:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUhhD+jp7n5axs74PbrhuAGo2YF6WTfcsfWsnLvL0P2v7Xwoy7TioPffYPxJMSQBECbKygvY22KC5PjFYnl7Ck5AD8Jz0yp+HlRyxULSg== X-Google-Smtp-Source: AGHT+IFm5hGHGI3996CyxpPHzi9c9MSKNWkoYq4iU6Z8Yu4dziHI+pwLayYgaekK7J5YNJgpZ7dn X-Received: by 2002:a17:907:2685:b0:a5c:daf2:1cfb with SMTP id a640c23a62f3a-a5cdaf29605mr1547940366b.63.1716150818438; Sun, 19 May 2024 13:33:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716150818; cv=pass; d=google.com; s=arc-20160816; b=h6qqz6dhQp3JupzliTThhTgONksuOOefZ4864oy1oByVtaJnHAFy8rVyxhg2A472EJ NkCfQfL5+TKDjgatmsDzDRg7kWCpIUo6NdMrAWZhU3B/cyloaz2Z1ts0XC9sQoOQka5r CCy+Gjg7CQgBxrvZihkKD6vXL3g6xEvHo/tyzjaynI82COoHVITBaT31LNST+wabjdDU y90ATJDR0yrQQh0pCmL3T8wnjy+BoGfc+LZJwz+qpzXuTwUgZhM60nvilwe+8FnYEtCc THUc3MiffoB/F+jb+M5TIPyVfk6WokwqulyCal2dsZe0bnkCgyozBZ1oSawuzNKlhd7/ b7nw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=RhgPuzlxsOcCWNyFWxUD91IphBlIn/MfHVkMLGAcKZ8=; fh=oxCs9AcOTsLK770rgIQZYdW0G4SLMedN/fLrNm2V0Dc=; b=x/lKQXxAKuqMdKIH0gV2lTxgcIP04Xas5/4nZds9GM323wrtwEOCIeCxq5+A/TB/vM 3DJCFVx0cf3Db43Ao9EwWdNztPsJdz7SJ+3Fb5PWEGDcLPsB+MVnaAg4VCscAK8pvALY Aii2LEhk04CLbxGwdhZfL5j58Lk43RuhmCuny6/veJ0tpDG8TDxPQumnf1GufQeMC7JE il/s+1sEN9i0vRKBFEYJQwr/RmSJfy/ZqarFbhj4/kEpVxWhVFCzCaCNc78FlD3mLDr5 uXAY7+wDjeIi9neRZspzZBYpZwAmvztnYt/kPlB/myv5z2HVwLKm9uFbb6yyeO0ColKE id6Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=m2mOMqWX; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-183262-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183262-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17c042f0si1221712466b.904.2024.05.19.13.33.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 May 2024 13:33:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-183262-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=m2mOMqWX; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-183262-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183262-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 06AFC1F24A40 for ; Sun, 19 May 2024 20:33:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CB28371B40; Sun, 19 May 2024 20:32:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="m2mOMqWX" Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4245F5024E; Sun, 19 May 2024 20:32:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716150776; cv=none; b=hSGxj0jguP3SKGqsN7h+RDdbZwTR+B+ennDxFRAF2El2ekEeDBmVANzDxzMP76iNauzaZpXQWY4ABQnzfq6kufZ5gjX7IAwj3kyKq9a3DcX4WlVBM4imbusXA5o5vZ/AMLMqR6715KOVYl0HU3xcjMyuGBHXnwxefvaZERQ0u20= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716150776; c=relaxed/simple; bh=B67zx55BXVPRDqr+VxV/B3N9LmQjSyqMHUdH6fCQoqY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=lr2UwMthrJrIvFYuPHxd7RMvwQPuI7STbWvsC8Amm2wsIb/MRUcBVB4Lc5tq3GK9tN3udXEFQq7OL8DPSr/NdVV9PdCAbDgUw8QHJVe5t2I4jNIBPRuX4aSe5dkqm8zgVNYBj9TXoIepjkHes9Ufl2QrtMhAUDx/45dHMeUuqUE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=m2mOMqWX; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-4202ca70287so10951525e9.3; Sun, 19 May 2024 13:32:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716150773; x=1716755573; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=RhgPuzlxsOcCWNyFWxUD91IphBlIn/MfHVkMLGAcKZ8=; b=m2mOMqWXpze7CMUBr5vgUC4AuSA+D+7nxWRxLSSR9IKWJzchd/XsUq5DyczDau9Ad0 qynQ/dyRjbYinhj/5a2mMwRyP17HaDFdsEFPD+Hqy0P+tpJRqsctxMrnxloljdumpkDv h6oUuakWoWdVvOj5apfuEJ8kiEoL5l53Tmx9Abvuw+MtOxKnTpN6Cj5fAEWe9gRT6m/1 Lg8YSxI6TlWXzS1vba0MeTnO+O1sF72Y3hfuOYkiUJlu4xbwNEXo5NBDO+dU2WgmJOwC 7Th2AKByKyRQCedJHaPypa6f63GrJpwYbtOq+/d5IbEEdTFLHTl68mO7ZgMUKRGhoHpi m1Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716150773; x=1716755573; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=RhgPuzlxsOcCWNyFWxUD91IphBlIn/MfHVkMLGAcKZ8=; b=KmxPp8W6M36YRK94ikeMUQ8BEF/yvNWW/t/79h5acED2mqHJ8/Fb4I87nLEcxtVI1y 59lB0zkH19gSzEWqtA2spjEM32rwaExy+xmRa36Va11nI/laOta+E3HyBxD/dau/gjo4 1aYSYkYI165wg50IHqjzf+BgRwYzqtzfzA/bHJ1PogrKrEZ/wPn0l/y9YmfJW3+Z3qiY CKHsPglyF7ZEZ6x4WXmUjrfJyf0A7EcGuKfXQ8iDHxmil92gXcD3ENfjThOoBk2hqrJ9 lwzcNqn633c5BHqW3JjNayvL3PpGx7RwfcN++WQ7n7LF9jci6tu5jPWk/ppUBIBGoIU1 UirQ== X-Forwarded-Encrypted: i=1; AJvYcCWP+cTbdtYwy/b7UtN8rq9QidQQJLXMCVUsO9B9IgbV23nn4lztRowe3u54zuJPz7aTQ+Cphdmi9Ih+OM8PVbnp5G9+Sh2z4dlKe3tsyS0zKLGtHE67HG22NYWlzqUhaH4mxSXVW1JC X-Gm-Message-State: AOJu0YwS55eabGtOQTfBj7+swCtxlRqYGc6o3s+RXT9obG7/in6l9tQR mj1UXUCZeMuEFICfo8llqp+telFYKhb5pEUGtGqZCJVza4MX+ulW X-Received: by 2002:a05:600c:4f50:b0:420:34a0:bb51 with SMTP id 5b1f17b1804b1-42034a0bbbemr69428995e9.18.1716150773346; Sun, 19 May 2024 13:32:53 -0700 (PDT) Received: from debian ([93.184.186.109]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccce24c0sm395094065e9.17.2024.05.19.13.32.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 May 2024 13:32:52 -0700 (PDT) Date: Sun, 19 May 2024 22:32:50 +0200 From: Dimitri Fedrau To: Jonathan Cameron Cc: Lars-Peter Clausen , Andrew Hepp , Marcelo Schmitt , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Nuno =?utf-8?B?U8Oh?= Subject: Re: [PATCH v2 1/2] iio: temperature: mcp9600: Provide index for both channels Message-ID: <20240519203250.GA10322@debian> References: <20240517081050.168698-1-dima.fedrau@gmail.com> <20240517081050.168698-2-dima.fedrau@gmail.com> <20240519171438.08810789@jic23-huawei> 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-Disposition: inline In-Reply-To: <20240519171438.08810789@jic23-huawei> Am Sun, May 19, 2024 at 05:14:38PM +0100 schrieb Jonathan Cameron: > On Fri, 17 May 2024 10:10:49 +0200 > Dimitri Fedrau wrote: > > > The mapping from cold junction to ambient temperature is inaccurate. We > > provide an index for hot and cold junction temperatures. > > > > Suggested-by: Jonathan Cameron > > Signed-off-by: Dimitri Fedrau > Hi Dmitri, > Hi Jonathan, > I'm not sure you replied to the question in previous review of what > sysfs files exist for this device. Whilst I am at least a little > open to changing the ABI, I'd like to fully understand what > is currently presented and why iio_info is having trouble with it. > I did, see: https://lore.kernel.org/linux-iio/20240509193125.GA3614@debian/T/#u But maybe not to the point. Sysfs is working correct and iio_info probably not. There is only one channel found, the temp_ambient. I would have expected two channels. Instead there are four attributes, I would have expected two. It seems to me that they are just duplicated. I also added the output when setting channel2 member of channel 0 to IIO_MOD_TEMP_OBJECT. This time iio_info works fine. > I also want an ack from Andrew on this one given might break it existing > usage. > > The current interface is perhaps less than ideal, but I don't think it > is wrong as such. Whilst I wasn't particularly keen on the cold junction > == ambient I'm not sure moving to just indexed is an improvement. > Hence looking for input from Andrew. +CC Nuno as someone who is both > active in IIO and has written thermocouple front end drivers in > the past. > I just thought the setting of channel2 member to IIO_MOD_TEMP_OBJECT was missing. But it turned out that it is not set for a reason. I'm fine with the existing mapping, but would be still interesting to know how others think about the mapping. Dimitri > > > --- > > drivers/iio/temperature/mcp9600.c | 9 +++++++-- > > 1 file changed, 7 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/iio/temperature/mcp9600.c b/drivers/iio/temperature/mcp9600.c > > index 46845804292b..22451d1d9e1f 100644 > > --- a/drivers/iio/temperature/mcp9600.c > > +++ b/drivers/iio/temperature/mcp9600.c > > @@ -14,6 +14,9 @@ > > > > #include > > > > +#define MCP9600_CHAN_HOT_JUNCTION 0 > > +#define MCP9600_CHAN_COLD_JUNCTION 1 > > + > > /* MCP9600 registers */ > > #define MCP9600_HOT_JUNCTION 0x0 > > #define MCP9600_COLD_JUNCTION 0x2 > > @@ -25,17 +28,19 @@ > > static const struct iio_chan_spec mcp9600_channels[] = { > > { > > .type = IIO_TEMP, > > + .channel = MCP9600_CHAN_HOT_JUNCTION, > > .address = MCP9600_HOT_JUNCTION, > > .info_mask_separate = > > BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE), > > + .indexed = 1, > > }, > > { > > .type = IIO_TEMP, > > + .channel = MCP9600_CHAN_COLD_JUNCTION, > > .address = MCP9600_COLD_JUNCTION, > > - .channel2 = IIO_MOD_TEMP_AMBIENT, > > - .modified = 1, > > .info_mask_separate = > > BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE), > > + .indexed = 1, > > }, > > }; > > >