From patchwork Mon Apr 16 10:11:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 133442 Delivered-To: patch@linaro.org Received: by 10.46.84.18 with SMTP id i18csp3394000ljb; Mon, 16 Apr 2018 03:13:45 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/LZeAkzsnw1KHjsmx/wV2UyaGH1O3NHHMXS9YokUPP5D4gZjRKpdaaU84evl+ru8P1W/mj X-Received: by 10.99.115.4 with SMTP id o4mr12218923pgc.404.1523873625138; Mon, 16 Apr 2018 03:13:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523873625; cv=none; d=google.com; s=arc-20160816; b=a/OWuGL9UXVBYcmS04umZvmrrP1/YOiRkp8wGGBTmQm5e+qQaQRlq9T/CmGAc8uttx fuoqQzoeyqk7GSaW8mH7peD1eS0zdLRNJbffET7yVtZJq4bIsOUzK6SoOgSnG8VOI2J4 SnEZ1y4eZtND7KrUuLQ/WkOBdM5UdJMa6XivxC3zcSnKc5aQ2QSRSWJ7P7AeBRu2GOf+ 2Ymz0PCfXnVVZ2krqvDgtZfQ5ZRQnUQQHZz0N+cz6x19AGjczldxV3QmwsXv8Gqx8eba U3G3voU/X1PftlAtgXjpEQ8fuavLyRF05OXYtArgaTWQyQi7PGYF449au08XdRaAPDkQ 4ucQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=lQDmeC3/HhUpoXZrQp488VV+cJySNlb6DUvBDj5Yrqs=; b=03BttPFvSH3ZWopCXYC0PPbbSTdzPJ5ls4ao36U2IR2gODnao1PNpU4ox4kxacwj2n PhBV7CpV4P1aIjDajK5K3bbbIDYnD14pO/k2wZD/Dz02WCxZEnG7q6MROLSsmozFfZ/4 9YSK/5UAX19A5vaLKPKHYSxCLdEck4rYH3kr0pJsn3vuK0PWpsvNq4kkw39p/cnguIfT NQNEFOlbfChZtNb6qx8o8cmHLp/fxnZgdwq2sYorg92uj/UhTWvpmId8laIvielj6/7C vypFkmzCEkVKTjBY77/uGOfxJMRhNrUrQlnleIjwAumI3fpcICXli/AA4u1lzMlPUYJt eFcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b=UBv2bcM9; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o69si10584469pfi.322.2018.04.16.03.13.44; Mon, 16 Apr 2018 03:13:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b=UBv2bcM9; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753169AbeDPKNo (ORCPT + 3 others); Mon, 16 Apr 2018 06:13:44 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:61625 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752850AbeDPKNm (ORCPT ); Mon, 16 Apr 2018 06:13:42 -0400 Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20180416101340epoutp01a0e00bc80b8562001c08a280f9c06e78~l4vv5aIUd2855528555epoutp01O; Mon, 16 Apr 2018 10:13:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20180416101340epoutp01a0e00bc80b8562001c08a280f9c06e78~l4vv5aIUd2855528555epoutp01O DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1523873620; bh=JVe5MjkEKIhKCYpmsCzJ12L8iSmWcf1BTWmvdI/Pjng=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=UBv2bcM9AF8qYXAMT5JfBuVDeBFYwa0OcnJhooKejuEZ2laV91QC6o1VASRtdxSGG PTVkob3e5L5+7+/E8gemHJtxRKrr6hj4762CrxlI30GCPK6wbW3LttkLq0zKwPtWGP YSTWkJ6uARgUOW+ks8FFduz4yJ5aBOzWbHIpf5bY= Received: from epsmges2p1.samsung.com (unknown [182.195.42.69]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20180416101340epcas2p3f1fa7bb87f74ebfedf1501f7e8bac9ed~l4vvmuicE0099200992epcas2p3_; Mon, 16 Apr 2018 10:13:40 +0000 (GMT) Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 96.DF.04068.45774DA5; Mon, 16 Apr 2018 19:13:40 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20180416101339epcas2p171d462b70a85a6fff3bb939fca6d469d~l4vvB2TDb2036620366epcas2p1F; Mon, 16 Apr 2018 10:13:39 +0000 (GMT) X-AuditID: b6c32a45-6ebff70000000fe4-19-5ad477543f09 Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 96.79.03827.35774DA5; Mon, 16 Apr 2018 19:13:39 +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 <0P79000EEWCHS590@mmp2.samsung.com>; Mon, 16 Apr 2018 19:13:39 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Eduardo Valentin Cc: Zhang Rui , Krzysztof Kozlowski , Kukjin Kim , Daniel Lezcano , linux-samsung-soc@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, b.zolnierkie@samsung.com, Marek Szyprowski Subject: [PATCH 01/14] thermal: exynos: Reading temperature makes sense only when TMU is turned on Date: Mon, 16 Apr 2018 12:11:52 +0200 Message-id: <1523873525-23718-2-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1523873525-23718-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrBIsWRmVeSWpSXmKPExsWy7bCmmW5I+ZUog7ZLIhYbZ6xntZj3WdZi /pVrrBb9j18zW5w/v4Hd4vKuOWwWn3uPMFrMOL+PyWLtkbvsFk8e9rE5cHnsnHWX3WPxnpdM HptWdbJ53Lm2h82jb8sqRo/Pm+QC2KK4bFJSczLLUov07RK4Mh4tW8RacFuwYu7L34wNjM/5 uhg5OSQETCQW3XzK3sXIxSEksINR4tvu+cwQzndGialPtrDDVE1f+QkqsYFR4u3tw1DOL0aJ DSv2MoJUsQlYSUxsXwVmiwhoSZy4tJ0JpIhZYD+TRO+yuawgCWGBFIndK4+BjWURUJU4cuoA UJyDg1fAQ2Lm1VCIbXISJ49NBivnFPCUaFpzjQ1kjoTACjaJLVtAzgApcpE4fOsN1HnCEq+O w5wqLfFs1UZGiIZmoId27IFqmMAosWe9EIRtLXH4+EWwDcwCfBIdh/+ygxwhIcAr0dEGVeIh 8fHNTxYI21Hiz9oTLBAfz2GUuNb0i3UCo9QCRoZVjGKpBcW56anFRgWGesWJucWleel6yfm5 mxjB8avluoNxxjmfQ4wCHIxKPLw7zl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: 20180416101339epcas2p171d462b70a85a6fff3bb939fca6d469d X-Msg-Generator: CA CMS-TYPE: 102P X-CMS-RootMailID: 20180416101339epcas2p171d462b70a85a6fff3bb939fca6d469d X-RootMTR: 20180416101339epcas2p171d462b70a85a6fff3bb939fca6d469d References: <1523873525-23718-1-git-send-email-b.zolnierkie@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org From: Marek Szyprowski When thermal sensor is not yet enabled, reading temperature might return random value. This might even result in stopping system booting when such temperature is higher than the critical value. Fix this by checking if TMU has been actually enabled before reading the temperature. This change fixes booting of Exynos4210-based board with TMU enabled (for example Samsung Trats board), which was broken since v4.4 kernel release. Signed-off-by: Marek Szyprowski Fixes: 9e4249b40340 ("thermal: exynos: Fix first temperature read after registering sensor") CC: stable@vger.kernel.org # v4.6+ Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/thermal/samsung/exynos_tmu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index ed805c7..986cbd0 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -185,6 +185,7 @@ * @regulator: pointer to the TMU regulator structure. * @reg_conf: pointer to structure to register with core thermal. * @ntrip: number of supported trip points. + * @enabled: current status of TMU device * @tmu_initialize: SoC specific TMU initialization method * @tmu_control: SoC specific TMU control method * @tmu_read: SoC specific TMU temperature read method @@ -205,6 +206,7 @@ struct exynos_tmu_data { struct regulator *regulator; struct thermal_zone_device *tzd; unsigned int ntrip; + bool enabled; int (*tmu_initialize)(struct platform_device *pdev); void (*tmu_control)(struct platform_device *pdev, bool on); @@ -398,6 +400,7 @@ static void exynos_tmu_control(struct platform_device *pdev, bool on) mutex_lock(&data->lock); clk_enable(data->clk); data->tmu_control(pdev, on); + data->enabled = on; clk_disable(data->clk); mutex_unlock(&data->lock); } @@ -890,7 +893,7 @@ static int exynos_get_temp(void *p, int *temp) { struct exynos_tmu_data *data = p; - if (!data || !data->tmu_read) + if (!data || !data->tmu_read || !data->enabled) return -EINVAL; mutex_lock(&data->lock);