Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp720550pxu; Wed, 6 Jan 2021 02:32:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJxKrd90CKEYD2B1c/1LFOzOLIYay/Hx46jH1YhxaqiIneEicon8MPcQVX2TFLu1eIgYTnhU X-Received: by 2002:a17:906:6d0b:: with SMTP id m11mr2328804ejr.230.1609929134785; Wed, 06 Jan 2021 02:32:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609929134; cv=none; d=google.com; s=arc-20160816; b=uvCyA2CLhSSfs7tmBhsXK0QMuij82cs35USyzpltR0RT9IEJU9BFaUBMGUJa76owVw qS4p5bOEUGXjeS55NJ8LdJaQdRuvwj44JoAZTimvFYCPi/6jwJSyBCGSogYwBOgiZmNy M4sjbj+O40JRRLeS7aXKEwBl+Fowhi1E2qA38q5iwKuIAbnrcCGBGZ6oCIlKM2WzjEVE x1pC/+ZAiNj5QTqtnjD/I9WWaWtXfUVQKAXsDfTHBZp9HB+O3i0mVRGoTK/HXP4pDwwJ DcQkgvU7BCbAGYFucaabu/qBuSXn3kp7gY4DyQQzLFuWOsBka8ZYjsB4V9tYem5fXA3c FCCg== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=DD036AyYsfeI0JPX1HaHC+Cq6ZOt+xtUMZHfSZkOD08=; b=yFJ6KM+bcvV2F3KXmoK+fGb0Z8n4Wq6Rw9M4ys9sZKoa06ZAIdQkvp4gso4FuGJ5gf HeWyKdkYoz4iAk8rbhIJ+Ynji3AK1U/rZMjTvH6/BDCFpomtKWBb5wV6QgMlZqyWRRNk 6OFEa6q7sZPiNJOHoBqV2f/vEgAt5NT0McPmRq7h6B6G2/8LO4vMfcoQmxlV7bp7W2UN 2fFwrFCvVeN1//RCsVzlbhaHvJeK86PrZcIM8QifEeRMlygprihKoMb0dWqRj34f/yZb Kt+VE6GfADZMPGh1Ky+YjLg9DoP3RDWwwMrVk+JzQ4IdaE/Af7oJIG3Yf0FrTiaf7URv F0eA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q25si843763edw.87.2021.01.06.02.31.49; Wed, 06 Jan 2021 02:32:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725960AbhAFKah (ORCPT + 99 others); Wed, 6 Jan 2021 05:30:37 -0500 Received: from frasgout.his.huawei.com ([185.176.79.56]:2295 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725828AbhAFKag (ORCPT ); Wed, 6 Jan 2021 05:30:36 -0500 Received: from fraeml703-chm.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4D9lqR6PB1z67Xwb; Wed, 6 Jan 2021 18:25:07 +0800 (CST) Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by fraeml703-chm.china.huawei.com (10.206.15.52) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2106.2; Wed, 6 Jan 2021 11:29:53 +0100 Received: from localhost (10.47.75.92) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Wed, 6 Jan 2021 10:29:53 +0000 Date: Wed, 6 Jan 2021 10:29:17 +0000 From: Jonathan Cameron To: Jyoti Bhayana CC: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Mauro Carvalho Chehab , "David S. Miller" , Rob Herring , "Lukas Bulwahn" , , , , , , , , , Subject: Re: Reply to [RFC PATCH v2 0/1] Adding support for IIO SCMI based sensors Message-ID: <20210106102917.0000332c@Huawei.com> In-Reply-To: <20210105230920.769144-1-jbhayana@google.com> References: <20201230123748.4e969f82@archlinux> <20210105230920.769144-1-jbhayana@google.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.47.75.92] X-ClientProxiedBy: lhreml720-chm.china.huawei.com (10.201.108.71) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 5 Jan 2021 23:09:20 +0000 Jyoti Bhayana wrote: > Hi Jonathan, > > > So, sensor_max_range can effectively be exposed as a combination of > > scale and the *_raw_avail for a raw read (via the read_avail callback in IIO). > > We'll ignore the fact the interface assumes a single value (so I assume symmetric?) > > Based on the SCMI specification the sensor min range and max range are 64 bits signed number. > > looks like IIO_AVAIL_RANGE can only take the following > types of data which all looks like 32 bit. IIO_VAL_FRACTIONAL > also takes two int type numbers. > How can I send 64 bit sensor range using this and read_avail callback? > > #define IIO_VAL_INT 1 > #define IIO_VAL_INT_PLUS_MICRO 2 > #define IIO_VAL_INT_PLUS_NANO 3 > #define IIO_VAL_INT_PLUS_MICRO_DB 4 > #define IIO_VAL_INT_MULTIPLE 5 > #define IIO_VAL_FRACTIONAL 10 > #define IIO_VAL_FRACTIONAL_LOG2 11 > #define IIO_VAL_CHAR 12 Hmm It is a bit unfortunate that SCMI decided to pretend that real sensor resolutions were greater than 32 bits. I doubt they will ever actually be any (as such accurate measurements are completely pointless) and they aren't anywhere near that today. Only way it might end up looking a bit like that would be result of a highly non linear sensor being shoved through an interface that pretends it isn't (goody). Having said that, specifications are what they are and we have to cope with that. There is no real problem with defining a new value type except for the fact that any legacy userspace won't necessarily expect to see values that large. Given we need the full 64 bits it would have to be something like IIO_VAL_INT_H32_L32 with the 64 bit values split up appropriately and put back together at time of formatting. Not particularly pretty but I'm not keep to put that much effort in to support something like this for one driver (so not interesting in changing that the read_raw_* interfaces) Jonathan > > > > Thanks, > Jyoti >