From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933360AbbI3Khn (ORCPT ); Wed, 30 Sep 2015 06:37:43 -0400 Received: from metis.ext.4.pengutronix.de ([92.198.50.35]:40957 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932221AbbI3Khf (ORCPT ); Wed, 30 Sep 2015 06:37:35 -0400 Date: Wed, 30 Sep 2015 12:37:04 +0200 From: Sascha Hauer To: Punit Agrawal Cc: linux-pm@vger.kernel.org, Zhang Rui , Eduardo Valentin , linux-kernel@vger.kernel.org, kernel@pengutronix.de, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Matthias Brugger , devicetree@vger.kernel.org, mark.rutland@arm.com, robh+dt@kernel.org Subject: Re: [PATCH 2/3] thermal: Add Mediatek thermal controller support Message-ID: <20150930103704.GA7858@pengutronix.de> References: <1443015463-23639-1-git-send-email-s.hauer@pengutronix.de> <1443015463-23639-3-git-send-email-s.hauer@pengutronix.de> <9hhpp105jw1.fsf@e105922-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9hhpp105jw1.fsf@e105922-lin.cambridge.arm.com> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 12:10:58 up 10 days, 23:40, 72 users, load average: 0.58, 0.34, 0.22 User-Agent: Mutt/1.5.21 (2010-09-15) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Punit, On Wed, Sep 30, 2015 at 10:36:14AM +0100, Punit Agrawal wrote: > Hi Sascha, > > Re-posting a comment from v7. Perhaps you missed it... Uh, sorry. In fact I didn't miss it and I thought I have answered it. Appearantly I haven't. > > + struct mtk_thermal *mt = bank->mt; > > + int temp, i, max; > > + u32 raw; > > + > > + temp = max = INT_MIN; > > + > > + for (i = 0; i < bank_data[bank->id].num_sensors; i++) { > > + raw = readl(mt->thermal_base + sensing_points[i].msr); > > + > > + temp = raw_to_mcelsius(mt, raw); > > + > > + /* > > + * The first read of a sensor often contains very high bogus > > + * temperature value. Filter these out so that the system does > > + * not immediately shut down. > > + */ > > + if (temp > 200000) > > + temp = 0; > > + > > If the bogus value is only the first time the sensor is read, instead of > filtering here, you could call mtk_thermal_bank_temperature at probe > time when you are initialising the banks and ignore the returned value. It seems that after initialization the hardware needs some time to settle before correct values can be read. Doing what you suggest would mean we have to delay the boot by several 100ms. I'd rather not do that. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |