Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp510032ybl; Fri, 10 Jan 2020 02:19:42 -0800 (PST) X-Google-Smtp-Source: APXvYqzZoho3kA0U8+ixRvTTh29/it6sLU7pIN58h+buvmXKY2DDzXE3vDj58D9k3aM1A35JWXvb X-Received: by 2002:a05:6830:154c:: with SMTP id l12mr1958856otp.275.1578651582599; Fri, 10 Jan 2020 02:19:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578651582; cv=none; d=google.com; s=arc-20160816; b=HxKLuu0PkxlhMZKgY6zfVm35cR/VBG9/itvUk4rskLM1QSdgYqkRLvf4/pXh0BTjl7 tTgEFSopDaMpSAmFb72xph92vMsaNntjYYwf0ccd9yz0SmtOoIk+9hyasfSIieOblPhK DsUbjA6wEI64BNeLzCd5DfeJDONhL+aYF9onwxdH+hc+wqCGGORBh4s5P2UfubuNAXjX td8/s5PWQAdvBgg06EvDToWmUpTTMEwd2MxAXaLLZHJcnA7CGPWQ8Oz3WA3F678YkmbQ g454WKJTWBx1Ayk8N7+7wEjoOEZ077jjssr/htSqH+iJegBWYd9Ro557HVKWQwyFYp3P DS7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=MsYZtSJTRtofOX1+DaEAVsiSRhsLl0necGZ8OJbUceY=; b=unt8PWMFe+K+i6zZp8WpWlfFKhIx0SuPFhe9DUiwVwD5TRfitxn3vauIRfiFauhrT8 K4Za+ZLx2DZpF3mnuiOkdtmaUY9m+SoiKo0eUSdRy7TzRlZcd0goa0MXN2r/v0Pmch3z REE8vnwseP2PsZ109QZF9K3j++i0isdk6ScWNNMXfcNED+O1o7a61hveqP0sKADBv8M2 loKqN67GF68id1uQ/b/W1qe2fuWOeHfJeg1M4g8OAFNkPsNoB4rBmp46QDQRkChWt9TK n8CeodGWGTqVJ7lkQgAX1O6ZMLewVys/AU43Chpin0pHKqjdQZAS6ETZmeBmbtLUvH6g 0ZNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=accDVAbH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=st.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g25si974855otp.20.2020.01.10.02.19.31; Fri, 10 Jan 2020 02:19:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=accDVAbH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727634AbgAJKQ6 (ORCPT + 99 others); Fri, 10 Jan 2020 05:16:58 -0500 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:27722 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727445AbgAJKQf (ORCPT ); Fri, 10 Jan 2020 05:16:35 -0500 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 00AAE8Dx029396; Fri, 10 Jan 2020 11:16:11 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=MsYZtSJTRtofOX1+DaEAVsiSRhsLl0necGZ8OJbUceY=; b=accDVAbHVcJLvFxLvvSntdbWOxM1RFgWQAK86Kkg8SLmaJWvoS5tTeuahNLi9Jm3u68T 8ZgQ5D6EDnwWAEPgcYf25gFwQxd0UWoapJB2PqUPJx6mo09R4LXA1EKH7/W307+NWWv/ NuEi7GDvf7PK6VFwhxpOnWbgTaOhlHtLzCqH9d/A9h+vPPqf4nPtVmwM0GcMksWxe0yr Pxw1SR+tTM/NNkDpDNRXSCFR52B6MHSKyD+bOx4Y5Y0aj1wl2qcN7ubGAH9OtpALZ7eT JJI5waYLhLVx1eXHk5ArYsAuxVhsluQi45ceA/teUD0P5Y7c3rRNK1fkL8WdQv5wjyPF OA== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2xakkb742a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 10 Jan 2020 11:16:11 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id DC53810003A; Fri, 10 Jan 2020 11:16:09 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag6node2.st.com [10.75.127.17]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id CCC992A7907; Fri, 10 Jan 2020 11:16:09 +0100 (CET) Received: from localhost (10.75.127.47) by SFHDAG6NODE2.st.com (10.75.127.17) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Fri, 10 Jan 2020 11:16:09 +0100 From: Pascal Paillet To: , , , , , , , , , , , , , Subject: [PATCH_V3 2/6] thermal: stm32: rework sensor mode management Date: Fri, 10 Jan 2020 11:16:01 +0100 Message-ID: <20200110101605.24984-3-p.paillet@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200110101605.24984-1-p.paillet@st.com> References: <20200110101605.24984-1-p.paillet@st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.75.127.47] X-ClientProxiedBy: SFHDAG7NODE3.st.com (10.75.127.21) To SFHDAG6NODE2.st.com (10.75.127.17) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-01-10_01:2020-01-10,2020-01-09 signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Be sure get_temp returns an error while disabling or enabling the device. Set THERMAL_DEVICE_ENABLED state at the end of power on function. Set THERMAL_DEVICE_DISABLED state at the beginning of power off function. Signed-off-by: Pascal Paillet --- drivers/thermal/st/stm_thermal.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/st/stm_thermal.c b/drivers/thermal/st/stm_thermal.c index 7835e109692e..a21fa7e0c72b 100644 --- a/drivers/thermal/st/stm_thermal.c +++ b/drivers/thermal/st/stm_thermal.c @@ -160,6 +160,8 @@ static int stm_sensor_power_on(struct stm_thermal_sensor *sensor) writel_relaxed(value, sensor->base + DTS_CFGR1_OFFSET); + sensor->mode = THERMAL_DEVICE_ENABLED; + return 0; } @@ -167,6 +169,8 @@ static int stm_sensor_power_off(struct stm_thermal_sensor *sensor) { u32 value; + sensor->mode = THERMAL_DEVICE_DISABLED; + /* Stop measuring */ value = readl_relaxed(sensor->base + DTS_CFGR1_OFFSET); value &= ~TS1_START; @@ -374,7 +378,6 @@ static int stm_thermal_update_threshold(struct stm_thermal_sensor *sensor) { int ret; - sensor->mode = THERMAL_DEVICE_DISABLED; ret = stm_sensor_power_off(sensor); if (ret) @@ -576,8 +579,6 @@ static int stm_thermal_suspend(struct device *dev) if (ret) return ret; - sensor->mode = THERMAL_DEVICE_DISABLED; - return 0; } @@ -590,7 +591,6 @@ static int stm_thermal_resume(struct device *dev) if (ret) return ret; - sensor->mode = THERMAL_DEVICE_ENABLED; return 0; } @@ -718,8 +718,6 @@ static int stm_thermal_probe(struct platform_device *pdev) if (ret) goto err_tz; - sensor->mode = THERMAL_DEVICE_ENABLED; - dev_info(&pdev->dev, "%s: Driver initialized successfully\n", __func__); -- 2.17.1