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 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AE622C6FA82 for ; Wed, 21 Sep 2022 00:02:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2F51610E7CB; Wed, 21 Sep 2022 00:02:55 +0000 (UTC) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by gabe.freedesktop.org (Postfix) with ESMTPS id 33A1510E7CB for ; Wed, 21 Sep 2022 00:02:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663718572; x=1695254572; h=date:message-id:from:to:cc:subject:in-reply-to: references:mime-version; bh=EQRM8yaZsSfcAfaN72FQXsI7Vzv5YFS7DAb6JznRfoA=; b=jJjP6ctiTZM2Y3DxuUvpx6WWm9ZJGq8MbrolfeSXsX6Qmy/UjEWpomo/ aEfxfMPd54IC8S55UmDfHmrOqSAmBiaPtiFHaGzuGHoUBMPriY/TdsOKt /dcoMeMi0Jvwm19OlIs0K3+TP4p01bJRr3JkK+KUuyZBrfdtaU/cUJASR 3cg/8j4G5JI+2oafLjfN6zdKbfc5kFHJ0zvX5o0vAzaTXm9TnUWK65/Vq YQfSUGMIj5RmFeTsXl/X022XzFnpAEbXLpdHsl74ZfAE2glftdeZkL26X 6ZLzkx7F7kiRZXStupONXxHT1O4b8TMDi53jFPBESMIQID77Jy2WnLJld Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10476"; a="279577234" X-IronPort-AV: E=Sophos;i="5.93,331,1654585200"; d="scan'208";a="279577234" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2022 17:02:51 -0700 X-IronPort-AV: E=Sophos;i="5.93,331,1654585200"; d="scan'208";a="619120134" Received: from adixit-mobl.amr.corp.intel.com (HELO adixit-arch.intel.com) ([10.209.57.76]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2022 17:02:51 -0700 Date: Tue, 20 Sep 2022 17:02:50 -0700 Message-ID: <87fsgld26t.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: "Nilawar, Badal" In-Reply-To: <9760a03d-a83e-7e27-e4da-faff02c6f11a@intel.com> References: <20220825132118.784407-1-badal.nilawar@intel.com> <20220825132118.784407-3-badal.nilawar@intel.com> <87o7w3yn28.wl-ashutosh.dixit@intel.com> <9760a03d-a83e-7e27-e4da-faff02c6f11a@intel.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/28.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Subject: Re: [Intel-gfx] [PATCH 2/7] drm/i915/hwmon: Add HWMON current voltage support X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-hwmon@vger.kernel.org, intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Thu, 15 Sep 2022 07:40:37 -0700, Nilawar, Badal wrote: > > On 29-08-2022 23:00, Dixit, Ashutosh wrote: > > On Thu, 25 Aug 2022 06:21:13 -0700, Badal Nilawar wrote: > >> > >> +static int > >> +hwm_in_read(struct hwm_drvdata *ddat, u32 attr, long *val) > >> +{ > >> + struct i915_hwmon *hwmon = ddat->hwmon; > >> + intel_wakeref_t wakeref; > >> + u32 reg_value; > >> + > >> + switch (attr) { > >> + case hwmon_in_input: > >> + with_intel_runtime_pm(ddat->uncore->rpm, wakeref) > >> + reg_value = intel_uncore_read(ddat->uncore, hwmon->rg.gt_perf_status); > >> + /* In units of 2.5 millivolt */ > >> + *val = DIV_ROUND_CLOSEST(REG_FIELD_GET(GEN12_VOLTAGE_MASK, reg_value) * 25, 10); > > And use above scale factors here. > *val = DIV_ROUND_CLOSEST(REG_FIELD_GET(GEN12_VOLTAGE_MASK, reg_value) * > SF_VOLTAGE_MUL, SF_VOLTAGE_DIV); > Regards, > Badal > > > > Let's complete this comment to so that it is clear what's happening: > > > > /* HW register value is in units of 2.5 millivolt */ This was missed in the latest rev so if we could remember to add this that would be great.