From patchwork Fri Dec 11 13:09:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: thermal-bot for Lad Prabhakar X-Patchwork-Id: 342435 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=-20.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=ham 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 95558C1B0D8 for ; Fri, 11 Dec 2020 13:10:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 60D0623EAF for ; Fri, 11 Dec 2020 13:10:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2436585AbgLKNKI (ORCPT ); Fri, 11 Dec 2020 08:10:08 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:34830 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390550AbgLKNJo (ORCPT ); Fri, 11 Dec 2020 08:09:44 -0500 Date: Fri, 11 Dec 2020 13:09:01 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1607692142; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=q2yF9QdVow+sGfVcMHdcTJw4cPcqkbFVT6L/Xk1ZxQE=; b=Vsn93EtbZjCfd1SJxOC1T8Ocbewaxsq63tXD5lqMr/BYFM7Y8n86Q4LNDKJs6HTXSzxCaW N+M91p6EUe+Pb8UITIm4XmNztCp6Vd0hjkCkENeFpfzi+Bg/Y83G7AFlSw9zP4dd5ZKA7G EOoZ1Mof/wwM3d2v3IJCeZdjZ3isxM0hJGFMtnCZEZo6IBGRn1N13MX28S1blKweWxqMnj pdLu9ka9K8iehRDe5suFdUN6S9mWb30buzCMKmuSQ0NaoFtZI3pwcdZZTyoaZAtnb9Q8R/ I7lIVJSosdbaEO4Bsj7YuQcc2EhrZSXbyXZEiu24NDMZjdcMuSIkI6rZUF63EQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1607692142; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=q2yF9QdVow+sGfVcMHdcTJw4cPcqkbFVT6L/Xk1ZxQE=; b=vTzhpspc0oIwrklobeIfuB31HPfQqE4QJR/Bg/RNBsQQ4foyMJZKD1Fti33RMpKQSU5CuT pt3FBPFYcDmh35DQ== From: "thermal-bot for Sumeet Pawnikar" Sender: tip-bot2@linutronix.de Reply-to: linux-pm@vger.kernel.org To: linux-pm@vger.kernel.org Subject: [thermal: thermal/next] thermal: intel: pch: use macro for temperature calculation Cc: Sumeet Pawnikar , Andy Shevchenko , Zhang Rui , Daniel Lezcano , amitk@kernel.org In-Reply-To: <20201210124801.13850-1-sumeet.r.pawnikar@intel.com> References: <20201210124801.13850-1-sumeet.r.pawnikar@intel.com> MIME-Version: 1.0 Message-ID: <160769214151.3364.6439448666977965097.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The following commit has been merged into the thermal/next branch of thermal: Commit-ID: 8639ff4194c98c78536f6e8941a79a3a966a71f1 Gitweb: https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//8639ff4194c98c78536f6e8941a79a3a966a71f1 Author: Sumeet Pawnikar AuthorDate: Thu, 10 Dec 2020 18:18:01 +05:30 Committer: Daniel Lezcano CommitterDate: Thu, 10 Dec 2020 14:30:44 +01:00 thermal: intel: pch: use macro for temperature calculation Use macro for temperature calculation Signed-off-by: Sumeet Pawnikar Reviewed-by: Andy Shevchenko Reviewed-by: Zhang Rui Signed-off-by: Daniel Lezcano Link: https://lore.kernel.org/r/20201210124801.13850-1-sumeet.r.pawnikar@intel.com --- drivers/thermal/intel/intel_pch_thermal.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/thermal/intel/intel_pch_thermal.c b/drivers/thermal/intel/intel_pch_thermal.c index d7c05c0..41723c6 100644 --- a/drivers/thermal/intel/intel_pch_thermal.c +++ b/drivers/thermal/intel/intel_pch_thermal.c @@ -167,8 +167,7 @@ read_trips: trip_temp = readw(ptd->hw_base + WPT_CTT); trip_temp &= 0x1FF; if (trip_temp) { - /* Resolution of 1/2 degree C and an offset of -50C */ - ptd->crt_temp = trip_temp * 1000 / 2 - 50000; + ptd->crt_temp = GET_WPT_TEMP(trip_temp); ptd->crt_trip_id = 0; ++(*nr_trips); } @@ -177,8 +176,7 @@ read_trips: trip_temp = readw(ptd->hw_base + WPT_PHL); trip_temp &= 0x1FF; if (trip_temp) { - /* Resolution of 1/2 degree C and an offset of -50C */ - ptd->hot_temp = trip_temp * 1000 / 2 - 50000; + ptd->hot_temp = GET_WPT_TEMP(trip_temp); ptd->hot_trip_id = *nr_trips; ++(*nr_trips); } @@ -190,12 +188,7 @@ read_trips: static int pch_wpt_get_temp(struct pch_thermal_device *ptd, int *temp) { - u16 wpt_temp; - - wpt_temp = WPT_TEMP_TSR & readw(ptd->hw_base + WPT_TEMP); - - /* Resolution of 1/2 degree C and an offset of -50C */ - *temp = (wpt_temp * 1000 / 2 - 50000); + *temp = GET_WPT_TEMP(WPT_TEMP_TSR & readw(ptd->hw_base + WPT_TEMP)); return 0; }