From patchwork Wed Jun 7 10:47:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 104395 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp165296vqr; Wed, 7 Jun 2023 03:56:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6l/Xjxl+bNkW24nS+gh9gyLwro9JnsOtWzIsfCmSJGy8TEP1+zj1/I7iVYFDDfhLFTr3OU X-Received: by 2002:a17:90a:1a11:b0:259:30e7:733e with SMTP id 17-20020a17090a1a1100b0025930e7733emr4466297pjk.2.1686135394533; Wed, 07 Jun 2023 03:56:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686135394; cv=none; d=google.com; s=arc-20160816; b=H+7DtC49AmOAI5+EYVkP9N0x7gV+gL7IpFfeC2VQSPQmt8HJeMPA74K0acvR/KN1M/ slgDt7UY0MfcsBYx1/S/TCsauRO/y3dT+ioeTvBV6XexCnyAMUw+sAeQJhLZFoPM8fx9 thpURNm0O0fytSqw+CPDIXAZ3LYnTGt3BN07JHE+fwLT/VJWK26V9tpscjWiNaA8BZ0U h0kheBZrB2mGiKMm2ZjrzSWJGS0FviKLZ3xFIRsLiNE596YDd4lReoSc0RNbgmu3netl fQ5PEk9sbUjnIH4OMBSZh33jDmtBaxQ1jVIPPlLgtap+LjfwSIKXJKvJlGKQADK/YGG+ rgCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=xA/WZLvijjFlvE45qCUeYVjUps02xc70J/Efe21HAXk=; b=hv64K+tXSY+t7rtLP6JmoGk5wd2/OG/KgZdVJioinx4+iGMPUytqZPRc0DwRdX5+cq op05OAeWyqxuQr70pdTMiSZpFFLO7Er0CXoFLXMiT1bFKoS/d0u62bhhs5fToA9yeYZM NWpoZAXmIHqAN5AD++IXtQQdzdc37SKDvxfxlPGqbrHkBtvqb1OnqohisxFrUNzLHRiZ AvUuof6MlmvE9u5yZFEsMD0+8j6jHEAmdDyO5OtyvZMCIeU+Il/frsyzJX8BzCensUbU ajI4+HpunEVGD8tpuTPnwXQsKjm+c245kXbgrdA40U3ESdK63dp0KQXWE02l9+KYHeAd wTQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernkonzept.com header.s=mx1 header.b=HTcCDKcG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernkonzept.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o24-20020a637e58000000b0053476becd25si8724802pgn.285.2023.06.07.03.56.19; Wed, 07 Jun 2023 03:56:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernkonzept.com header.s=mx1 header.b=HTcCDKcG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernkonzept.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238313AbjFGKsP (ORCPT + 99 others); Wed, 7 Jun 2023 06:48:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235733AbjFGKsI (ORCPT ); Wed, 7 Jun 2023 06:48:08 -0400 Received: from mx.kernkonzept.com (serv1.kernkonzept.com [IPv6:2a01:4f8:1c1c:b490::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 544FFAA; Wed, 7 Jun 2023 03:48:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kernkonzept.com; s=mx1; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From: Reply-To:Content-ID:Content-Description; bh=xA/WZLvijjFlvE45qCUeYVjUps02xc70J/Efe21HAXk=; b=HTcCDKcGZGiK1VyddVWVgfFT5A 0zj4yoN1aO27dms6nz1tUKCOTRS/okXhjRRFD5aqXWzvG+qkUXX023hvWbUKYTCbXENRhYA6XyehT CDjeaAu9tUDS7OPZbOV63PAOew1umvfY742tsZFOkyIMe/1Y6tkvTxjGYCCFKVDqJ/VZGhn2iPhnG 2eVmLmlI/0bFxNLvzK5HAdbd8JS8Y7gtIsa4MnhMJdwGfDmnwWrD9Kc5kaRObi/V3VMoALarrpQ+8 mEyKnTmivvqZaDIKuqRhMXODO9WEwLSjPiKwixn+Sn5na224yELupdX6+r+pJX8mA+A/opcJ7yaHm Au4GaddA==; Received: from [10.22.3.24] (helo=serv1.dd1.int.kernkonzept.com) by mx.kernkonzept.com with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94.2) id 1q6qhp-0069NL-AJ; Wed, 07 Jun 2023 12:47:57 +0200 From: Stephan Gerhold Date: Wed, 07 Jun 2023 12:47:44 +0200 Subject: [PATCH v5 1/6] thermal: qcom: tsens: Drop unused legacy structs MIME-Version: 1.0 Message-Id: <20230508-msm8909-tsens-v5-1-5eb632235ba7@kernkonzept.com> References: <20230508-msm8909-tsens-v5-0-5eb632235ba7@kernkonzept.com> In-Reply-To: <20230508-msm8909-tsens-v5-0-5eb632235ba7@kernkonzept.com> To: Daniel Lezcano Cc: Amit Kucheria , Thara Gopinath , Andy Gross , Bjorn Andersson , Konrad Dybcio , "Rafael J. Wysocki" , Zhang Rui , Dmitry Baryshkov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Stephan Gerhold , Stephan Gerhold X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768041107550362515?= X-GMAIL-MSGID: =?utf-8?q?1768041107550362515?= The old single-cell parsing code was removed for MSM8939, MDM9607 and MSM8976 but for some reason the structs defining the bit positions etc were kept around (unused). Drop them now. Cc: Dmitry Baryshkov Fixes: 51d78b8b1beb ("thermal/drivers/tsens: Drop single-cell code for mdm9607") Fixes: dfadb4599ab0 ("thermal/drivers/tsens: Drop single-cell code for msm8939") Fixes: 3a908971f7cb ("thermal/drivers/tsens: Drop single-cell code for msm8976/msm8956") Reviewed-by: Konrad Dybcio Signed-off-by: Stephan Gerhold Reviewed-by: Dmitry Baryshkov --- drivers/thermal/qcom/tsens-v0_1.c | 36 ------------------------------------ drivers/thermal/qcom/tsens-v1.c | 22 ---------------------- 2 files changed, 58 deletions(-) diff --git a/drivers/thermal/qcom/tsens-v0_1.c b/drivers/thermal/qcom/tsens-v0_1.c index ad57ab94546b..a65f58264122 100644 --- a/drivers/thermal/qcom/tsens-v0_1.c +++ b/drivers/thermal/qcom/tsens-v0_1.c @@ -39,26 +39,6 @@ struct tsens_legacy_calibration_format tsens_8916_nvmem = { }, }; -struct tsens_legacy_calibration_format tsens_8939_nvmem = { - .base_len = 8, - .base_shift = 2, - .sp_len = 6, - .mode = { 12, 0 }, - .invalid = { 12, 2 }, - .base = { { 0, 0 }, { 1, 24 } }, - .sp = { - { { 12, 3 }, { 12, 9 } }, - { { 12, 15 }, { 12, 21 } }, - { { 12, 27 }, { 13, 1 } }, - { { 13, 7 }, { 13, 13 } }, - { { 13, 19 }, { 13, 25 } }, - { { 0, 8 }, { 0, 14 } }, - { { 0, 20 }, { 0, 26 } }, - { { 1, 0 }, { 1, 6 } }, - { { 1, 12 }, { 1, 18 } }, - }, -}; - struct tsens_legacy_calibration_format tsens_8974_nvmem = { .base_len = 8, .base_shift = 2, @@ -103,22 +83,6 @@ struct tsens_legacy_calibration_format tsens_8974_backup_nvmem = { }, }; -struct tsens_legacy_calibration_format tsens_9607_nvmem = { - .base_len = 8, - .base_shift = 2, - .sp_len = 6, - .mode = { 2, 20 }, - .invalid = { 2, 22 }, - .base = { { 0, 0 }, { 2, 12 } }, - .sp = { - { { 0, 8 }, { 0, 14 } }, - { { 0, 20 }, { 0, 26 } }, - { { 1, 0 }, { 1, 6 } }, - { { 1, 12 }, { 1, 18 } }, - { { 2, 0 }, { 2, 6 } }, - }, -}; - static int calibrate_8916(struct tsens_priv *priv) { u32 p1[5], p2[5]; diff --git a/drivers/thermal/qcom/tsens-v1.c b/drivers/thermal/qcom/tsens-v1.c index b822a426066d..51322430f1fe 100644 --- a/drivers/thermal/qcom/tsens-v1.c +++ b/drivers/thermal/qcom/tsens-v1.c @@ -42,28 +42,6 @@ struct tsens_legacy_calibration_format tsens_qcs404_nvmem = { }, }; -struct tsens_legacy_calibration_format tsens_8976_nvmem = { - .base_len = 8, - .base_shift = 2, - .sp_len = 6, - .mode = { 4, 0 }, - .invalid = { 4, 2 }, - .base = { { 0, 0 }, { 2, 8 } }, - .sp = { - { { 0, 8 }, { 0, 14 } }, - { { 0, 20 }, { 0, 26 } }, - { { 1, 0 }, { 1, 6 } }, - { { 1, 12 }, { 1, 18 } }, - { { 2, 8 }, { 2, 14 } }, - { { 2, 20 }, { 2, 26 } }, - { { 3, 0 }, { 3, 6 } }, - { { 3, 12 }, { 3, 18 } }, - { { 4, 2 }, { 4, 9 } }, - { { 4, 14 }, { 4, 21 } }, - { { 4, 26 }, { 5, 1 } }, - }, -}; - static int calibrate_v1(struct tsens_priv *priv) { u32 p1[10], p2[10]; From patchwork Wed Jun 7 10:47:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 104401 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp166087vqr; Wed, 7 Jun 2023 03:58:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5rSNJ0gTMNCm8yf0pFqphJodnRb8iRW9t7YIG1k0yfJhkXGYWTs7NTFJkp7OmXOydCAR9a X-Received: by 2002:a05:6a20:42a9:b0:d5:73ad:87c2 with SMTP id o41-20020a056a2042a900b000d573ad87c2mr3001724pzj.56.1686135501034; Wed, 07 Jun 2023 03:58:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686135501; cv=none; d=google.com; s=arc-20160816; b=Xb+H8pM2PZ62M6ObjvRCXvQM4J2Y8Wly4jvemAqmyTFRT2rECuz7cImstbzo24YigY pgqirxt2S+jkzlDdUUqhHLxKVYwtXY1WJH+u0en4Dpa/5+uyLsxjwBexToUS6JvMlihv xCWvPmi9rbboQp1tv+sWZSCY3MY1yP1C4tEPQPkClhzCGswQfloaA6fLKbutSNrYtXo4 twXi81NzciC1QI8DVSKeX6gzr5aa0FailsgZKfD/0ROosgvD5SjAW6s+8SkqYR2Q8FmD mJ6WTFUWgai8Gprqt3B+ZJkMJxVeAyhj+q03P8Eq7vs8A2vboq5TygoTOy9riFFwtgIp 6Qjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=btVYLyMcK4pZs3PKfPyBx/fGMaLkgp9nbjbhyNmutRQ=; b=f0cr17dly2qKzk5kgAFCtXxQg/HyCC4zstGtzmCepimBnD6m5a+ofUqsJimfYVTZTT 3IqmYK/RIVpwfuwbC6n4Q9zWDXqC7gBv5tkxB+3MnIqUqWu2l6HGQ/EGp6nOm9EWFRnu 1fiXD+07UsBkxbDNBlLqls7W4wAiI++lTmRy0+iK1kfYE+YIRshXsD/258GfoRRCDqHk gJ4XT9mGKMhCkOXYZwvTS93fDDryz5/EBqC5r3zX5CM4Pgo+TnGyMwdqka1QTMu1/Km1 wc+e6ITaqmbmV0GpG2ce1AMpx8pdMm8pAgw8pBZ5C40fdsRg/macLMHFwGTNsUTsoy5s 8CzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernkonzept.com header.s=mx1 header.b=AFhP4+K9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernkonzept.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 76-20020a63004f000000b0053ef51d3fa8si8616678pga.401.2023.06.07.03.58.08; Wed, 07 Jun 2023 03:58:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernkonzept.com header.s=mx1 header.b=AFhP4+K9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernkonzept.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239099AbjFGKsT (ORCPT + 99 others); Wed, 7 Jun 2023 06:48:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235756AbjFGKsI (ORCPT ); Wed, 7 Jun 2023 06:48:08 -0400 Received: from mx.kernkonzept.com (serv1.kernkonzept.com [IPv6:2a01:4f8:1c1c:b490::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB9F3192; Wed, 7 Jun 2023 03:48:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kernkonzept.com; s=mx1; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From: Reply-To:Content-ID:Content-Description; bh=btVYLyMcK4pZs3PKfPyBx/fGMaLkgp9nbjbhyNmutRQ=; b=AFhP4+K9vYAPaZNvNgJUPiGbDK gevIJqqnSvEb7VCSy1CPpKlqmJbrVrd4ZhGvhTV6rkZMcq3eLmuNLfmk9MSWASHRXOFUp6g8HATww Y4DNmyu+msWjr5Kx5mnJQ46mCupCnJ0OUt2mhf5a7AHBEu4IFqUcI2YIsJ8FXdGkSt385PwLHACN4 7LseljBBWHeOweEdtuALjeUh56qckmhzn6rxMTq/5LZy9wL2qN3/k6nsnRRE+8KpV8cUgUCRWD0xD dFjZrzWLhYyvFX8Mg7DnX9O1PFPCYsKSxRScHOgAL7E1gGQJDE4UgIrlwgV35fWQxGO8gy3SqeGHT q8NDjD+g==; Received: from [10.22.3.24] (helo=serv1.dd1.int.kernkonzept.com) by mx.kernkonzept.com with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94.2) id 1q6qhs-0069NL-1n; Wed, 07 Jun 2023 12:48:00 +0200 From: Stephan Gerhold Date: Wed, 07 Jun 2023 12:47:45 +0200 Subject: [PATCH v5 2/6] thermal: qcom: tsens-v0_1: Fix mdm9607 slope values MIME-Version: 1.0 Message-Id: <20230508-msm8909-tsens-v5-2-5eb632235ba7@kernkonzept.com> References: <20230508-msm8909-tsens-v5-0-5eb632235ba7@kernkonzept.com> In-Reply-To: <20230508-msm8909-tsens-v5-0-5eb632235ba7@kernkonzept.com> To: Daniel Lezcano Cc: Amit Kucheria , Thara Gopinath , Andy Gross , Bjorn Andersson , Konrad Dybcio , "Rafael J. Wysocki" , Zhang Rui , Dmitry Baryshkov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Stephan Gerhold , Stephan Gerhold X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768041219292626642?= X-GMAIL-MSGID: =?utf-8?q?1768041219292626642?= According to the msm-3.18 vendor kernel from Qualcomm [1], mdm9607 uses a non-standard slope value of 3000 (instead of 3200) for all sensors. Fill it properly similar to the 8939 code added recently. [1]: https://git.codelinaro.org/clo/la/kernel/msm-3.18/-/blob/LE.UM.4.3.2.r1-04200-9x07/arch/arm/boot/dts/qcom/mdm9607.dtsi#L875 Fixes: a2149ab815fc ("thermal/drivers/qcom/tsens-v0_1: Add support for MDM9607") Reviewed-by: Konrad Dybcio Reviewed-by: Dmitry Baryshkov Signed-off-by: Stephan Gerhold --- drivers/thermal/qcom/tsens-v0_1.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/thermal/qcom/tsens-v0_1.c b/drivers/thermal/qcom/tsens-v0_1.c index a65f58264122..9802ae1d4fcf 100644 --- a/drivers/thermal/qcom/tsens-v0_1.c +++ b/drivers/thermal/qcom/tsens-v0_1.c @@ -234,6 +234,16 @@ static int __init init_8939(struct tsens_priv *priv) { return init_common(priv); } +static int __init init_9607(struct tsens_priv *priv) +{ + int i; + + for (i = 0; i < priv->num_sensors; ++i) + priv->sensor[i].slope = 3000; + + return init_common(priv); +} + /* v0.1: 8226, 8916, 8939, 8974, 9607 */ static struct tsens_features tsens_v0_1_feat = { @@ -345,9 +355,15 @@ struct tsens_plat_data data_8974 = { .fields = tsens_v0_1_regfields, }; +static const struct tsens_ops ops_9607 = { + .init = init_9607, + .calibrate = tsens_calibrate_common, + .get_temp = get_temp_common, +}; + struct tsens_plat_data data_9607 = { .num_sensors = 5, - .ops = &ops_v0_1, + .ops = &ops_9607, .feat = &tsens_v0_1_feat, .fields = tsens_v0_1_regfields, }; From patchwork Wed Jun 7 10:47:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 104408 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp166536vqr; Wed, 7 Jun 2023 03:59:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7KHKTPrGabswi0LqaEmu/pMYwSTO0CGGbLlD0haZdMFVLi+ubFW+j0xlH+9BH08Mv34jET X-Received: by 2002:a05:6870:c356:b0:1a2:aaf7:434d with SMTP id e22-20020a056870c35600b001a2aaf7434dmr4580494oak.17.1686135560898; Wed, 07 Jun 2023 03:59:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686135560; cv=none; d=google.com; s=arc-20160816; b=pMfNGNmJEY7H0a085NOB++tzM0Q8ezeKcmFkuQyKFLl8OPXSFFiQfrDw/rRCPjS2lm rp+gyRmi/t3FC59fE86bjk/F7GTJ4DdoKX6X8QjQDzfK6gYp/WHIUi8G9AG9yNMvCsN9 ZvDvoSh1rMPyZzGoE6ysVHKOijws7hhFEwalcmrWFNgXEjiScloyEqIdcQnoiCJLF+LT kaLQx4Vu4BGBH0NBvSI9fGOaKLBHxg0WT8biy+DENimZKvnZysaglepsyOaA+Q7LOvO+ tJj2yZqDkTN5fzHGcxXw4DvJepT2pD+Dzvz2qbYjK8PzOHmUFexQJYhn/HtAWt+98DBl MPTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=kO6sjhQBSRSoH1BkSxRydzvO3qYJnTGlIeFcyYdMhD0=; b=eZs8/7MPKJB3zy9G7KdoUnykwxlh/uKYJvgdn/ETJLUSKbQWvrhWPrhNMu2hceola7 155eSCWMU6cEk12VUOyUJdXI9u5TgiEie22nVh9lrCa/fPdc14y3NO1dazyNbfL1fVSj RPzV6RLMhOJtD3G9OHk/+nRl3WEKll90zugMlUpbdjDaPCXGo1syFEO3HpyPUyUa4Eul 71Eww1gfJOPLdNV+WPVoHIImLi25yoe/jwTfIQy4aHQsPFI2yXT/ypOaE2avvx3zThvg nahQtVvnwNRJlIcgrHSt88wWbGpmE0k/2ZIQuJ9C7DacWVn4WGVkIefSc5mreZX0Bb3b L08g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernkonzept.com header.s=mx1 header.b=hd7mtU+u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernkonzept.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u3-20020a637903000000b0053f23ffad17si8685591pgc.420.2023.06.07.03.59.08; Wed, 07 Jun 2023 03:59:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernkonzept.com header.s=mx1 header.b=hd7mtU+u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernkonzept.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239533AbjFGKs2 (ORCPT + 99 others); Wed, 7 Jun 2023 06:48:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237833AbjFGKsP (ORCPT ); Wed, 7 Jun 2023 06:48:15 -0400 Received: from mx.kernkonzept.com (serv1.kernkonzept.com [IPv6:2a01:4f8:1c1c:b490::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C6FFAA; Wed, 7 Jun 2023 03:48:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kernkonzept.com; s=mx1; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From: Reply-To:Content-ID:Content-Description; bh=kO6sjhQBSRSoH1BkSxRydzvO3qYJnTGlIeFcyYdMhD0=; b=hd7mtU+u2uDSLCRGtpYOlVAqge h9gesXqkwvb/toekdgyfbwXbQQ54Z05Oxcz1a9PZH+4DXwLcY8j0YO6gwcqkFE0UYtSDOyAJRFSAJ qOM36zM8KyDx7oLURgDOoQO/DP2Urnp0tLqZ5kfEwNPoFYJG0OjCmjKIK/vTExomsAEoz2fFoffiX rt42gNnb6ylsFaI0kguCRJr2PZvwv/VD33kRIdjljQQRgcUIK4m1zgHvuCA8hJpItXeUJQ4/cZn1a IAPQTbxCNijBb7XbJ15Qur3kwfpVftBZbYINmXHqd6H3A5vp/u+RLzqFIlNAiwGzYW+1Bh4VWFGqX 2s2vzHbQ==; Received: from [10.22.3.24] (helo=serv1.dd1.int.kernkonzept.com) by mx.kernkonzept.com with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94.2) id 1q6qhu-0069NL-Or; Wed, 07 Jun 2023 12:48:02 +0200 From: Stephan Gerhold Date: Wed, 07 Jun 2023 12:47:46 +0200 Subject: [PATCH v5 3/6] thermal: qcom: tsens-v0_1: Add mdm9607 correction offsets MIME-Version: 1.0 Message-Id: <20230508-msm8909-tsens-v5-3-5eb632235ba7@kernkonzept.com> References: <20230508-msm8909-tsens-v5-0-5eb632235ba7@kernkonzept.com> In-Reply-To: <20230508-msm8909-tsens-v5-0-5eb632235ba7@kernkonzept.com> To: Daniel Lezcano Cc: Amit Kucheria , Thara Gopinath , Andy Gross , Bjorn Andersson , Konrad Dybcio , "Rafael J. Wysocki" , Zhang Rui , Dmitry Baryshkov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Stephan Gerhold , Stephan Gerhold X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768041281884275999?= X-GMAIL-MSGID: =?utf-8?q?1768041281884275999?= According to the msm-3.18 vendor kernel from Qualcomm, mdm9607 needs "correction factors" to adjust for additional offsets observed after the factory calibration values in the fuses [1, 2]. The fixed offsets should be applied unless there is a special calibration mode value that indicates that no offsets are needed [3]. Note that the new calibration mode values are called differently in this patch compared to the vendor kernel: - TSENS_TWO_POINT_CALIB_N_WA -> ONE_PT_CALIB2_NO_OFFSET - TSENS_TWO_POINT_CALIB_N_OFFSET_WA -> TWO_PT_CALIB_NO_OFFSET This is because close inspection of the calibration function [3] reveals that TSENS_TWO_POINT_CALIB_N_WA is actually a "one point" calibration because the if statements skip all "point2" related code for it. [1]: https://git.codelinaro.org/clo/la/kernel/msm-3.18/-/commit/d9d2db1b82bf3f72f5de0803d55e6849eb5b671e [2]: https://git.codelinaro.org/clo/la/kernel/msm-3.18/-/commit/d75aef53a760e8ff7bac54049d00c8b2ee1b193e [3]: https://git.codelinaro.org/clo/la/kernel/msm-3.18/-/blob/LE.UM.4.3.2.r1-04200-9x07/drivers/thermal/msm-tsens.c#L2987-3136 Fixes: a2149ab815fc ("thermal/drivers/qcom/tsens-v0_1: Add support for MDM9607") Reviewed-by: Konrad Dybcio Reviewed-by: Dmitry Baryshkov Signed-off-by: Stephan Gerhold --- drivers/thermal/qcom/tsens-v0_1.c | 11 +++++++++++ drivers/thermal/qcom/tsens.c | 16 +++++++++++++++- drivers/thermal/qcom/tsens.h | 4 ++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/drivers/thermal/qcom/tsens-v0_1.c b/drivers/thermal/qcom/tsens-v0_1.c index 9802ae1d4fcf..4a55a8ea0043 100644 --- a/drivers/thermal/qcom/tsens-v0_1.c +++ b/drivers/thermal/qcom/tsens-v0_1.c @@ -241,6 +241,17 @@ static int __init init_9607(struct tsens_priv *priv) for (i = 0; i < priv->num_sensors; ++i) priv->sensor[i].slope = 3000; + priv->sensor[0].p1_calib_offset = 1; + priv->sensor[0].p2_calib_offset = 1; + priv->sensor[1].p1_calib_offset = -4; + priv->sensor[1].p2_calib_offset = -2; + priv->sensor[2].p1_calib_offset = 4; + priv->sensor[2].p2_calib_offset = 8; + priv->sensor[3].p1_calib_offset = -3; + priv->sensor[3].p2_calib_offset = -5; + priv->sensor[4].p1_calib_offset = -4; + priv->sensor[4].p2_calib_offset = -4; + return init_common(priv); } diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c index 1c457b55efb3..9dd5e4b70911 100644 --- a/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c @@ -134,10 +134,12 @@ int tsens_read_calibration(struct tsens_priv *priv, int shift, u32 *p1, u32 *p2, p1[i] = p1[i] + (base1 << shift); break; case TWO_PT_CALIB: + case TWO_PT_CALIB_NO_OFFSET: for (i = 0; i < priv->num_sensors; i++) p2[i] = (p2[i] + base2) << shift; fallthrough; case ONE_PT_CALIB2: + case ONE_PT_CALIB2_NO_OFFSET: for (i = 0; i < priv->num_sensors; i++) p1[i] = (p1[i] + base1) << shift; break; @@ -149,6 +151,18 @@ int tsens_read_calibration(struct tsens_priv *priv, int shift, u32 *p1, u32 *p2, } } + /* Apply calibration offset workaround except for _NO_OFFSET modes */ + switch (mode) { + case TWO_PT_CALIB: + for (i = 0; i < priv->num_sensors; i++) + p2[i] += priv->sensor[i].p2_calib_offset; + fallthrough; + case ONE_PT_CALIB2: + for (i = 0; i < priv->num_sensors; i++) + p1[i] += priv->sensor[i].p1_calib_offset; + break; + } + return mode; } @@ -254,7 +268,7 @@ void compute_intercept_slope(struct tsens_priv *priv, u32 *p1, if (!priv->sensor[i].slope) priv->sensor[i].slope = SLOPE_DEFAULT; - if (mode == TWO_PT_CALIB) { + if (mode == TWO_PT_CALIB || mode == TWO_PT_CALIB_NO_OFFSET) { /* * slope (m) = adc_code2 - adc_code1 (y2 - y1)/ * temp_120_degc - temp_30_degc (x2 - x1) diff --git a/drivers/thermal/qcom/tsens.h b/drivers/thermal/qcom/tsens.h index 433eba370998..1cd8f4fe0971 100644 --- a/drivers/thermal/qcom/tsens.h +++ b/drivers/thermal/qcom/tsens.h @@ -10,6 +10,8 @@ #define ONE_PT_CALIB 0x1 #define ONE_PT_CALIB2 0x2 #define TWO_PT_CALIB 0x3 +#define ONE_PT_CALIB2_NO_OFFSET 0x6 +#define TWO_PT_CALIB_NO_OFFSET 0x7 #define CAL_DEGC_PT1 30 #define CAL_DEGC_PT2 120 #define SLOPE_FACTOR 1000 @@ -57,6 +59,8 @@ struct tsens_sensor { unsigned int hw_id; int slope; u32 status; + int p1_calib_offset; + int p2_calib_offset; }; /** From patchwork Wed Jun 7 10:47:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 104396 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp165326vqr; Wed, 7 Jun 2023 03:56:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4OzU91JgTWJBarn3U7r4p4BK7PBE5gsJikStC4KTApTUC9bNm5DczqZms86PLdCHwb5t4S X-Received: by 2002:a05:6a20:7b0a:b0:114:6f80:397e with SMTP id s10-20020a056a207b0a00b001146f80397emr833109pzh.14.1686135396525; Wed, 07 Jun 2023 03:56:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686135396; cv=none; d=google.com; s=arc-20160816; b=B/nRVD9hVJUGHWpWc73XFHFg2HRt5lJZt5bEsBP42JR5okuGf0XHlKtnI1StxicxnO qIqMKiFDV4igVHmf4Z49fWoQLVxVIQGfa88JjKaihOXtJovcLuE+kBXFVrFwlSfdr/Jn W9VOi1AsmfjvMpmcwImptZeEMChg/25XApTllWcGPxjoHWvZv8WGysXagwL3NUtnvvjV D3k23wEFCdMhB09baTmD8uv5J9I411YbYKaKJqhXdXfkCJdgw9jPM5w2BC3Bb4mR16us BZFY0/wyQk6vfRFkQSjuhH1htW3tMZsVdL1RqbZfdjJqPSRdFzCSB3TULwyJwClMXq4K OZLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=U3bMcXZqzkAneJMjKzEWcszuciWDCOJw7wff8jyvZQo=; b=k64lTztpodn5xEtQSMnQQVd1BklmpUPO1C0fo9HU23Z3p6ccO9UzuvNqIyhjIOz4fF ihZEy725Zw7jykr04HJJxC5lxJ8cKgsSXx5JTdrYjmvCGaZ1ryYZiquX044SIw9Yc2vh EekGXgYlPLZQV12q1T7D/BtQKPP9XKT5/S5RmB1Dh2g7cGWGl8i2Oq0TzJtxJKDW4U5B 8E2BmOTpyDYFQtjmScGuLhDIs1h2NnnnGJY2tUCgxaFQUgiPuHsXS+9BjprYzWq/tX/9 E6l0vNaKZ5FNdlqxHrIUeACYsBFqVClcmRUPerc77CkLmHpsx5fRTkLonCq2qcDclpuI yvcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernkonzept.com header.s=mx1 header.b=L9T0m5ga; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernkonzept.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x5-20020a170902b40500b001b176ba9f1asi8447552plr.551.2023.06.07.03.56.23; Wed, 07 Jun 2023 03:56:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernkonzept.com header.s=mx1 header.b=L9T0m5ga; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernkonzept.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239273AbjFGKsb (ORCPT + 99 others); Wed, 7 Jun 2023 06:48:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238654AbjFGKsW (ORCPT ); Wed, 7 Jun 2023 06:48:22 -0400 Received: from mx.kernkonzept.com (serv1.kernkonzept.com [IPv6:2a01:4f8:1c1c:b490::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2A0410EC; Wed, 7 Jun 2023 03:48:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kernkonzept.com; s=mx1; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From: Reply-To:Content-ID:Content-Description; bh=U3bMcXZqzkAneJMjKzEWcszuciWDCOJw7wff8jyvZQo=; b=L9T0m5gaPPE+pFX0eTirrcLw6h FLmlK5IO6MsJynlxUPsaqwUKI4efwRg0muODVl8ngc/S06HUyKGQPyU85/WqDwIdpvko0ceenCfI+ jP5mI3Or+QPco0VuTlcTIWdghNmleCQzFGGGorn3edOKjlbVtCUaGZBpvfnzbYIeU/ksrqpHLxTc0 I6dPNgI9LGOmqyj7+hn1i9Dz0Pb461kEgrvPoABx5Yu7xEwJxMXPOww49XqzbPXqnH2m/a4cGjUDI e2H+LrVVwQygep9ufsAIa1Yq/qmbpLt/v++XdVeIAu1GK8N7wvi1LknBo6+HMUEPwrDCzyFV8N07c 1l5ieY5g==; Received: from [10.22.3.24] (helo=serv1.dd1.int.kernkonzept.com) by mx.kernkonzept.com with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94.2) id 1q6qi2-0069NL-QH; Wed, 07 Jun 2023 12:48:10 +0200 From: Stephan Gerhold Date: Wed, 07 Jun 2023 12:47:47 +0200 Subject: [PATCH v5 4/6] dt-bindings: thermal: qcom-tsens: Drop redundant compatibles MIME-Version: 1.0 Message-Id: <20230508-msm8909-tsens-v5-4-5eb632235ba7@kernkonzept.com> References: <20230508-msm8909-tsens-v5-0-5eb632235ba7@kernkonzept.com> In-Reply-To: <20230508-msm8909-tsens-v5-0-5eb632235ba7@kernkonzept.com> To: Daniel Lezcano Cc: Amit Kucheria , Thara Gopinath , Andy Gross , Bjorn Andersson , Konrad Dybcio , "Rafael J. Wysocki" , Zhang Rui , Dmitry Baryshkov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Stephan Gerhold , Krzysztof Kozlowski , Stephan Gerhold X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768041109787623813?= X-GMAIL-MSGID: =?utf-8?q?1768041109787623813?= Since the SoC compatibles must be followed by the IP version compatible (e.g. compatible = "qcom,msm8916-tsens", "qcom,tsens-v0_1";) it is redundant to list all the SoC compatibles again in the if statement. It will already match the IP-version compatible. The list has already become inconsistent since for example "qcom,msm8939-tsens" is covered by the if statement but is not listed there explicitly like the other SoCs. Simplify this by dropping the redundant SoC compatibles. ipq8064 and msm8960 are still needed because they do not have an IP-version compatible. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Stephan Gerhold --- .../devicetree/bindings/thermal/qcom-tsens.yaml | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml b/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml index 92fa70e8ea86..8cc9488686d7 100644 --- a/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml +++ b/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml @@ -224,12 +224,7 @@ allOf: contains: enum: - qcom,ipq8064-tsens - - qcom,mdm9607-tsens - - qcom,msm8916-tsens - qcom,msm8960-tsens - - qcom,msm8974-tsens - - qcom,msm8976-tsens - - qcom,qcs404-tsens - qcom,tsens-v0_1 - qcom,tsens-v1 then: @@ -245,22 +240,7 @@ allOf: properties: compatible: contains: - enum: - - qcom,msm8953-tsens - - qcom,msm8996-tsens - - qcom,msm8998-tsens - - qcom,sc7180-tsens - - qcom,sc7280-tsens - - qcom,sc8180x-tsens - - qcom,sc8280xp-tsens - - qcom,sdm630-tsens - - qcom,sdm845-tsens - - qcom,sm6350-tsens - - qcom,sm8150-tsens - - qcom,sm8250-tsens - - qcom,sm8350-tsens - - qcom,sm8450-tsens - - qcom,tsens-v2 + const: qcom,tsens-v2 then: properties: interrupts: From patchwork Wed Jun 7 10:47:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 104394 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp162769vqr; Wed, 7 Jun 2023 03:50:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7TvzUdoOSKgAZNi/5JCiWajEtZZjIKTmk/FRLQjMIHDiolPoS7UUyrQWXxUI0RNS7aaXId X-Received: by 2002:a92:4a02:0:b0:33b:6cc0:ee6b with SMTP id m2-20020a924a02000000b0033b6cc0ee6bmr7471447ilf.13.1686135056060; Wed, 07 Jun 2023 03:50:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686135056; cv=none; d=google.com; s=arc-20160816; b=MapjldOdJoz7sVkqB37KmgEcNpIOTb0RnfOajzBPEZHbA2JiKQmCVtsrG9xkeRYfoT 6MDD6xCtJl23TddSEj/bLDvsL1eVvyZJV6cR0tBzdyadPX15LC8Z+0uamCWTnQgQupjf 7xA4doYnAWhWBB+vtSRJZs5B9YPYaNpqJKFEFofkCvD9AmylWS3oJCjSu5I2KYFvzIgt KN0Qp3xzLHAWYLGZU+5oQwMFw2mL8IiIf2SRJh91Q84caV1UYegC1f5rhikJxfuQ28ge RIEsDrL/jGArFiMhB+bYYvNn9D7nC7FK35JvALV+3kzmdug8s36EhZfnAPtxtvgWqOVE wI0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=m/m3GNG5btyZLcdgz7M/oh1QiNI+Caj/wVSUN2s9dRs=; b=l/8uMKg/mXkjgV3Ym/36F+0VLPvUuL9ZRcmw36KnBrhaiMXwcWSmwAkawnJI6bUqPi n4XV4AMOVdXOSS1bYgoskZl7d/QPrHp3i9ZWx7VaAr1kL50mEtn6umk/fvu0MbBe0H2p 0mEXoa5xxUMy364Xl6obVFiJI4ah4wYHyhGIL//f3VvOnIX50vJxBxTMAZL8lTrKJm7y pxRHWt17Af8P8iH9QxyutaSqQ7oYJy4DO/k1eN6EZBiMWeo1nI/Adc3ChCSmadK3rySc xnO7I7H+DbLE4UqOoCyfbqJo+4ssYrD8x3CasG6GfjwysKK7rRCyHx2SllfqNhL9n/qT 6x0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernkonzept.com header.s=mx1 header.b=OqGEw6wm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernkonzept.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o6-20020a637306000000b0053f0dd2407csi8461382pgc.299.2023.06.07.03.50.42; Wed, 07 Jun 2023 03:50:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernkonzept.com header.s=mx1 header.b=OqGEw6wm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernkonzept.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239829AbjFGKsp (ORCPT + 99 others); Wed, 7 Jun 2023 06:48:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239378AbjFGKs2 (ORCPT ); Wed, 7 Jun 2023 06:48:28 -0400 Received: from mx.kernkonzept.com (serv1.kernkonzept.com [IPv6:2a01:4f8:1c1c:b490::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53C691BEC; Wed, 7 Jun 2023 03:48:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kernkonzept.com; s=mx1; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From: Reply-To:Content-ID:Content-Description; bh=m/m3GNG5btyZLcdgz7M/oh1QiNI+Caj/wVSUN2s9dRs=; b=OqGEw6wmJukeS+Z1mPVvx5f4Uf 1xLmwq2No+M4uLGmFiepO42WJoqYcLzT3f4DV2Ji4ybkPN7dUn6uuuNf26J2QDjvG+JQDl30ivTK0 s7y71haYbFzVRou/aioAH9DCusO0HNet5w8QbkRbP4LbasoZtvIYSTk+bYobUjFHWLJRVuuZujXXT VQk4TylNTeOP3WRebJiPcu8o68lKiB5pe5xxexgV40eOPTr75zRIYc9jT5VZi7KrFjaY4hsnKisAJ s2X+r5K340LgMB5P7DrrS9Riyc7KLWmP7D6RPG5MHeuXugkZzCSvWikR+0NlECbyIS4HQAqy5dHv3 WZ5ek/Bw==; Received: from [10.22.3.24] (helo=serv1.dd1.int.kernkonzept.com) by mx.kernkonzept.com with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94.2) id 1q6qi5-0069NL-SA; Wed, 07 Jun 2023 12:48:13 +0200 From: Stephan Gerhold Date: Wed, 07 Jun 2023 12:47:48 +0200 Subject: [PATCH v5 5/6] dt-bindings: thermal: qcom-tsens: Add MSM8909 compatible MIME-Version: 1.0 Message-Id: <20230508-msm8909-tsens-v5-5-5eb632235ba7@kernkonzept.com> References: <20230508-msm8909-tsens-v5-0-5eb632235ba7@kernkonzept.com> In-Reply-To: <20230508-msm8909-tsens-v5-0-5eb632235ba7@kernkonzept.com> To: Daniel Lezcano Cc: Amit Kucheria , Thara Gopinath , Andy Gross , Bjorn Andersson , Konrad Dybcio , "Rafael J. Wysocki" , Zhang Rui , Dmitry Baryshkov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Stephan Gerhold , Krzysztof Kozlowski , Stephan Gerhold X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768040752455885635?= X-GMAIL-MSGID: =?utf-8?q?1768040752455885635?= MSM8909 uses the TSENS v0.1 block similar to other SoCs like MDM9607. Document the "qcom,msm8909-tsens" compatible in the existing schema. Acked-by: Krzysztof Kozlowski Signed-off-by: Stephan Gerhold --- Documentation/devicetree/bindings/thermal/qcom-tsens.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml b/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml index 8cc9488686d7..f95aae81ba69 100644 --- a/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml +++ b/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml @@ -30,6 +30,7 @@ properties: - enum: - qcom,mdm9607-tsens - qcom,msm8226-tsens + - qcom,msm8909-tsens - qcom,msm8916-tsens - qcom,msm8939-tsens - qcom,msm8974-tsens From patchwork Wed Jun 7 10:47:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 104402 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp166115vqr; Wed, 7 Jun 2023 03:58:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ604OfbbwA+ct9byzbwBys/1jVw0ozTcu6sJefvY/w8xZ/wkjuENGDpjKiJtbkmvuXwoRr5 X-Received: by 2002:a17:903:1252:b0:1b0:5304:5b4e with SMTP id u18-20020a170903125200b001b053045b4emr6594303plh.43.1686135506951; Wed, 07 Jun 2023 03:58:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686135506; cv=none; d=google.com; s=arc-20160816; b=GHIxcpiPVK4zoYxmDHx7ejHzzL6emCoc82qG0AIIS+kZv+yOwTHiS4KtdpbxcJJZIb K1+2p6P/wo9f9ZEka1DgEREU52oS4UlTDogeZ4ziCGKOvwyNCRt4EZV16hiPQ4yyG3kc MdM+BIHFwHfgGhXx9Lf9l4WmtUrCGpKru5tC38A1r8lSri+3sIqDvXqDG71Lnshg9+cI ++Fpf6TI0Zjm2jaxEUcBrztgircqVxiWjwcO8+1it0aQ4EQ8SCihVj4VaaxyPKulOPZS DgGtz+ZC+G7V3B15aksYakd7YW0XCXO9KIbgPUQIb/ZoMTvFgMFBSD1kFaopAwY5Jsr2 u++g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=Du2Hg8eWo8TN3RCAEt+biisl8e0xVlaEapus0jGGoCI=; b=A819ZGEVWfppG1ywxLK62DcstGjDh8BTfeftJuvmSFtj/XTEQGXKI2KhvTnv9UFJXY uK9sSM4SeyDKvUD6sT30ekZm5L/qNBAjjm1WkyUtUcwmfv3siTBBL3EpVKTaTEXt/G3E LggRYoNRRFIN0tlSbMC3dHVinhIhnS/nsifmstFIn54i3R7KsZHHuCW+b+WstG/LC1vT PfVNWMNJ9aOLMjD/+eDh7ITdIYR2965M0Zjl/FV4sI0TbR8iU0hjkQ9Dz7NWDOt75xjv oYPWHGeHs2P54s5hy27sHo1jh9qpOsaLDtYCbbfikh3BQ8YylUH+VE4md6KZDV71B2tL /wgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernkonzept.com header.s=mx1 header.b=Z5U7dsmX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernkonzept.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u16-20020a17090341d000b001b23d4573b4si2129111ple.4.2023.06.07.03.58.14; Wed, 07 Jun 2023 03:58:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernkonzept.com header.s=mx1 header.b=Z5U7dsmX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernkonzept.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239736AbjFGKsf (ORCPT + 99 others); Wed, 7 Jun 2023 06:48:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239309AbjFGKs2 (ORCPT ); Wed, 7 Jun 2023 06:48:28 -0400 Received: from mx.kernkonzept.com (serv1.kernkonzept.com [IPv6:2a01:4f8:1c1c:b490::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7B8F1BE6; Wed, 7 Jun 2023 03:48:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kernkonzept.com; s=mx1; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From: Reply-To:Content-ID:Content-Description; bh=Du2Hg8eWo8TN3RCAEt+biisl8e0xVlaEapus0jGGoCI=; b=Z5U7dsmXqCONrNBw4MlGEy2Aqv 8zLJ35adAkobtcgjvV90nPNi+9DiAN947XETRd7nqrwDTiP7IG769rA+Sb7nHC/s57PU4CtqZ26aM JTfjZ2WaSmvZDEPlWRDqbcblL0KkTlF/3J9tCMTkmUuBasIRWN3ce9ccU4oIJOrNwGHNQHJ+YNI3M gBbwSIgAgKaYSq2pPgpVa1BlbR6x3iPMta97ZUL5hJN8rVvvqwuU+1eItqNUD4/GwoufpYknWaK/V Hbz4YTrcEE2K0M9MV91451Ia9Z8Jw9Qn783vymLlMRFkTKb8KdR21955hf+dyKaM3A3XvEsLMBH/H RJlLRl6w==; Received: from [10.22.3.24] (helo=serv1.dd1.int.kernkonzept.com) by mx.kernkonzept.com with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94.2) id 1q6qi8-0069NL-IF; Wed, 07 Jun 2023 12:48:16 +0200 From: Stephan Gerhold Date: Wed, 07 Jun 2023 12:47:49 +0200 Subject: [PATCH v5 6/6] thermal: qcom: tsens-v0_1: Add MSM8909 data MIME-Version: 1.0 Message-Id: <20230508-msm8909-tsens-v5-6-5eb632235ba7@kernkonzept.com> References: <20230508-msm8909-tsens-v5-0-5eb632235ba7@kernkonzept.com> In-Reply-To: <20230508-msm8909-tsens-v5-0-5eb632235ba7@kernkonzept.com> To: Daniel Lezcano Cc: Amit Kucheria , Thara Gopinath , Andy Gross , Bjorn Andersson , Konrad Dybcio , "Rafael J. Wysocki" , Zhang Rui , Dmitry Baryshkov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Stephan Gerhold , Stephan Gerhold X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768041225264458209?= X-GMAIL-MSGID: =?utf-8?q?1768041225264458209?= The MSM8909 SoC has 5 thermal sensors in a TSENS v0.1 block. Like MDM9607 it uses a non-standard default slope value of 3000 [1] and needs per-sensor "correction factors" to workaround issues with the factory calibration [2]. [1]: https://git.codelinaro.org/clo/la/kernel/msm-3.18/-/blob/LA.UM.7.7.c26-09100-8x09.0/arch/arm/boot/dts/qcom/msm8909.dtsi#L476 [2]: https://git.codelinaro.org/clo/la/kernel/msm-3.18/-/commit/6df022c6d0c2c1b4a5a6c2124dba4d57910c0911 Reviewed-by: Konrad Dybcio Reviewed-by: Dmitry Baryshkov Signed-off-by: Stephan Gerhold --- drivers/thermal/qcom/tsens-v0_1.c | 36 +++++++++++++++++++++++++++++++++++- drivers/thermal/qcom/tsens.c | 3 +++ drivers/thermal/qcom/tsens.h | 2 +- 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/qcom/tsens-v0_1.c b/drivers/thermal/qcom/tsens-v0_1.c index 4a55a8ea0043..a941b4241b0a 100644 --- a/drivers/thermal/qcom/tsens-v0_1.c +++ b/drivers/thermal/qcom/tsens-v0_1.c @@ -219,6 +219,27 @@ static int __init init_8226(struct tsens_priv *priv) return init_common(priv); } +static int __init init_8909(struct tsens_priv *priv) +{ + int i; + + for (i = 0; i < priv->num_sensors; ++i) + priv->sensor[i].slope = 3000; + + priv->sensor[0].p1_calib_offset = 0; + priv->sensor[0].p2_calib_offset = 0; + priv->sensor[1].p1_calib_offset = -10; + priv->sensor[1].p2_calib_offset = -6; + priv->sensor[2].p1_calib_offset = 0; + priv->sensor[2].p2_calib_offset = 0; + priv->sensor[3].p1_calib_offset = -9; + priv->sensor[3].p2_calib_offset = -9; + priv->sensor[4].p1_calib_offset = -8; + priv->sensor[4].p2_calib_offset = -10; + + return init_common(priv); +} + static int __init init_8939(struct tsens_priv *priv) { priv->sensor[0].slope = 2911; priv->sensor[1].slope = 2789; @@ -255,7 +276,7 @@ static int __init init_9607(struct tsens_priv *priv) return init_common(priv); } -/* v0.1: 8226, 8916, 8939, 8974, 9607 */ +/* v0.1: 8226, 8909, 8916, 8939, 8974, 9607 */ static struct tsens_features tsens_v0_1_feat = { .ver_major = VER_0_1, @@ -323,6 +344,19 @@ struct tsens_plat_data data_8226 = { .fields = tsens_v0_1_regfields, }; +static const struct tsens_ops ops_8909 = { + .init = init_8909, + .calibrate = tsens_calibrate_common, + .get_temp = get_temp_common, +}; + +struct tsens_plat_data data_8909 = { + .num_sensors = 5, + .ops = &ops_8909, + .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 9dd5e4b70911..1ab165370fb0 100644 --- a/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c @@ -1112,6 +1112,9 @@ static const struct of_device_id tsens_table[] = { }, { .compatible = "qcom,msm8226-tsens", .data = &data_8226, + }, { + .compatible = "qcom,msm8909-tsens", + .data = &data_8909, }, { .compatible = "qcom,msm8916-tsens", .data = &data_8916, diff --git a/drivers/thermal/qcom/tsens.h b/drivers/thermal/qcom/tsens.h index 1cd8f4fe0971..2805de1c6827 100644 --- a/drivers/thermal/qcom/tsens.h +++ b/drivers/thermal/qcom/tsens.h @@ -639,7 +639,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_8226, data_8916, data_8939, data_8974, data_9607; +extern struct tsens_plat_data data_8226, data_8909, data_8916, data_8939, data_8974, data_9607; /* TSENS v1 targets */ extern struct tsens_plat_data data_tsens_v1, data_8976, data_8956;