From patchwork Thu Apr 26 11:51:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 10365865 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CA504601BE for ; Thu, 26 Apr 2018 11:57:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB86928E33 for ; Thu, 26 Apr 2018 11:57:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B075228EA6; Thu, 26 Apr 2018 11:57:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F94928E33 for ; Thu, 26 Apr 2018 11:57:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755889AbeDZL5a (ORCPT ); Thu, 26 Apr 2018 07:57:30 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:48322 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755771AbeDZLwO (ORCPT ); Thu, 26 Apr 2018 07:52:14 -0400 Received: from epcas1p4.samsung.com (unknown [182.195.41.48]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20180426115212epoutp01d78a8e2b8d63908511d5771dc021ae09~o_iowrcuj0415504155epoutp01H; Thu, 26 Apr 2018 11:52:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20180426115212epoutp01d78a8e2b8d63908511d5771dc021ae09~o_iowrcuj0415504155epoutp01H DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1524743533; bh=Khg+GKbxRjTgqB5yPdlo+1AGl32GHvKyccktDRuKJFE=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=cx7u64TPfNpp87fr0IU5ms1roibOlUynUKqudJ//bYjgtqSFpgIbLsHFMGp25tWbF CuU4mVw35hzgCgYxjWJB9bPpreqH5OEvxiE8+zAoGlCE7UzZyAP9TO2VLMYG2cl3Zv +EMaS1e1Gooo0UYN4w/mVSyluR+DQhJB63gnIyac= Received: from epsmges1p1.samsung.com (unknown [182.195.42.53]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20180426115212epcas1p1be480f6b0a41d164fc8ffa16f9f2aa5f~o_ioeWTam2852828528epcas1p1M; Thu, 26 Apr 2018 11:52:12 +0000 (GMT) Received: from epcas1p1.samsung.com ( [182.195.41.45]) by epsmges1p1.samsung.com (Symantec Messaging Gateway) with SMTP id B6.CD.04132.C6DB1EA5; Thu, 26 Apr 2018 20:52:12 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20180426115211epcas1p3db7cbe215a3dfb49567a771931574a2f~o_inndMSl2320423204epcas1p3_; Thu, 26 Apr 2018 11:52:11 +0000 (GMT) X-AuditID: b6c32a35-9cbff70000001024-d4-5ae1bd6cc984 Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 78.8C.03822.B6DB1EA5; Thu, 26 Apr 2018 20:52:11 +0900 (KST) Received: from AMDC3058.DIGITAL.local ([106.120.53.102]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0P7S00GD7JMBQG00@mmp2.samsung.com>; Thu, 26 Apr 2018 20:52:11 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Eduardo Valentin Cc: Zhang Rui , linux-samsung-soc@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, b.zolnierkie@samsung.com Subject: [PATCH 05/18] thermal: exynos: use sanitize_temp_error() in exynos7_tmu_initialize() Date: Thu, 26 Apr 2018 13:51:20 +0200 Message-id: <1524743493-28113-6-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1524743493-28113-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrBIsWRmVeSWpSXmKPExsWy7bCmrm7O3odRBjM2qlhsnLGe1WL+lWus Fpd3zWGz+Nx7hNFixvl9TBZPHvaxObB57Jx1l91j8Z6XTB59W1YxenzeJBfAEsVlk5Kak1mW WqRvl8CVcWqDYMEk3oqX7Y/ZGxh7uLsYOTkkBEwkFm1ewtLFyMUhJLCDUWLL6wZmCOc7o0TP lH+sXYwcYFVH18qDNAgJbGCU2DGdCaLmF6PEvO8vmUASbAJWEhPbVzGC2CICWhInLm0HK2IW mMMoMathNwtIQlggXuLo5k+sIDaLgKrEtgMP2EBsXgEPie8t01khTpKTOHlsMpjNKeApceFI E9h5EgJ/WSXaH35ghyhykWh9uJUJwhaWeHV8CzvEpdISl47aQtQ3M0p827GHGaJmAqPEnvVC ELa1xOHjF8EWMAvwSbz72gP1Ja9ERxtUiYfEwoZ+qHscJQ48eQP1MdAz23d+ZpvAKLWAkWEV o1hqQXFuemqxYYGhXnFibnFpXrpecn7uJkZw/GmZ7mCccs7nEKMAB6MSD2/AwgdRQqyJZcWV uYcYJTiYlUR441sfRgnxpiRWVqUW5ccXleakFh9ilOZgURLnfepzJkpIID2xJDU7NbUgtQgm y8TBKdXAGC3QoTjNPnWzpplytdjH10tY3TkffDvNsHvOyjWNAswCNYzHvn2Xk5Cw4ph5XoRt XcH8wPVCAnGe4RzCp9Laf6pwKjzXX/pa/zbXzMmPV9QfKwlhexC65XVCxRmV7caH4hO/+Xrn /ZSK/jp/rUnGH9Otx2/2Pe5QcdG/XF9VfW655+zd658eVmIpzkg01GIuKk4EADy7PYe7AgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpkluLIzCtJLcpLzFFi42I5/e+xoG723odRBo/a1S02zljPajH/yjVW i8u75rBZfO49wmgx4/w+JosnD/vYHNg8ds66y+6xeM9LJo++LasYPT5vkgtgieKySUnNySxL LdK3S+DKOLVBsGASb8XL9sfsDYw93F2MHBwSAiYSR9fKdzFycQgJrGOUWPJmKhOE84tRYvKO Q6xdjJwcbAJWEhPbVzGC2CICWhInLm0HK2IWmMMo8XzFHCaQhLBAvMTRzZ/AGlgEVCW2HXjA BmLzCnhIfG+ZDhaXEJCTOHlsMpjNKeApceFIEwuILQRUc7/vPdsERp4FjAyrGCVTC4pz03OL jQoM81LL9YoTc4tL89L1kvNzNzECA2bbYa2+HYz3l8QfYhTgYFTi4Q1Y+CBKiDWxrLgy9xCj BAezkghvfOvDKCHelMTKqtSi/Pii0pzU4kOM0hwsSuK8t/OORQoJpCeWpGanphakFsFkmTg4 pRoYU7YY3F8f7/fg/9aK1RU/nnMa5bBfiJaaP8+gv9xjwtMb9w0y+X0uXN7dJDC/iu+5sp5h 8h6TGz/YVb8KVusu22i1c953j9ctdq/1+UTDmfhrbGYpmdiXK51vubHTl8d1pReP6ry+qEiX z517ixbVpmvVzlvH/6v+clysS0TIiUetMhNrJUSVWIozEg21mIuKEwGLV9f1FAIAAA== X-CMS-MailID: 20180426115211epcas1p3db7cbe215a3dfb49567a771931574a2f X-Msg-Generator: CA CMS-TYPE: 101P X-CMS-RootMailID: 20180426115211epcas1p3db7cbe215a3dfb49567a771931574a2f X-RootMTR: 20180426115211epcas1p3db7cbe215a3dfb49567a771931574a2f References: <1524743493-28113-1-git-send-email-b.zolnierkie@samsung.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fix sanitize_temp_error() to handle Exynos7 SoCs and then use it in exynos7_tmu_initialize(). There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz Reviewed-by: Daniel Lezcano --- drivers/thermal/samsung/exynos_tmu.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 3b41666..5a64879 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -286,7 +286,11 @@ static int code_to_temp(struct exynos_tmu_data *data, u16 temp_code) static void sanitize_temp_error(struct exynos_tmu_data *data, u32 trim_info) { - data->temp_error1 = trim_info & EXYNOS_TMU_TEMP_MASK; + u16 tmu_temp_mask = + (data->soc == SOC_ARCH_EXYNOS7) ? EXYNOS7_TMU_TEMP_MASK + : EXYNOS_TMU_TEMP_MASK; + + data->temp_error1 = trim_info & tmu_temp_mask; data->temp_error2 = ((trim_info >> EXYNOS_TRIMINFO_85_SHIFT) & EXYNOS_TMU_TEMP_MASK); @@ -592,12 +596,7 @@ static int exynos7_tmu_initialize(struct platform_device *pdev) unsigned int reg_off, bit_off; trim_info = readl(data->base + EXYNOS_TMU_REG_TRIMINFO); - - data->temp_error1 = trim_info & EXYNOS7_TMU_TEMP_MASK; - if (!data->temp_error1 || - (data->min_efuse_value > data->temp_error1) || - (data->temp_error1 > data->max_efuse_value)) - data->temp_error1 = data->efuse_value & EXYNOS_TMU_TEMP_MASK; + sanitize_temp_error(data, trim_info); /* Write temperature code for rising and falling threshold */ for (i = (of_thermal_get_ntrips(tz) - 1); i >= 0; i--) {