From patchwork Mon May 8 13:13:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 91160 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2171300vqo; Mon, 8 May 2023 06:51:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Xk3gwmo8XVsms8wjUGgA2dWwKHGc/+g4uTy573jKtb780yXDDW9Ejsb/nVmB//Quqmsn/ X-Received: by 2002:a05:6a20:d48c:b0:f6:15f3:ca36 with SMTP id im12-20020a056a20d48c00b000f615f3ca36mr10271128pzb.50.1683553875655; Mon, 08 May 2023 06:51:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683553875; cv=none; d=google.com; s=arc-20160816; b=HGRiEPKC34YRR8xqjBTDG2XmC1hsMq7Ro3/8fz6jK8gv6CYSfdxAM7xQE9q/TOY/QG 74RFy5FL/LBGNNt8VMRvc1hhLhYvfEvQXFxU5Ov40vi38yRc/rjM4w6vv0b0bTarkULE rtqzM+9begZy81qrDVfqDzJJv6MQ7jTB/8q0HoLJKvxvSgtZS9VMJu2nu+eZLjo4Ac4o L3qhqj/P6gVTHNhzN56KaOj0N/JTsd9QGumdfHdHXOeHLO2ntLZy/Rv3rGrVfhO58XjC l7jTMgLmP08TPk1drr9CC//GkrNCF1zigGXsu9cCZg/w9L6nX3Ew0OLoUw2QdIz+Em+D gujg== 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=fPadFlLPBY1XV2QeXcRoIHtkBD3+5FKuX66decVcclc=; b=DglkbNL/lqMm0OXqZOopo0+axv4P1MCFiTXkWCiAOUogSThJ5kzRyt0SNU/0CBmJFR JHtqtGBpRUqoYjTn7dKZ+P23y4WvKpZZ5QiAdi1Q9bj4XXB03olQ5RLRMkLW1jffFNdc WWc9e1x0JTcY+1ys++fEglPLQPENZ2HjqKe9CJppBGt8vPlEXAyX6gycOYP1WqUXQrVu A9EKD7soySU8sLrGk2dtm66dsCVUqauYTa23YpVegQga4qrfpa919KsqE+3tjBj+Gdyc TQt+sHxFrOwfMnNNYtgGINYj2hnngnhLSGuYKz+oobiIRW0bg9mHl0EbkZ1q+V6HWJuj gfFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernkonzept.com header.s=mx1 header.b=MY5uwEkf; 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 i187-20020a639dc4000000b0051344de1eb8si8211543pgd.276.2023.05.08.06.50.58; Mon, 08 May 2023 06:51:15 -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=MY5uwEkf; 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 S234333AbjEHNhe (ORCPT + 99 others); Mon, 8 May 2023 09:37:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234334AbjEHNha (ORCPT ); Mon, 8 May 2023 09:37:30 -0400 Received: from mx.kernkonzept.com (serv1.kernkonzept.com [IPv6:2a01:4f8:1c1c:b490::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D209C33864; Mon, 8 May 2023 06:37:27 -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:Sender: Reply-To:Content-ID:Content-Description; bh=fPadFlLPBY1XV2QeXcRoIHtkBD3+5FKuX66decVcclc=; b=MY5uwEkfWDQkFcimC6nTQDq8I8 QTHpbL2JV3Oj8H+1bnDFDCFQRVGrJEKLvYkn80FcphINT6JBTYhx7+QMBZDaYGPYLSwwCfICzFo7R 8J0NpagYW4QNdtGfU6Wj7R6Y+VdWfgxFo7OlCkjKNazY92WcUkDm4x9MUxHk5vEWzxgsGV7opHNCx sX0v7b1XQIQ+xpGl9okh5uAcx93tL3SobC8u43fn5olG9ty5bde6BB6MBzDkKggL54cntNmsQ3uJM R3gXF+6lGyl3BpX76wrgvntELaN3S1yoaFzXN9u9vEIeoAitmEQYI7lBQXcfky067KxtdSOgvnUpi 1jJB0UTQ==; 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 1pw0hH-009LZn-TT; Mon, 08 May 2023 15:14:35 +0200 From: Stephan Gerhold Date: Mon, 08 May 2023 15:13:38 +0200 Subject: [PATCH v4 1/6] thermal: qcom: tsens: Drop unused legacy structs MIME-Version: 1.0 Message-Id: <20230508-msm8909-tsens-v4-1-d9119622cb19@kernkonzept.com> References: <20230508-msm8909-tsens-v4-0-d9119622cb19@kernkonzept.com> In-Reply-To: <20230508-msm8909-tsens-v4-0-d9119622cb19@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 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 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?1765334188801909406?= X-GMAIL-MSGID: =?utf-8?q?1765334188801909406?= 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 --- 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 e89c6f39a3ae..106d26076e3f 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 Mon May 8 13:13:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 91156 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2166206vqo; Mon, 8 May 2023 06:42:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4eQD0Tbm4Y6XOXTTELhBNaqqLWfGDuy5ao0n9FRNIQjucF9AxYow0OJVbdYD4ROCOE14ke X-Received: by 2002:a05:6a20:5491:b0:ef:a85b:c715 with SMTP id i17-20020a056a20549100b000efa85bc715mr13981808pzk.1.1683553351619; Mon, 08 May 2023 06:42:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683553351; cv=none; d=google.com; s=arc-20160816; b=fN+F5jKcXeNRiPbLNy9zkYiveHsYfla1jp8tC9ou/3bXdQRc5olfGhLDDCPqv/KQFI sBRjWfOqjn6bvKJFtbWP253oQa+YKlNZcnfIqzuTKYA0QtIo9qlFkvAYEjp1jtwRGiIh NJAAN8y04PwhQRKqHAVrHs64YBfDPBOGWCBv/HUcWkfXauWwn6gXFcJg0QibCvBRDwts ErsgL5NH+hiHIyE1qgLBa+d+kpTthoGvM0OaOJGDkLXd9+qeImjLOmtzekmo/PBAdoPL S2wmvTI7rsSRFhVSjjbLUvcWVY8OiKrbGE6YBW1Vpvr/kxWvfhcPgTEu2d2vOYAL5Q99 Uhew== 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=srA3euTk/5sjMRb84lbIHFc1mB5nmRpPgU1BRVL2uW0=; b=ANOtuuN8xkWNJAxJk2rhERgId2Jh2lXSvDkyGGuYDZkgAjs+zYdNE7mX1kjRtUc3VQ Plv3bfKXYs+yi9+90QeUxvfjTESE9h+7cq6SeFfQ3dOy34W8uHwNnjZPAO41XoDgJmpc oxCNgeDmM5hxwp/K9OapJnRnKLKecj9VUzuQgCMEmJZCbHD2nXWwp4Ty1nr7iDIqmCfB 6HPgwqGTo2fS3P4eWtISG2XM3UzbZfOX1J5+mSEMw3iW7X/2yIEPBV2q56HH2j7iibCw f1pSe1MYcGz8kgx628hK7Vz5mmaujC4yujpvv2unG1GFwZ98A6dlSRGF9sjywBD1J3NK GU8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernkonzept.com header.s=mx1 header.b=d1IKuU0Q; 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 j12-20020a637a4c000000b0051b59786e6csi8687991pgn.300.2023.05.08.06.42.18; Mon, 08 May 2023 06:42:31 -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=d1IKuU0Q; 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 S234319AbjEHNhc (ORCPT + 99 others); Mon, 8 May 2023 09:37:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234317AbjEHNhZ (ORCPT ); Mon, 8 May 2023 09:37:25 -0400 Received: from mx.kernkonzept.com (serv1.kernkonzept.com [IPv6:2a01:4f8:1c1c:b490::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E41EC33D5E; Mon, 8 May 2023 06:37: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:Sender: Reply-To:Content-ID:Content-Description; bh=srA3euTk/5sjMRb84lbIHFc1mB5nmRpPgU1BRVL2uW0=; b=d1IKuU0QJzbptvYQyztNEI2xdM MUVyODdv4KijIhe8/YR5rNEfC5EJC6OCUJdlaeyW3y9uHJJrfGD98hiMiH3SBQcxGA0aDgsaMU9qf Ez6ZFbO2ciqdP34Mb5h6NNA5ktsd1RgZPCLuSdrwo+vlxqTfBxNaI4QqWsUOwUvMM7Pt6JlmGg1gO QhJGDewUZH92JQ2ZS2eQwnBt2IrzXjDcet83ixhaSjQrwR59In1af62q0Tr70A/of8StuBqdUI3s+ icCevsYci8PfynSmAYOuNVJ8R35C8hddLQ2Dw8Lp0NogPt+9r/pYxdjYVylJC/EM6T4G+Dwrize2u L+ylw68A==; 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 1pw0hK-009LZn-Lp; Mon, 08 May 2023 15:14:38 +0200 From: Stephan Gerhold Date: Mon, 08 May 2023 15:13:39 +0200 Subject: [PATCH v4 2/6] thermal: qcom: tsens-v0_1: Fix mdm9607 slope values MIME-Version: 1.0 Message-Id: <20230508-msm8909-tsens-v4-2-d9119622cb19@kernkonzept.com> References: <20230508-msm8909-tsens-v4-0-d9119622cb19@kernkonzept.com> In-Reply-To: <20230508-msm8909-tsens-v4-0-d9119622cb19@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 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 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?1765332854135143295?= X-GMAIL-MSGID: =?utf-8?q?1765333638780635316?= 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 Signed-off-by: Stephan Gerhold --- drivers/thermal/qcom/tsens-v0_1.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/thermal/qcom/tsens-v0_1.c b/drivers/thermal/qcom/tsens-v0_1.c index 106d26076e3f..1b454de3928d 100644 --- a/drivers/thermal/qcom/tsens-v0_1.c +++ b/drivers/thermal/qcom/tsens-v0_1.c @@ -222,6 +222,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: 8916, 8939, 8974, 9607 */ static struct tsens_features tsens_v0_1_feat = { @@ -271,12 +281,6 @@ static const struct reg_field tsens_v0_1_regfields[MAX_REGFIELDS] = { [TRDY] = REG_FIELD(TM_TRDY_OFF, 0, 0), }; -static const struct tsens_ops ops_v0_1 = { - .init = init_common, - .calibrate = tsens_calibrate_common, - .get_temp = get_temp_common, -}; - static const struct tsens_ops ops_8916 = { .init = init_common, .calibrate = calibrate_8916, @@ -320,9 +324,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 Mon May 8 13:13:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 91155 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2165805vqo; Mon, 8 May 2023 06:41:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5CGrG3EQnugP1UaMU0h1uFmwYsx4G0Tq+1GmxcVa3idXg6Etgi5tZJQJaxbDy/AcZvuuIV X-Received: by 2002:a17:902:ea82:b0:1aa:e653:1c0d with SMTP id x2-20020a170902ea8200b001aae6531c0dmr10930603plb.19.1683553310852; Mon, 08 May 2023 06:41:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683553310; cv=none; d=google.com; s=arc-20160816; b=AkdIEWpBZyeWmtKe/+j2vNvCwRPF1bWqF3D3X0qZl+8dR6opOHvbRb1LIc6z+hqyoY FxMm5r5c0kvAmsAXubb4S0V8eKfsJ1b3RNNiAzkTql55/CMfUcZ6gCpUDjpSZgJds0ir Sb2OQ+b6C/G8Fk19ApCu2dvyAxL/UXnehziu7KWHS5gtwL3Y7wdQe+Q/VT8p11COCwNY s2pChfkUggwyASmvUyAhHpjkiTKMeFbjFGIO5Ew7snqQXVWEF9EA7WTkQBLqllUnYUKt qmHlYpaqJA78KEb8QwYjfQiKq9UJ9/kHm+vyAWo4nu5TFU0rcr7H+iunAlc+SHxZstAT hFwg== 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=mOseTxwGsFqvCCOX46fJqAaMaCn90Qk+xtOVYSA8awE=; b=mNyXxP7whW6aU6CHrUoegvorJqGXK7sjk4TDs7BYdkzUC/7/A81aJljIe05uwquQA8 c0s0kxo7LLtI52y/dHxm/ejvxRKJQZQPXsUbPhSfVZpfq7p6BJT0UXVC/123cwwpo/lD S9UivcGuegND1mEdnD7XSJUJKWio5lZVkcj/q8rFlYSOAIcerD3myWXKsXzOL2SKefsc 3jodK560Q8Ph/vGC28MOAoIyc8kw7aA0syuiR8ntccJI5wWxrORXUAi2zHwFEFLVrX5P QYR1D2X4FDleG+mk8m/epvB7mLdJXRiA45KFHBoplV4kKX6tYpXlcU3JGenpNb7TV2pR Sq7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernkonzept.com header.s=mx1 header.b=Dk032G45; 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 l6-20020a170903120600b001ab23cbe13bsi8432260plh.104.2023.05.08.06.41.37; Mon, 08 May 2023 06:41:50 -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=Dk032G45; 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 S234286AbjEHNhT (ORCPT + 99 others); Mon, 8 May 2023 09:37:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233170AbjEHNhR (ORCPT ); Mon, 8 May 2023 09:37:17 -0400 X-Greylist: delayed 1353 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 08 May 2023 06:37:12 PDT Received: from mx.kernkonzept.com (serv1.kernkonzept.com [IPv6:2a01:4f8:1c1c:b490::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CBC233169; Mon, 8 May 2023 06:37:12 -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:Sender: Reply-To:Content-ID:Content-Description; bh=mOseTxwGsFqvCCOX46fJqAaMaCn90Qk+xtOVYSA8awE=; b=Dk032G458xZecq5cd3P+eY/iVo qXHdks3fPPt/PslF/Qvqsmi4Jeywm7kDHGumpRItgfXF22yIjJAVXHB7+bp2NGa1AsDvpbrypbNlj x8o2hRsmX0DMSto1AObec6EsFMyiPFOeQACKB256dckq8IRmXbwMlr8XZTeWbQ58jCfLFUGBRx3J5 l037XXKq7XLiOWu8AqGlnyAjLaEklpYTwmOWYE3KTnfTLyAL86R//EL1n3beCStZUBHoxfDNMvG25 eZQxtZtU+q0piduR4Pgcp6sKETOme+3wwUS3qfKExHyyzOkdcZ4IC5yykAxZ8kb5G6zHpHfy3Pm/v F5UjxM+w==; 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 1pw0hN-009LZn-Db; Mon, 08 May 2023 15:14:41 +0200 From: Stephan Gerhold Date: Mon, 08 May 2023 15:13:40 +0200 Subject: [PATCH v4 3/6] thermal: qcom: tsens-v0_1: Add mdm9607 correction offsets MIME-Version: 1.0 Message-Id: <20230508-msm8909-tsens-v4-3-d9119622cb19@kernkonzept.com> References: <20230508-msm8909-tsens-v4-0-d9119622cb19@kernkonzept.com> In-Reply-To: <20230508-msm8909-tsens-v4-0-d9119622cb19@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 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 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?1765333596799234107?= X-GMAIL-MSGID: =?utf-8?q?1765333596799234107?= 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 Signed-off-by: Stephan Gerhold Reviewed-by: Dmitry Baryshkov --- 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 1b454de3928d..e69889dd524a 100644 --- a/drivers/thermal/qcom/tsens-v0_1.c +++ b/drivers/thermal/qcom/tsens-v0_1.c @@ -229,6 +229,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 d3218127e617..065d0f9728a5 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 dba9cd38f637..880be6be5c3f 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 Mon May 8 13:13:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 91161 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2179132vqo; Mon, 8 May 2023 07:02:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5dUZ+2mhI1aXJUpFZzaaFtgcvl8f6oP/RdbbdiMtReb4c12CXzE+OTOujFuxU2uW8Ms+CQ X-Received: by 2002:a05:6a00:989:b0:63d:368b:76b4 with SMTP id u9-20020a056a00098900b0063d368b76b4mr15039305pfg.17.1683554574449; Mon, 08 May 2023 07:02:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683554574; cv=none; d=google.com; s=arc-20160816; b=dgbHImBbu3dItK9eNaTQtZmB7tNQ0VNgQw37aOKjuBZg3rfqTsHyLPEwApxXeTaqzk MzQvOb6TuTR0FdO7gaUBlGgs1QHCiXU8tNT8W45EX4jkesz/iAz8xwhd9oRvdKuVmZFp GcwD1EEeqQYAw1tkrbn7O/P1VZ2kdOG+HYTXnA/QWM/P1vsQqAS4AsNTIXpTLAn9HXVw xXB7C7tpylQnQwfMrYHc8O9KvgvNbZiOU9aGAzSGmHpGSXM1Ar26E7KX8rM2vEaEQgsV g97keso3ec/kyuwrhn7ZkmZ+30SIqu52K3AWuBdcnvO+Jk61HCeXSrz22pobZkBsI77W vgsw== 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=THQRHAMI2wjqc2cEXAdfvd3TH+vbwEjAZnae16/zBtA=; b=R47+M+t5tcr8lwqAoZgwHSaA2QgepAAFInwmjuzR3Hv2VkL83TuPoVSmEfOuwv//6G KH7xKik1iTqb3e5TovAyMlt1UDM0Lykc68yQZU++koAl3ksSoM+s6MVnqB5ifR5LI6hT WWn3IAmG000zsEl/yBcGF+W0nw1Gz9B1At9DDmBXEY6ib7Ic+h8bGm9zXAA6ookVDGtW 6KcSkQzzoDr/79umrEzwLYBrFFBlah/bXSrZW/TgpUfVStVPE/bWRE+zNQfoDRSUlgH4 sJuw/joIsS3WoGITH3QZTIeoaHKH4QuEsqx2ieTXyOay7Vga/Ll738kF80xmKCHom4uG 2lqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernkonzept.com header.s=mx1 header.b=DZfCEXEX; 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 4-20020a630704000000b0052c998beef6si8501797pgh.506.2023.05.08.07.01.52; Mon, 08 May 2023 07:02:54 -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=DZfCEXEX; 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 S234390AbjEHNi3 (ORCPT + 99 others); Mon, 8 May 2023 09:38:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234346AbjEHNiP (ORCPT ); Mon, 8 May 2023 09:38:15 -0400 Received: from mx.kernkonzept.com (serv1.kernkonzept.com [IPv6:2a01:4f8:1c1c:b490::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D251E34105; Mon, 8 May 2023 06:37:51 -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:Sender: Reply-To:Content-ID:Content-Description; bh=THQRHAMI2wjqc2cEXAdfvd3TH+vbwEjAZnae16/zBtA=; b=DZfCEXEXZAriq4HAd9+BbVGe+t XVPzBGXR7TZzvz2e8to3YcRhiy4e78vDbsjBXg9VvSsrDHRz2PhPVdfJOMA5Jt4PkcMio9NCn8yrl LwbuLMZeztXZtWODi0ewaC9lCcbjfkjpNLx70qLLtpHZgjGdl8YIlshRUIh1AeXrpgkL3astVGogr GofpK3Ugq5VREX/ukcekEJw76bcNoHf26eRaNzH+6Ko91Wimz5oUMdocyMZ+eQwbkjvbUlpLvD1wo ECpZ8pYJYg28yn3yRkngOUnpCYiXD1ZZWEq4OztXQXRkEKRaxnHFnAMcwMSfmBAP5A78Vlujvp6KM m2/gV0IQ==; 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 1pw0hQ-009LZn-Gv; Mon, 08 May 2023 15:14:44 +0200 From: Stephan Gerhold Date: Mon, 08 May 2023 15:13:41 +0200 Subject: [PATCH v4 4/6] dt-bindings: thermal: qcom-tsens: Drop redundant compatibles MIME-Version: 1.0 Message-Id: <20230508-msm8909-tsens-v4-4-d9119622cb19@kernkonzept.com> References: <20230508-msm8909-tsens-v4-0-d9119622cb19@kernkonzept.com> In-Reply-To: <20230508-msm8909-tsens-v4-0-d9119622cb19@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, 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 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?1765334921555179155?= X-GMAIL-MSGID: =?utf-8?q?1765334921555179155?= 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 d1ec963a6834..59b74fdacf00 100644 --- a/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml +++ b/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml @@ -223,12 +223,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: @@ -244,22 +239,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 Mon May 8 13:13:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 91154 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2165311vqo; Mon, 8 May 2023 06:41:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7GtiWWltPt+0sDxJv6YEAFJY63ZXkOv0phSkypDag89aAkZIV8X5OHWUzziLnYTkQ0N3bM X-Received: by 2002:a05:6a20:8425:b0:f6:d60d:dbc2 with SMTP id c37-20020a056a20842500b000f6d60ddbc2mr13159262pzd.28.1683553267993; Mon, 08 May 2023 06:41:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683553267; cv=none; d=google.com; s=arc-20160816; b=UyaBdjEqdoCB8tbBvsJ/dJzqE5E2fgX0YdM6mAvG+jh+Gmwzj/DDbKBBqgDZcxeav0 197+dBkFeB4wcXbMJFgfUDBsCo+9/WuBoP7OSYG6bU3ANksYrfzKjbnhQnMfj+NDD8QW RlOrtGSxSrgw+Z3TkctAz6LJw55FPdY0sfMSoFoKOzPLq9iMEFTSQrhEHE8BEW+1jEeC W7zw0FMtlXDLJlEiH2OpCOQAU8Y6Qn9Q8LvfK8fQmcvVA/09Q9ItNpyTr9v8gc970cA6 PItY3YppkasTVVgD9ZhPfLD3wDuEBO7ba+D6XMM+rW0loo5DHWWKn1n7HekyIJtuCOJa UAoQ== 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=seOyPTPFaU0gL9veZr6+r2Y5hMFw78whMWlcD7v4Ggo=; b=Tp4lMFZx8FI959PfhEfCgavmTQGJ34SxSh5UgQnT5B7BHNv1pqSb+wcBDgvrCg6B+S h3428Es/qQ0vWuDVlQ2dBNbshjvZNZa18WqwisRSfepMT1tPbHcad73Q7DDDJd68BPlX N9sIQS3kp/VEd8g4tiVsHNuCisz0B0MHN3whTghW8PR80YyIELa8UOuPGT1IclCyGb8L VCC4vB/BNa4hScnfrP3Mi4wC41YDPVgeFVrBLCJAZSdsTjvUiCIsyoWr9QRoJYq2HYyk jstXcqC5IsluGgFwQufpjielPsNPXAzDccg4yHimj3f7m/NQZ7gzB+mUxgd4hCFr5Myu 4iPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernkonzept.com header.s=mx1 header.b=msUjHnCZ; 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 16-20020a17090a1a5000b002474101aa7esi6963479pjl.163.2023.05.08.06.40.54; Mon, 08 May 2023 06:41:07 -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=msUjHnCZ; 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 S234311AbjEHNhY (ORCPT + 99 others); Mon, 8 May 2023 09:37:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233170AbjEHNhV (ORCPT ); Mon, 8 May 2023 09:37:21 -0400 Received: from mx.kernkonzept.com (serv1.kernkonzept.com [IPv6:2a01:4f8:1c1c:b490::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1E842CD23; Mon, 8 May 2023 06:37:19 -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:Sender: Reply-To:Content-ID:Content-Description; bh=seOyPTPFaU0gL9veZr6+r2Y5hMFw78whMWlcD7v4Ggo=; b=msUjHnCZqEXt3N0NeQow9x0pGx 0bKYGwuMJVIZ3U2htzhYj6ayuU1oHVPylp8XkYQUyYoORjLFEVPLAZXuK5pQwEexzF0g/t15qHsiO DcJ7w0E///UGgoNWSUMvGVuuZIbqjZSHhZjvK95+6Bc0r6AA2aT0DdFZW7PhqvcpCJ6wjipCU6j2K COb3g22+GSo1hd22AM/EsD9eX0cnjKrPfSkSvZsTgBMwhSLIANDF9j1BTJwXMpi0uEfLhSjQ1KEmP x03jtFsygXbYdfhleARDlQFXd+GCqNNf+Ya2TL4xXyEO1lg3msKZDi7A9CiUgjq3hmvbE2HYaQZeD HSqlJ6RA==; 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 1pw0hT-009LZn-Jg; Mon, 08 May 2023 15:14:47 +0200 From: Stephan Gerhold Date: Mon, 08 May 2023 15:13:42 +0200 Subject: [PATCH v4 5/6] dt-bindings: thermal: qcom-tsens: Add MSM8909 compatible MIME-Version: 1.0 Message-Id: <20230508-msm8909-tsens-v4-5-d9119622cb19@kernkonzept.com> References: <20230508-msm8909-tsens-v4-0-d9119622cb19@kernkonzept.com> In-Reply-To: <20230508-msm8909-tsens-v4-0-d9119622cb19@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, 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 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?1765333551434751426?= X-GMAIL-MSGID: =?utf-8?q?1765333551434751426?= 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 59b74fdacf00..47e95fe44c16 100644 --- a/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml +++ b/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml @@ -29,6 +29,7 @@ properties: items: - enum: - qcom,mdm9607-tsens + - qcom,msm8909-tsens - qcom,msm8916-tsens - qcom,msm8939-tsens - qcom,msm8974-tsens From patchwork Mon May 8 13:13:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 91158 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2166461vqo; Mon, 8 May 2023 06:42:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7M8y4EgMIqZRKmkgUvKWx+BeZ+7qe6rLD9PM5aUM/xoRZ9HQ7vWIo1W0up7B2ohtejL6Mu X-Received: by 2002:a05:6a20:a11a:b0:f0:d50c:4ac5 with SMTP id q26-20020a056a20a11a00b000f0d50c4ac5mr13483315pzk.51.1683553377983; Mon, 08 May 2023 06:42:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683553377; cv=none; d=google.com; s=arc-20160816; b=ngd0hkP2LcrXFN8RrB3SofasJVXbY+ExBWv/D/IqWgitoFU+H2ZBGSDPeofrjQCRGF deISulqkNcU8RGe8Ul/EClZP0egpReynmZWURQZYQedCAw/iam+WL04ebAcn3LgtA+I7 kqAcezUO35hhHD4gpxcCGA6J7K8XdvkYSOpXgJu6L5fc6Q/1HJnMOtNCzLli7puJ13br 19aVlbI8DBwQLcWxO0T1tU3ILeHHVzjl6xIYdqQzyTrE29jbERukTKWNN/4QX6n3xCQg fhwzFTatQ4VtbA9ZGxtdZacB0gFbB7/+FDIFMO2jh2flAQXoYbCj2Mp+PtyKRs5L8n4H 94uw== 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=NOkAIQUPJO28ZJg22Jb1eVbFAiUIZlNRpNU5m2FRP5E=; b=BjfOAqa/6SvNpW9+fSY8b9CywDmWbBPc3K7XXCjml1NHC2goQ/JEGN9rvjfYDB/ldS uXqzJ4SPy1kEtaBfZJgAF0C0dxBf2my7LkY5d+bF9RSgWC1AJMh89CyyVOIhDjbFQ0FY kNirmJFf/hfeFbXzy03Urws2QPoErRljxGZRLrffoDK3cIQxqhJTkFVGfjQ4QeyTXZPC laquuysB2eJERfrGUomw5xKhU0TPNUj6TXQQO/dDrmijZ/Cf1j/Svzn5VkP1ngRQIgHM s+FXEBf4MQvihwjgrfih66c1BrlM6NEENM1HnzdpjY4uvD0gXgnOMDJp2h0o5AJ5UMAT tysw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernkonzept.com header.s=mx1 header.b=EE5V4tWp; 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 u11-20020a6540cb000000b0051a6292309fsi8297117pgp.894.2023.05.08.06.42.44; Mon, 08 May 2023 06:42:57 -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=EE5V4tWp; 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 S234358AbjEHNhz (ORCPT + 99 others); Mon, 8 May 2023 09:37:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234379AbjEHNht (ORCPT ); Mon, 8 May 2023 09:37:49 -0400 Received: from mx.kernkonzept.com (serv1.kernkonzept.com [IPv6:2a01:4f8:1c1c:b490::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29E2A33865; Mon, 8 May 2023 06:37:40 -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:Sender: Reply-To:Content-ID:Content-Description; bh=NOkAIQUPJO28ZJg22Jb1eVbFAiUIZlNRpNU5m2FRP5E=; b=EE5V4tWpDwtjBnTfbVkN+3p7ci sg2A6hiutkktUQSXBF8ueZMosQDNH4Qfw1SyG359v5u3w32dPJh2y6jepyG/+uWPfQoWmT7RHPHAp SXE3SWmC6c2CYP/4hQSl0NSSu2XMjxtFZMAmXQTOFcP3wocr/otRM1XOQm83zSCN/pyOFnIWvQS/y TlWmY1ZZidMDAxZbqFAk8gIf0AN3AUD8OUPYKuDOp4QuPDwHHqORG3/wunnCa5LJ/hGaFEuTG7cE4 YZ+DAvCVpA+rhYLAJUJKBrizMjqnVUM2Z93nih58AM+ckZLORRYF3uSLi999il+h0yxJijI6x2ztr G+CH5APA==; 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 1pw0hW-009LZn-Bf; Mon, 08 May 2023 15:14:50 +0200 From: Stephan Gerhold Date: Mon, 08 May 2023 15:13:43 +0200 Subject: [PATCH v4 6/6] thermal: qcom: tsens-v0_1: Add MSM8909 data MIME-Version: 1.0 Message-Id: <20230508-msm8909-tsens-v4-6-d9119622cb19@kernkonzept.com> References: <20230508-msm8909-tsens-v4-0-d9119622cb19@kernkonzept.com> In-Reply-To: <20230508-msm8909-tsens-v4-0-d9119622cb19@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 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 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?1765333456860017797?= X-GMAIL-MSGID: =?utf-8?q?1765333666967415011?= 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 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 e69889dd524a..f97d313f0536 100644 --- a/drivers/thermal/qcom/tsens-v0_1.c +++ b/drivers/thermal/qcom/tsens-v0_1.c @@ -207,6 +207,27 @@ static int calibrate_8974(struct tsens_priv *priv) return 0; } +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; @@ -243,7 +264,7 @@ static int __init init_9607(struct tsens_priv *priv) return init_common(priv); } -/* v0.1: 8916, 8939, 8974, 9607 */ +/* v0.1: 8909, 8916, 8939, 8974, 9607 */ static struct tsens_features tsens_v0_1_feat = { .ver_major = VER_0_1, @@ -292,6 +313,19 @@ static const struct reg_field tsens_v0_1_regfields[MAX_REGFIELDS] = { [TRDY] = REG_FIELD(TM_TRDY_OFF, 0, 0), }; +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 065d0f9728a5..1d7c149038e0 100644 --- a/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c @@ -1109,6 +1109,9 @@ static const struct of_device_id tsens_table[] = { }, { .compatible = "qcom,mdm9607-tsens", .data = &data_9607, + }, { + .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 880be6be5c3f..c88287dede96 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_8916, data_8939, data_8974, data_9607; +extern struct tsens_plat_data 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;