Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp10704190imu; Thu, 6 Dec 2018 05:33:57 -0800 (PST) X-Google-Smtp-Source: AFSGD/W0k+1rk0ijLkcyPQI+RAlSRD9DgXEnmcKIdJZCHDAoJeIDP9rNTqxdGTWlehhKqebnnuYP X-Received: by 2002:a17:902:7588:: with SMTP id j8mr9084576pll.215.1544103237249; Thu, 06 Dec 2018 05:33:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544103237; cv=none; d=google.com; s=arc-20160816; b=lRdhzDLJK7XwcJGOUfeejr5o8pfAq+ApuPW5J2IP5JAIiFgcJ/VK+R7xly1U2DuTp9 Sll6GsfLkR2SUGZVzzRUb2O/vQfPIRJWrx0TrCIA++lwz7FgjxdqX4qpYwPAEkbhk00m 12VpwCYAMwx/vw6YqU6sHGUEjRxtzP5JtxfODfQH/PlluK6dYnq5KR+fb80IPN9q1TCY VcyytHkvGlnZ1AJyk1Bt9UOiIvSDILssyua4qq4lfH0O3oLHfLyNawpLf7Z3SG6EBh5b MjLhgNIosgJI3J69QGsRoGTdZ4Z0kNYoJhMx40SeImgFoEHlZx+mVccj2nmOjApgEscM nTFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=ma7F/MaGF7iButmMQePk0cKTz/A+1Gb0fFsb/aq9g6M=; b=H3x2CxjDhj761FUhNTNtmbjkzvgxqEbor/rsg/zbrBeJ96FwHMUiIX8dDnK1rNPUS8 BWW6J5g7AU3aP2r4KlAaKijIwe1MDl3QshGH5RVCA+6I6Z7dwpDHMUMsmRQOtqIL9ILB KYMi4180L0p1xN+EYkSIhEAW6vUyReocd+kRi5mIUPfFLw1j2JXoSoSd/7qKOed69qFi xfZCX6Dx5ZbHM4O5BEgE0DRDwYFaBW9za6eqJPH5xM0kWDKA/sJYnrNIfNnkxkIPXFsK 889wA2pxENEcikR1v5oV1JrWxQyJjNVcqd0XyFrFatTWJSnd3ghQuIgA9y9XDYcWcp3K sEXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DCDly5GN; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s38si268883pga.38.2018.12.06.05.33.39; Thu, 06 Dec 2018 05:33:57 -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=@linaro.org header.s=google header.b=DCDly5GN; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728939AbeLFNc0 (ORCPT + 99 others); Thu, 6 Dec 2018 08:32:26 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:54674 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727704AbeLFNcZ (ORCPT ); Thu, 6 Dec 2018 08:32:25 -0500 Received: by mail-wm1-f67.google.com with SMTP id z18so1000066wmc.4 for ; Thu, 06 Dec 2018 05:32:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=ma7F/MaGF7iButmMQePk0cKTz/A+1Gb0fFsb/aq9g6M=; b=DCDly5GNurc+2KWbcML7ieCgR10KD2oe7OHdxENylgHVysEA1EZQNyMX6WIk6UOTLy vrl54p25WekKlkg4u+T84aALSWjcO8YOyg9TFAo4z0PW0k90dd/MaThVAsxO4Zl06ISt YP/jc9pxjr2Bf4YLaO2VgmacYc8xxQZo7mrLc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ma7F/MaGF7iButmMQePk0cKTz/A+1Gb0fFsb/aq9g6M=; b=dpGjQsPV5uYrlM0wxzMF3pMWHFuTZReAFXzPyNQuDNkqoi+yn8hjpNFJrsOK8sEZ6q 2CAxyy4pJ7CwjJW3P5j6PjlX1sS1LUVNCWZxhnbQa9MrENtXheJEwoVyjT6k+TpIQRbl 9ilGTpXCZyePsPgWivijVMT3P6FRrX7LfskcEEFqKxhuM8QkdYxRVb9fT2d/fjKHhzEr 2K75+N8ZE3mdWdeXQsq/GzErm4boW/sLd011pz9/LA0BhUojS87PQLvVgGx36AMgTd9f yCUptBObKSIg6kaGcx6DxIQ+OVtnYkbPhdpEZafm5rtIdaozqskjOoeDffbBePQxwsqb FFog== X-Gm-Message-State: AA+aEWbY2f4apKMWiucDSWfzd4vrKcP1D5YGzWooIv8j4HCIJrkPOrgE mqzT8bovwJdjyrBXjtdLi6jHuA== X-Received: by 2002:a1c:f404:: with SMTP id z4mr19935873wma.68.1544103143229; Thu, 06 Dec 2018 05:32:23 -0800 (PST) Received: from [192.168.0.40] (172.220.136.77.rev.sfr.net. [77.136.220.172]) by smtp.googlemail.com with ESMTPSA id d5sm788927wrx.22.2018.12.06.05.32.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Dec 2018 05:32:22 -0800 (PST) Subject: Re: [PATCH] thermal: stm32: read factory settings inside stm_thermal_prepare To: David HERNANDEZ SANCHEZ , Zhang Rui , Eduardo Valentin , Rob Herring , Mark Rutland , Maxime Coquelin , Alexandre TORGUE Cc: "linux-pm@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "linux-stm32@st-md-mailman.stormreply.com" References: <1544102603-14899-1-git-send-email-david.hernandezsanchez@st.com> <1544102603-14899-2-git-send-email-david.hernandezsanchez@st.com> From: Daniel Lezcano Message-ID: <7999967d-6f6e-635c-4d43-c0e1cd58ec4b@linaro.org> Date: Thu, 6 Dec 2018 14:32:20 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <1544102603-14899-2-git-send-email-david.hernandezsanchez@st.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/12/2018 14:23, David HERNANDEZ SANCHEZ wrote: > Calling stm_thermal_read_factory_settings before clocking > internal peripheral causes bad register values and makes > temperature computation wrong. > > Calling stm_thermal_read_factory_settings inside > stm_thermal_prepare fixes this problem as internal > peripheral is well clocked at this stage. > > Signed-off-by: David Hernandez Sanchez > Fixes: 1d693155 ("thermal: add stm32 thermal driver") Same comment as the first patch. Reviewed-by: Daniel Lezcano > diff --git a/drivers/thermal/st/stm_thermal.c b/drivers/thermal/st/stm_thermal.c > index 47623da..daa1257 100644 > --- a/drivers/thermal/st/stm_thermal.c > +++ b/drivers/thermal/st/stm_thermal.c > @@ -532,6 +532,10 @@ static int stm_thermal_prepare(struct stm_thermal_sensor *sensor) > if (ret) > return ret; > > + ret = stm_thermal_read_factory_settings(sensor); > + if (ret) > + goto thermal_unprepare; > + > ret = stm_thermal_calibration(sensor); > if (ret) > goto thermal_unprepare; > @@ -636,10 +640,6 @@ static int stm_thermal_probe(struct platform_device *pdev) > /* Populate sensor */ > sensor->base = base; > > - ret = stm_thermal_read_factory_settings(sensor); > - if (ret) > - return ret; > - > sensor->clk = devm_clk_get(&pdev->dev, "pclk"); > if (IS_ERR(sensor->clk)) { > dev_err(&pdev->dev, "%s: failed to fetch PCLK clock\n", > -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog