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 6E1D8ECAAA4 for ; Mon, 29 Aug 2022 17:50:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6EDDE10EAB5; Mon, 29 Aug 2022 17:50:16 +0000 (UTC) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4AD7D10EAB7 for ; Mon, 29 Aug 2022 17:50:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661795412; x=1693331412; h=date:message-id:from:to:cc:subject:in-reply-to: references:mime-version; bh=YZAjn3EYxvM7jJwGlzaDfBUdPVSC/0b5H1i8NE4KnA0=; b=kRtkF0YbTIyC3PDL5d1Fu39xqxM6oyvfnxjtmkzgm1AFdbOL0kGFtn2E pqDng0Przb8JjmGn76r6kfe8N7TyluMlEBhvkCfdUlmmW4xuBRFSctnSP KYmoO3yf55wu7FvjGD/pYZMdpnGLiG3K8L1TyEh/mrEGI6GVSNixYG6n1 Q5K9L3OvhUSQVQnCL+h+hzlpQ5R4cC1p2XZVM/ce5XKFKxXuHn6FPo/+T u0Wgc/jNAPlKU0ang9QIgDB7yI/G60dn4RKl830sf4fsSHBTZg7NKDi5N XpfxdfWUimKPjGOy11FmNvZdcBoH9USXitbnwYQ+kqJiG9Nr6DjWwnX/h Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10454"; a="275360597" X-IronPort-AV: E=Sophos;i="5.93,273,1654585200"; d="scan'208";a="275360597" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2022 10:50:00 -0700 X-IronPort-AV: E=Sophos;i="5.93,273,1654585200"; d="scan'208";a="737424912" Received: from adixit-mobl.amr.corp.intel.com (HELO adixit-arch.intel.com) ([10.212.207.96]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2022 10:50:00 -0700 Date: Mon, 29 Aug 2022 10:30:39 -0700 Message-ID: <87o7w3yn28.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: Badal Nilawar In-Reply-To: <20220825132118.784407-3-badal.nilawar@intel.com> References: <20220825132118.784407-1-badal.nilawar@intel.com> <20220825132118.784407-3-badal.nilawar@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, 25 Aug 2022 06:21:13 -0700, Badal Nilawar wrote: > > From: Riana Tauro > > Use i915 HWMON subsystem to display current input voltage. A couple of suggestions to improve comments in this patch below and after addressing those this patch is: Reviewed-by: Ashutosh Dixit > diff --git a/drivers/gpu/drm/i915/i915_hwmon.c b/drivers/gpu/drm/i915/i915_hwmon.c > index 103dd543a214..2192d0fd4c66 100644 > --- a/drivers/gpu/drm/i915/i915_hwmon.c > +++ b/drivers/gpu/drm/i915/i915_hwmon.c > @@ -11,8 +11,10 @@ > #include "i915_hwmon.h" > #include "i915_reg.h" > #include "intel_mchbar_regs.h" > +#include "gt/intel_gt_regs.h" In later patches we have added units for different quantities here. So I think we should add those units for voltage to this patch too. It's in Documentation/ABI/testing/sysfs-driver-intel-i915-hwmon but I think it's better to add to this file too otherwise if anyone looks at it is seems to be missing. So I would add the following to this patch: /* * SF_* - scale factors for particular quantities according to hwmon spec. * - voltage - millivolts */ #define SF_VOLTAGE 1000 > +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); Let's complete this comment to so that it is clear what's happening: /* HW register value is in units of 2.5 millivolt */