Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1623143pxf; Fri, 19 Mar 2021 11:17:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJweRUApGT0DbMQpEU4e/7b6AsqUzHncDYDT5M/Rd7I/1kkApHdxDQbwRHRn9VlCSRgD+E/N X-Received: by 2002:a17:907:2661:: with SMTP id ci1mr5754889ejc.403.1616177848581; Fri, 19 Mar 2021 11:17:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616177848; cv=none; d=google.com; s=arc-20160816; b=mB6wpoqyoKxpIqk6g9gwelj2HHglEL4oBNrR62bDr9Hz8bsTTfD2pMDdkr2/UXaLrI EuEfWpjUzyHZMfq7VLOQtfk9iv4YJPMxJjbiq2TA659D14ZQb3JVv7AMomUytvnWcKAj fIhYXDXc2lsqCZzfVQNBTE4fcFPkGMAQJarVaWIXrOuQU10aVIhCFDObTY+y/8mgOF4/ AQ6kdvW2PEyxi34DMCz10yHmm9/U81uE9koK++ao6uteCVRzIcxY9mgSUvy9Gz/yRyQ5 TM3Cke3uzLx9qe5FmF6SIc3L02dvb7J4dCNQPqfb25zfJHL0T0Au21aHb0zlfd8HnG/r 3Eng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=A96CjrFMTFBzH0FBnki24YuX02XsfjoC/hVWyeOwHlQ=; b=LMQIq3J5UYlxAtaT4XXENDSW7jun/i35+LGIuVuE+UDhOzZCKAk4NDg71gEYAkBVWf 6jgTGcAwME0iD3SwYjECb7QXRuyTlCG86SfsVZHiI/dMm9Ef5HZZz0m+spsl9VdDJMwL 1PcUZbiMqJaAh2k7be79rhED2xqSFIYZ3A6bkeSYsXShMA+E9cFcfw+FDVnuQq52A+So Cesgny1QjFqtDoKnRCVfgMHM5VEWjSUYDDlrl4zerCTQ2c6KUCnmVadLePD60haTt0kp US0b0RfUxdpzRXGd+nDTl7N3cf8EwJfNxY9JDJL4lR5s4CGAD7C0+3ul6fgspJKdga3o iJCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lR+sCBO+; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bu13si4447521edb.498.2021.03.19.11.17.06; Fri, 19 Mar 2021 11:17:28 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lR+sCBO+; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230492AbhCSSQC (ORCPT + 99 others); Fri, 19 Mar 2021 14:16:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230113AbhCSSP1 (ORCPT ); Fri, 19 Mar 2021 14:15:27 -0400 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DE20C06174A; Fri, 19 Mar 2021 11:15:27 -0700 (PDT) Received: by mail-ej1-x630.google.com with SMTP id u5so11195604ejn.8; Fri, 19 Mar 2021 11:15:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=A96CjrFMTFBzH0FBnki24YuX02XsfjoC/hVWyeOwHlQ=; b=lR+sCBO+kPdLOIMk3Whdm1uElZq/eN0dGnWH3duwpCO2+2dqBht1tO1mkiubB3ODak GtI3JWvqkkStqv1EFbPjIrFfHeuXCvvD/kr2Dmqqn4mBfJE+NWnh0/+iOWRLOinkP+RG MgZ6cBgBKvdyNO7gycJfo4nR3ME5IYXItRCplHOk6/ajNprsWts5tMCj4Gd28f3u+T17 nETFSvCQZ58fzTfj1kud7JJ5riREpEuFSS/IQlbvk8gqKEYxB7iCHCXQJhu+LHEDgyrp 0EFemzvM6KdHEkykgC1JUS8+V6zTmCsbx8eyZGT1YeDH43fwoxlGeMzZhg5Pu6R1VUkL y8Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=A96CjrFMTFBzH0FBnki24YuX02XsfjoC/hVWyeOwHlQ=; b=fSj8OXpMwOmaqy1ciCKWl0lpnBhP23BbshP55hd1Vj2JfGZAdAUOstNJc4PErOnGMI 5HH0NHG/cEbXra2mmmI6LrQfTBXQL8MNtcqUS1ovW2Q7ib8HDjah9r54Pd654rjiMNtU j/3Y5ux31pj7cw5IlJzINfq3NzgqQXYZnX+OrYOYy1ue4MAxuDnNi8/hU598uF7VKVew OE/cYhw4dtElO4AOuLjzROEc2uGtv7bB+LOydW2qP6hy26FzAikVu/NyuTrYymsR4jLV +kdQ8yJp1K1kdY8+XULfx/VrI29RqMt41kjTlyMXjp79n8EdMdBgqTmhGRwL+8R9dpLk C7Ow== X-Gm-Message-State: AOAM533z4NjADrQTRQO2D5tLeM9IjJ2cz3n9TbvZp/16IWbQ93GXOqAC 44WCnQX0uCH/r+46EPX+l7At4dmMxUI= X-Received: by 2002:a17:907:7249:: with SMTP id ds9mr5960645ejc.9.1616177726047; Fri, 19 Mar 2021 11:15:26 -0700 (PDT) Received: from Ansuel-xps.localdomain (host-79-34-220-97.business.telecomitalia.it. [79.34.220.97]) by smtp.googlemail.com with ESMTPSA id u13sm4170288ejn.59.2021.03.19.11.15.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Mar 2021 11:15:25 -0700 (PDT) From: Ansuel Smith To: Thara Gopinath Cc: Ansuel Smith , Amit Kucheria , Andy Gross , Bjorn Andersson , Zhang Rui , Daniel Lezcano , Rob Herring , linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v12 2/9] drivers: thermal: tsens: Don't hardcode sensor slope Date: Fri, 19 Mar 2021 19:15:05 +0100 Message-Id: <20210319181512.7757-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210319181512.7757-1-ansuelsmth@gmail.com> References: <20210319181512.7757-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Function compute_intercept_slope hardcode the sensor slope to SLOPE_DEFAULT. Change this and use the default value only if a slope is not defined. This is needed for tsens VER_0 that has a hardcoded slope table. Signed-off-by: Ansuel Smith Reviewed-by: Thara Gopinath --- drivers/thermal/qcom/tsens.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c index 6b582a81358f..6da567de1db7 100644 --- a/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c @@ -86,7 +86,8 @@ void compute_intercept_slope(struct tsens_priv *priv, u32 *p1, "%s: sensor%d - data_point1:%#x data_point2:%#x\n", __func__, i, p1[i], p2[i]); - priv->sensor[i].slope = SLOPE_DEFAULT; + if (!priv->sensor[i].slope) + priv->sensor[i].slope = SLOPE_DEFAULT; if (mode == TWO_PT_CALIB) { /* * slope (m) = adc_code2 - adc_code1 (y2 - y1)/ -- 2.30.2