Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp318817ybt; Wed, 8 Jul 2020 00:21:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/A21DW3tiArprn4IqK/0ghBrUu4MFOMYGYGb3980jkvlUnKYUOZHgZqdVx2wlCuhgnsov X-Received: by 2002:a05:6402:1687:: with SMTP id a7mr65059487edv.358.1594192863421; Wed, 08 Jul 2020 00:21:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594192863; cv=none; d=google.com; s=arc-20160816; b=oPyprHGRkZK2Wy2+GRUAGMjsNRMHXi7Enlg9VAeRHeaX2Q7TBkU6J6xY0AaMQkT75n wWQc8Viw2DwuT58t6eTMC6RMNV7UeYHsXpvF7yHkPec10qDrSdZuhu/QVRBsdPKMyPc0 qzuzO58qxg9wTT2TvV40z75Y+Fjhdi4QWuDQQk3cBGx2cBA1Rb4ofanjx5FHomiZMUft CbmjcZJgyUO0uKylu6N0NY+oXH/7p10jFSOuo8V1MGm2syqHeX3xAVbr2vjF0+1ResP5 W/K6cTllliigbTgUcWJiai6+YBHSc6hfRnqn3X4zNaeeEDdqv5/+XKZaEMEaT3xWkWpx qqcw== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=QBmXpwHJ0oNAz3A/CQxwCy2LXNs4BAHm/SLo7lSnSi4=; b=nZ8LeRXe3Z05JswGxACya0z9hVGlyzqJXSxF2II4Uv15Lxf7aPdoQlynKD1HoXHMTk xuSMpJUZRwnleo/82jxDJEYlqbmHf2/14E22Ogy27VEOpfry49qesjtXZclYr1w56t+F 4D2AZ+1cpAVIecg7XxNwq5tfvsorY+8Qk9eYvsa3um47hMuxiCtTP0goepD57hvjUkdp qoO5nTOfwrG50sr19CYkKmSJU76+SNh676jRLDJ2tMf80Q31mSpFRJf/2tGWO+k84pNh 9CvJZhnP2GZH2Wg6fWDer2nfpnt4th+5mZMt1ZxjVgOiJOeIRCsuGLogG/t+q1tk2yCi qVbg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o14si16301797edq.114.2020.07.08.00.20.40; Wed, 08 Jul 2020 00:21:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730340AbgGHHUP (ORCPT + 99 others); Wed, 8 Jul 2020 03:20:15 -0400 Received: from smtp2207-205.mail.aliyun.com ([121.197.207.205]:55331 "EHLO smtp2207-205.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730316AbgGHHUN (ORCPT ); Wed, 8 Jul 2020 03:20:13 -0400 X-Alimail-AntiSpam: AC=CONTINUE;BC=0.1470665|-1;CH=green;DM=|CONTINUE|false|;DS=CONTINUE|ham_system_inform|0.0450046-0.000476486-0.954519;FP=0|0|0|0|0|-1|-1|-1;HT=e01l07447;MF=frank@allwinnertech.com;NM=1;PH=DS;RN=33;RT=33;SR=0;TI=SMTPD_---.I-8lwqE_1594192774; Received: from allwinnertech.com(mailfrom:frank@allwinnertech.com fp:SMTPD_---.I-8lwqE_1594192774) by smtp.aliyun-inc.com(10.147.40.26); Wed, 08 Jul 2020 15:20:04 +0800 From: Frank Lee To: robh+dt@kernel.org, mripard@kernel.org, wens@csie.org, mturquette@baylibre.com, sboyd@kernel.org, gregory.clement@bootlin.com, tglx@linutronix.de, jason@lakedaemon.net, maz@kernel.org, srinivas.kandagatla@linaro.org, linus.walleij@linaro.org, anarsoul@gmail.com, tiny.windzz@gmail.com, rui.zhang@intel.com, daniel.lezcano@linaro.org, amit.kucheria@verdurent.com, lee.jones@linaro.org, p.zabel@pengutronix.de, clabbe@baylibre.com, icenowy@aosc.io, megous@megous.com, stefan@olimex.com, bage@linutronix.de Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-i2c@vger.kernel.org, linux-gpio@vger.kernel.org, linux-pm@vger.kernel.org, huangshuosheng@allwinnertech.com, liyong@allwinnertech.com, Frank Lee Subject: [PATCH v3 08/16] thermal: sun8i: add TEMP_CALIB_MASK for calibration data in sun50i_h6_ths_calibrate Date: Wed, 8 Jul 2020 15:19:34 +0800 Message-Id: <20200708071942.22595-9-frank@allwinnertech.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200708071942.22595-1-frank@allwinnertech.com> References: <20200708071942.22595-1-frank@allwinnertech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For sun50i_h6_ths_calibrate(), the data read from nvmem needs a round of calculation. On the other hand, the newer SOC may store other data in the space other than 12bit sensor data. Add mask operation to read data to avoid conversion error. Signed-off-by: Frank Lee Reviewed-by: Yangtao Li --- drivers/thermal/sun8i_thermal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c index 74d73be..f423d44 100644 --- a/drivers/thermal/sun8i_thermal.c +++ b/drivers/thermal/sun8i_thermal.c @@ -244,7 +244,7 @@ static int sun50i_h6_ths_calibrate(struct ths_device *tmdev, ft_temp = (caldata[0] & FT_TEMP_MASK) * 100; for (i = 0; i < tmdev->chip->sensor_num; i++) { - int sensor_reg = caldata[i + 1]; + int sensor_reg = caldata[i + 1] & TEMP_CALIB_MASK; int cdata, offset; int sensor_temp = tmdev->chip->calc_temp(tmdev, i, sensor_reg); -- 1.9.1