From patchwork Thu Jun 14 10:43:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 138545 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp1940924lji; Thu, 14 Jun 2018 03:44:17 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIFe24oiZZcxGXmeFdsa1GVStHaKA7hkU6Krv4zew/wD6NdRDi39I6C+EmAMEyx5FDIeGjg X-Received: by 2002:a63:bc0a:: with SMTP id q10-v6mr1855781pge.70.1528973057654; Thu, 14 Jun 2018 03:44:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528973057; cv=none; d=google.com; s=arc-20160816; b=dLau3Tc8L3Jlr4aap2/P4iP/FtlxtdyiKnfZMS/pG0XIzyU4rK3vXEd0L/kjWgcn2K QXV4ktrPVoggqWB37MoNXPIu779ZSpQYKb84UVgsc3HLHkphjJ5AiNLCTmP73p1uQNzx 7bBDSnTX+IWWY1WBSEKqD5k36LAy+vk2zKRFUA2bQsjGqD+tfZWd2TdemA8EonZslFIh UoT7dwgXgjk4v0qW00DspK1cciKyee6eOfrx7L+F8HAE2lAfuNnD6nPgFej8VIiFypJI LiEWY0I64lx7b89TqCz9fOaqQaHI9+C6xeF7OO6iVATaYSOc9AcHDuL/4HaH1eSS5f5G D0ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=nsLRHqDsn6jIlUl3h1shSA3jg98RwxjrWsSKcLlExq4=; b=eYoc8jL2DNAdfbHKRycVsZzNWEmuMqL5bfqh1h9pHOso0ubVAtdPjso8Uqwnn48EVv ORLPM94fIJuMhRfRUBeaObpaXwGfPEo2VWtunoZBjrmUs1qxO7FR2R1IYfYee6XtQwkC Y+14W0IXrw099MtB7YyzYmYo+hVlLzUrqWa2QEn+UPWm6KoiHPcOF31a2NsuKJMHbTzJ +JD25PcTLeE+TaZN6SD6DFFUmC+nLZQRlPCy0ONB0PC1pZSFS7Ugkzc0HPEIXPg2kvfD ZlH+qpObgQchI7N88jfBKVkzgvXkkbXapzRixl+i6+fWriYDEWDo5KqH15rAJkN1lxPo eauw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LT1IVnCo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y21-v6si4843958pfm.1.2018.06.14.03.44.17; Thu, 14 Jun 2018 03:44:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LT1IVnCo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755138AbeFNKoQ (ORCPT + 30 others); Thu, 14 Jun 2018 06:44:16 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:35015 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935786AbeFNKoM (ORCPT ); Thu, 14 Jun 2018 06:44:12 -0400 Received: by mail-lf0-f66.google.com with SMTP id i15-v6so8667991lfc.2 for ; Thu, 14 Jun 2018 03:44:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=nsLRHqDsn6jIlUl3h1shSA3jg98RwxjrWsSKcLlExq4=; b=LT1IVnCorpgGAWEoUOq6VNXRB3aEXO6y7JwmORhLa4nBLkjMCKzQuN899bORmb22Zh VhvtR+v/nugVoHnb5hIdg4cFjT1DZLc5Iv6eVvEUJxJMbEm+fj5WH/jJgs09IeBHRemb rz4pnwl1DE1rhAWi5hMMoCv5u5Lvc435Pu4H4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=nsLRHqDsn6jIlUl3h1shSA3jg98RwxjrWsSKcLlExq4=; b=EUKYKQS2LJJLBEF6Hh7p0TwFdDg9X6DNXac77grGrW2SfJ/cinEQkKCPanqPpkVIcQ DT++WeIwH2csIeNzLkGaoUVZxzTRqeItXfF3bxI2iTu5DpEyL5yiE9WynUzL0Pk69E9x Fk8+SEtykISYm4OTrYz0mnrJ5O0ucdC0LpK3KLeKfUvI59AKRUPaajrgqAgciVOz6ybq gdWtRJAwqJEA+2yTPFKneOUIwVobIqm8nO7KPzU9SWP0zd+0KlgrlvFRqmi02J9FP5Xb QpW58pFK/5M9bFnqsFJ2jqEVAFoKCRpFYHn7EqXaFNo+ElCcxfI6ALLc7rc/6sR0RZl1 0Slw== X-Gm-Message-State: APt69E1Ugv+XavpVmYiCYXKbI/pnnL1G1w5NYzo0fwupGrihhD56NFBa +Zd76isv5+UCyjJR9aue+FvEYbLlfgo= X-Received: by 2002:a2e:5358:: with SMTP id t24-v6mr1448532ljd.129.1528973051032; Thu, 14 Jun 2018 03:44:11 -0700 (PDT) Received: from localhost (85-76-96-172-nat.elisa-mobile.fi. [85.76.96.172]) by smtp.gmail.com with ESMTPSA id a19-v6sm1013055lff.84.2018.06.14.03.44.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Jun 2018 03:44:09 -0700 (PDT) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: rnayak@codeaurora.org, linux-arm-msm@vger.kernel.org, bjorn.andersson@linaro.org, edubezval@gmail.com, smohanad@codeaurora.org, vivek.gautam@codeaurora.org, andy.gross@linaro.org, Zhang Rui , Rob Herring , Mark Rutland , David Brown , Catalin Marinas , Will Deacon , Kees Cook , linux-pm@vger.kernel.org (open list:THERMAL), devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-soc@vger.kernel.org (open list:ARM/QUALCOMM SUPPORT), linux-arm-kernel@lists.infradead.org (moderated list:ARM64 PORT (AARCH64 ARCHITECTURE)) Subject: [PATCH v3 4/6] thermal: tsens: Add support for SDM845 Date: Thu, 14 Jun 2018 13:43:14 +0300 Message-Id: <0cdd0957cf80c2f9921928755722a427c7309964.1528972165.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org SDM845 uses the TSENS v2 IP block Signed-off-by: Amit Kucheria --- Documentation/devicetree/bindings/thermal/qcom-tsens.txt | 1 + arch/arm64/boot/dts/qcom/msm8996.dtsi | 2 +- drivers/thermal/qcom/tsens-v2.c | 9 ++++++++- drivers/thermal/qcom/tsens.c | 3 +++ drivers/thermal/qcom/tsens.h | 5 ++++- 5 files changed, 17 insertions(+), 3 deletions(-) -- 2.7.4 diff --git a/Documentation/devicetree/bindings/thermal/qcom-tsens.txt b/Documentation/devicetree/bindings/thermal/qcom-tsens.txt index 06195e8..84da3db 100644 --- a/Documentation/devicetree/bindings/thermal/qcom-tsens.txt +++ b/Documentation/devicetree/bindings/thermal/qcom-tsens.txt @@ -5,6 +5,7 @@ Required properties: - "qcom,msm8916-tsens" : For 8916 Family of SoCs - "qcom,msm8974-tsens" : For 8974 Family of SoCs - "qcom,msm8996-tsens" : For 8996 Family of SoCs + - "qcom,tsens-v2" : For any SoC with v2 version of the tsens IP - reg: Address range of the thermal registers - #thermal-sensor-cells : Should be 1. See ./thermal.txt for a description. diff --git a/arch/arm64/boot/dts/qcom/msm8996.dtsi b/arch/arm64/boot/dts/qcom/msm8996.dtsi index 6c8a857..28d4c08 100644 --- a/arch/arm64/boot/dts/qcom/msm8996.dtsi +++ b/arch/arm64/boot/dts/qcom/msm8996.dtsi @@ -460,7 +460,7 @@ }; tsens0: thermal-sensor@4a8000 { - compatible = "qcom,msm8996-tsens"; + compatible = "qcom,msm8996-tsens", "qcom,tsens-v2"; reg = <0x4a9000 0x1000>, /* TM */ <0x4a8000 0x1000>; /* SROT */ #qcom,sensors = <13>; diff --git a/drivers/thermal/qcom/tsens-v2.c b/drivers/thermal/qcom/tsens-v2.c index c981a40..abc8f13 100644 --- a/drivers/thermal/qcom/tsens-v2.c +++ b/drivers/thermal/qcom/tsens-v2.c @@ -69,8 +69,15 @@ static const struct tsens_ops ops_v2 = { .get_temp = get_temp_tsens_v2, }; +const struct tsens_data data_tsens_v2 = { + .ops = &ops_v2, +}; + +/* Kept around for backward compatibility with old msm8996.dtsi. + * New platforms should use data_tsens_v2 if possible and define + * the #qcom,sensors property in DT. + */ const struct tsens_data data_8996 = { .num_sensors = 13, .ops = &ops_v2, }; - diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c index 3440166c..a2c9bfa 100644 --- a/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c @@ -72,6 +72,9 @@ static const struct of_device_id tsens_table[] = { }, { .compatible = "qcom,msm8996-tsens", .data = &data_8996, + }, { + .compatible = "qcom,tsens-v2", + .data = &data_tsens_v2, }, {} }; diff --git a/drivers/thermal/qcom/tsens.h b/drivers/thermal/qcom/tsens.h index dc56e1e..69212cb 100644 --- a/drivers/thermal/qcom/tsens.h +++ b/drivers/thermal/qcom/tsens.h @@ -87,6 +87,9 @@ void compute_intercept_slope(struct tsens_device *, u32 *, u32 *, u32); int init_common(struct tsens_device *); int get_temp_common(struct tsens_device *, int, int *); -extern const struct tsens_data data_8916, data_8974, data_8960, data_8996; +/* TSENS v1 targets */ +extern const struct tsens_data data_8916, data_8974, data_8960; +/* TSENS v2 targets */ +extern const struct tsens_data data_8996, data_tsens_v2; #endif /* __QCOM_TSENS_H__ */