From patchwork Sun May 7 20:12:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Matti_Lehtim=C3=A4ki?= X-Patchwork-Id: 13233916 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0B36C7EE30 for ; Sun, 7 May 2023 20:13:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231851AbjEGUNU (ORCPT ); Sun, 7 May 2023 16:13:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231791AbjEGUMx (ORCPT ); Sun, 7 May 2023 16:12:53 -0400 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3678E9EDE; Sun, 7 May 2023 13:12:52 -0700 (PDT) Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2ac88d9edf3so30592031fa.0; Sun, 07 May 2023 13:12:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683490370; x=1686082370; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pCrDWBMl4hp0qteih67nrdBeByN0/6V+auuAerq2y3I=; b=lXyF+mWYZ/lclt94np36RrvdvzVK+xZ/Y8pF/WReS3A+yVrnqIxIj0dRM2PhWWVbOP VDik2MrWVnSGdeIbKwH+Z5+jD3GQe4cODADYjICM3P9MqTINQaAcDuEw4Xfg9AJSlUXO VLvPe7MG2ZiL+yJ5IrpqCJbbvJnjh39nhAfQzst8hy7Zwh2zGFUDt6ewzEmu3dkn6Izk d/Oz6Jv6KFfpVkkdiNOSR+/euulOeC3W7GSW3FJcBDd6Z898tRjCgtqOG+h53Jeb9TBx ild4P+AF5IX5DluvMv9HFyzDHMLuFBSh1ifomVtb4Ea0Swp/ZsO/csagoLmfh21m2pN9 OkHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683490370; x=1686082370; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pCrDWBMl4hp0qteih67nrdBeByN0/6V+auuAerq2y3I=; b=Q9jUaGPYmuT5cnfYwZWZBsGB7I2iQdC51GJo+sVZCQ0LCwq8yEbM6Qr8ObXAoe1Vy7 mTNdkJvjBZeBYa/S8aYa8n4+LhdwcqlPPeKhDydilVot/karnOWvNAhBWG1zfszGBMxY e1etzkSSPWKuNS+PFG6Pm2ptXbMFtNt7fpmlEc/cJuFlNA11XBkFpRvBwjuaW1QQRiQh OdqUENnMrRNNSPbvEckpP3luOHhC+0vj66NL1gI/eutyuzothlw1YI0ipO69EN61UHNa 17vYLPhGc7KDEPmE69nYdls4mvk7uw937XDe4/qPm/2WEK259nAEVWaDFB53BHPVf9HY gIPw== X-Gm-Message-State: AC+VfDwwUtvjWDkFtGbjWJOHW1pBX9XLEZS5QsNqmt6OYRk350x28zlH ylnJWNVmSs2DG9ahFjiLvJn4l54G8+iQJQ== X-Google-Smtp-Source: ACHHUZ4a5ixUlJacIqpdc93Y2jU4S98+GrQO7eiSd1Yo5KmaW4TSqUkOzCIYB4DTKP/IIWKpxA8fCA== X-Received: by 2002:a2e:818c:0:b0:2ad:1b99:beb6 with SMTP id e12-20020a2e818c000000b002ad1b99beb6mr1296280ljg.34.1683490370147; Sun, 07 May 2023 13:12:50 -0700 (PDT) Received: from i-vetokaappi.home.lan (dsl-hkibng42-56733b-36.dhcp.inet.fi. [86.115.59.36]) by smtp.gmail.com with ESMTPSA id m19-20020a2e9113000000b00293d7c95df1sm918031ljg.78.2023.05.07.13.12.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 May 2023 13:12:49 -0700 (PDT) From: =?utf-8?q?Matti_Lehtim=C3=A4ki?= To: linux-arm-msm@vger.kernel.org Cc: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, =?utf-8?q?Matti_Lehtim=C3=A4ki?= , Andy Gross , Bjorn Andersson , Konrad Dybcio , Amit Kucheria , Thara Gopinath , "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/6] thermal/drivers/qcom/tsens-v0_1: Add support for MSM8226 Date: Sun, 7 May 2023 23:12:21 +0300 Message-Id: <20230507201225.89694-4-matti.lehtimaki@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230507201225.89694-1-matti.lehtimaki@gmail.com> References: <20230507201225.89694-1-matti.lehtimaki@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The MSM8226 TSENS IP has 6 thermal sensors in a TSENS v0.1 block. The thermal sensors use non-standard slope values. Signed-off-by: Matti Lehtimäki Reviewed-by: Luca Weiss Reviewed-by: Dmitry Baryshkov --- drivers/thermal/qcom/tsens-v0_1.c | 27 ++++++++++++++++++++++++++- drivers/thermal/qcom/tsens.c | 3 +++ drivers/thermal/qcom/tsens.h | 2 +- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/qcom/tsens-v0_1.c b/drivers/thermal/qcom/tsens-v0_1.c index e89c6f39a3ae..ad57ab94546b 100644 --- a/drivers/thermal/qcom/tsens-v0_1.c +++ b/drivers/thermal/qcom/tsens-v0_1.c @@ -243,6 +243,18 @@ static int calibrate_8974(struct tsens_priv *priv) return 0; } +static int __init init_8226(struct tsens_priv *priv) +{ + priv->sensor[0].slope = 2901; + priv->sensor[1].slope = 2846; + priv->sensor[2].slope = 3038; + priv->sensor[3].slope = 2955; + priv->sensor[4].slope = 2901; + priv->sensor[5].slope = 2846; + + return init_common(priv); +} + static int __init init_8939(struct tsens_priv *priv) { priv->sensor[0].slope = 2911; priv->sensor[1].slope = 2789; @@ -258,7 +270,7 @@ static int __init init_8939(struct tsens_priv *priv) { return init_common(priv); } -/* v0.1: 8916, 8939, 8974, 9607 */ +/* v0.1: 8226, 8916, 8939, 8974, 9607 */ static struct tsens_features tsens_v0_1_feat = { .ver_major = VER_0_1, @@ -313,6 +325,19 @@ static const struct tsens_ops ops_v0_1 = { .get_temp = get_temp_common, }; +static const struct tsens_ops ops_8226 = { + .init = init_8226, + .calibrate = tsens_calibrate_common, + .get_temp = get_temp_common, +}; + +struct tsens_plat_data data_8226 = { + .num_sensors = 6, + .ops = &ops_8226, + .feat = &tsens_v0_1_feat, + .fields = tsens_v0_1_regfields, +}; + static const struct tsens_ops ops_8916 = { .init = init_common, .calibrate = calibrate_8916, diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c index 8020ead2794e..eb33a8bf0488 100644 --- a/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c @@ -1095,6 +1095,9 @@ static const struct of_device_id tsens_table[] = { }, { .compatible = "qcom,mdm9607-tsens", .data = &data_9607, + }, { + .compatible = "qcom,msm8226-tsens", + .data = &data_8226, }, { .compatible = "qcom,msm8916-tsens", .data = &data_8916, diff --git a/drivers/thermal/qcom/tsens.h b/drivers/thermal/qcom/tsens.h index dba9cd38f637..433eba370998 100644 --- a/drivers/thermal/qcom/tsens.h +++ b/drivers/thermal/qcom/tsens.h @@ -635,7 +635,7 @@ int get_temp_common(const struct tsens_sensor *s, int *temp); extern struct tsens_plat_data data_8960; /* TSENS v0.1 targets */ -extern struct tsens_plat_data data_8916, data_8939, data_8974, data_9607; +extern struct tsens_plat_data data_8226, data_8916, data_8939, data_8974, data_9607; /* TSENS v1 targets */ extern struct tsens_plat_data data_tsens_v1, data_8976, data_8956;