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 X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS, USER_AGENT_MUTT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3F8AC10F11 for ; Mon, 22 Apr 2019 19:29:36 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 68B7D20896 for ; Mon, 22 Apr 2019 19:29:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="VwtsqVAw"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="tjvV+PJG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 68B7D20896 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=at5AZNxKZEm/otKOdnHnM5gDFv20O7+7IFt0DPFEviM=; b=VwtsqVAwMfwltE wMzkvbEPKDTYX7feflBkIUVPLmSYlnk/nn64KjTZ9VG10KyF6um7c9IhUD5JYNdHxrBBZ9RrkQ18L 21gO2vcSsHj1ujWnynqkGKedcwQ1qiDbjhoDcgj73HNJ3ICpUeMfpV2CWDLhkrfFYGMBs0992YPOC iKwPYJdf1kYeH4oZfcnShGNwmgG9lb7IImNmnWq5mLGJiHqkE1Eqk/Om9KJdaapHWAHyng3DP8ufF RN5OY8WQN9isLHIVUhJN1HnEQ026hzF/nLocECBtJ1ZA9X69ppRfl59VYcPDucI27I3mGTKtg11az 6gpVdxRbryYp+HjeCkXA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hIedD-0001w3-LF; Mon, 22 Apr 2019 19:29:35 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hIed9-0001ui-Pi for linux-arm-kernel@lists.infradead.org; Mon, 22 Apr 2019 19:29:33 +0000 Received: by mail-pg1-x543.google.com with SMTP id p6so6291221pgh.9 for ; Mon, 22 Apr 2019 12:29:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=D3bDpw4fEtqb/bI7gw+bwBjymONUMY4BKq8vzaYg6Wk=; b=tjvV+PJGM0Axas0R+AoG7OC7MrKsgJwX75xfhVmAhztyAEZdz4zGIVUpCmTkweFePq UC6igVLsnBH65uK1VzsgpTav+hB2udFVpauGy+w9wNi98OxCgW4F8/fZt7Ng9MCaqreP 1aPuzgpGaJ7ta/gAunJvXQdqpfpOrkKnsIHPIL7n2SCmSdSU4ctvh+nJAUw9eUAChfdB hWbfc4turEHlOrjEq4SJRNBI2lxa4my3jPnJfJhwrHtlPeR6G7jffVv+OondioTT2NOd 3Jae4fD6sGuAFAAfRRm7Eno/bcdecSz2y4R7m97sRirl4U1zhamrVQ8eQcKXrlyNiSfF G8SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=D3bDpw4fEtqb/bI7gw+bwBjymONUMY4BKq8vzaYg6Wk=; b=IO4dn9gf8Rl6hS/pJwfxSjgm4XgtnRuT1X4MYBwDzlQ87HNjrWdZWjRcfFka/46wOP /XBe6POlJxiev6cwlux7Szga1Cb8T97FZvrgf3nBWTOw1J2mWd1Dg+hM2CroIvGpzpSH RIFf5gVzmdZSi1suJIYCwyUUTMRTIa438YSW0dRk52bqWN3k52Uh/7D6VcTOquj8CC+U 21r+BAJDZ5ANZlUxGr7Ym3dZ3cxA3SwpvT0WBh2oGY6XWgeINDp+KVY65wcb5/719OyJ 0ITCX+EWVv4JHZyjsHlwesjNykBf4tYIsJ6HipDzV4z0ziC4SUVU5Je/4OX1NH2y/7LU 9FDQ== X-Gm-Message-State: APjAAAUdARf5LcpPHzGnGlRXRuPkCZdl1XyoFVZbVICt/eaMubALEYuj ji45L8Tw8oDfQ3YKB6ngtGc= X-Google-Smtp-Source: APXvYqxO7f09O9zsUoDZ5m13qc/wBfEHebvExUWaNQ1PziXdlKQgC2pPB9emPG52bZCOn9ZGoDFgDg== X-Received: by 2002:a63:c605:: with SMTP id w5mr20078652pgg.355.1555961370610; Mon, 22 Apr 2019 12:29:30 -0700 (PDT) Received: from localhost ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id v9sm17538016pgf.73.2019.04.22.12.29.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Apr 2019 12:29:29 -0700 (PDT) Date: Mon, 22 Apr 2019 12:29:27 -0700 From: Guenter Roeck To: Florian Fainelli Subject: Re: SCMI sensor reads unit scaling Message-ID: <20190422192927.GA5493@roeck-us.net> References: <9207bc01-e0c6-ef73-6a24-6deda7b789c5@gmail.com> <7d23066b-fd45-1784-3c2a-7e44eeae63bf@roeck-us.net> <2e6a6141-762f-7618-60b9-84fa1190813d@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <2e6a6141-762f-7618-60b9-84fa1190813d@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190422_122931_863247_340D6DEC X-CRM114-Status: GOOD ( 22.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-hwmon@vger.kernel.org, "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , Sudeep Holla Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Apr 22, 2019 at 11:31:18AM -0700, Florian Fainelli wrote: > On 4/20/19 10:31 AM, Guenter Roeck wrote: > > On 4/20/19 9:43 AM, Florian Fainelli wrote: > >> Hi Sudeep, Guenter, > >> > >> The current SCMI hwmon support does not seem to make use of the sensor > >> scale/unit as defined in the sensor replies (or the update scale for > >> that matter). > >> > >> I came up with the patch below which gets the job done, but I am worried > >> about possibly breaking people's SCMI deployments and sensors reading > >> because they may have intentionally or not already decided to return a > >> value which is scaled the way Linux's hwmon expect it, and may, or may > >> not have populated a valid unit number in the sensor reply. > >> > >> Ideally we should probably do two conversions: > >> > >> - from within scmi_sensor_reading_get(), scale the value as indicated by > >> the reply > >> - from within scmi_hwmon_read(), take that scaled value and apply the > >> necessary conversion expected by Linux's HWMON conventions (e.g.: > >> reporting voltage as mV values) > >> > >> What do you think? > >> > > > > Reported values have to follow HWMON conventions. If not, this is a bug > > and needs to get fixed. The argument about not changing the userspace ABI > > does not apply to bugs. > > Upon re-reading the SCMI specification, what is not clear to me is > whether you have the liberty to: > > - target the Linux HWMON sensor units as specified by > Documentation/hwmon/sysfs-interface by e.g.: putting a millidegree > Celsius value in the SCMI reply and an power of 10 multiplier value of 0 > (which would be treated as not doing any scaling) > > - must provide the raw value as provided by the sensor as well as > indicate the scale, e.g.: millidegree celsius and specifying a scale of -3 > > Sudeep can you clarify how you would approach making use (or not) of the > power of 10 multiplier as defined by the SCMI specification? > Not sure I understand. SCMI and hwmon sysfs ABI requirements are orthogonal. hwmon expects certain units (mostly milli, but micro for power). What the hardware reports is irrelevant. The SCMI driver needs to convert values reported by SCMI into values expected by the hwmon ABI. If it does not do that today, that is a bug which needs to be fixed. Thanks, Guenter _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel