Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1955651ybh; Fri, 24 Jul 2020 00:15:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhA9gEJu45PzimkNJpZlhljP3bGg+48f1CM1I8DHHPkuSfgxkAYq6mwhxJTGJMVbjTACzP X-Received: by 2002:aa7:da06:: with SMTP id r6mr7739900eds.189.1595574925501; Fri, 24 Jul 2020 00:15:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595574925; cv=none; d=google.com; s=arc-20160816; b=UeftNgqSoqRnQrO1tnsZqgSGUXn+d2V+9KE+czCXS/uNwOvtSa4Tnx1LyR8Ix/hLdN CKZANCNVJ59WdDQEhOA2/nqIGu5ZTx3cF4VcaRtEHJb8OEbaoal0LUFcAT+As8BiAROf 1VvpCNEdu3vQncgdXz+FZ3gjiZlGWlpAAOronaDRhm3ujZU5Gq03o+RKyzfKTZqz5/AQ SZMauaKVPRcxQrRaIRBKpr+6zkmUbl9hM9tMMPReQtcEO99JNsbS+9CfAb89OxEpf8k+ nINz/a7vvtT3eM1YzzZap9H1H+fxxaFr8dsdZEgA2BSzuI7thz8nMB9+KNGxgxLuSr9D Rhgw== 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=qDa6Zk+QZZ4AehXcQnF9pfMGzM88UbqAsWGZkWl8pPE=; b=eIc4AV+sGllNKmq0WBaQQ4dyQi/5YetvT2VBL6dVaSLmJJMgH/zOZzZKM0/nqZQOeg DZ1D+WlB/ywbvxRpT9zRFNI6YUyo5dJZ4vtn9BNn1rLHhtisl+y/uknaVb9FPFODQals wItLGhZTfGd60upJhOgLKuLwxmUNdmJmNkioAaq4qoqvxwF/FzuTTq4rMaVU91S23iX4 MrXQhxY1Z29r02PBk+OIuOQ730KCTXBeXc0KwlkHw2908xQn7sWabjyT+6fxN+Z3QJZo BdQzfUdchMziJ0jBTXGHqpTOhGWQ/+aDmbRRPLCatz1n/0rPWZpkGgg4tqEo2BycHiJz 8Csg== 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 di16si14158edb.397.2020.07.24.00.15.03; Fri, 24 Jul 2020 00:15:25 -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 S1726941AbgGXHM3 (ORCPT + 99 others); Fri, 24 Jul 2020 03:12:29 -0400 Received: from smtp2207-205.mail.aliyun.com ([121.197.207.205]:52863 "EHLO smtp2207-205.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726559AbgGXHM3 (ORCPT ); Fri, 24 Jul 2020 03:12:29 -0400 X-Alimail-AntiSpam: AC=CONTINUE;BC=0.1472325|-1;CH=green;DM=|CONTINUE|false|;DS=CONTINUE|ham_system_inform|0.0288318-0.000377861-0.97079;FP=0|0|0|0|0|-1|-1|-1;HT=e02c03306;MF=frank@allwinnertech.com;NM=1;PH=DS;RN=15;RT=15;SR=0;TI=SMTPD_---.I6qVYnt_1595574739; Received: from allwinnertech.com(mailfrom:frank@allwinnertech.com fp:SMTPD_---.I6qVYnt_1595574739) by smtp.aliyun-inc.com(10.147.40.200); Fri, 24 Jul 2020 15:12:24 +0800 From: Frank Lee To: anarsoul@gmail.com, tiny.windzz@gmail.com, rui.zhang@intel.com, daniel.lezcano@linaro.org, amit.kucheria@verdurent.com, robh+dt@kernel.org, mripard@kernel.org, wens@csie.org, linux-pm@vger.kernel.org Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, huangshuosheng@allwinnertech.com, liyong@allwinnertech.com, Yangtao Li Subject: [PATCH v5 08/16] thermal: sun8i: add TEMP_CALIB_MASK for calibration data in sun50i_h6_ths_calibrate Date: Fri, 24 Jul 2020 15:11:42 +0800 Message-Id: X-Mailer: git-send-email 2.24.0 In-Reply-To: References: 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 From: Yangtao Li 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: 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 74d73be16496..f423d44b9290 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); -- 2.24.0