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: 10463807 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E6252603EE for ; Thu, 14 Jun 2018 10:44:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D53722892C for ; Thu, 14 Jun 2018 10:44:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C979D289F8; Thu, 14 Jun 2018 10:44:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 76F812892C for ; Thu, 14 Jun 2018 10:44:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Youpc6LqWHC5t9Jjs76H59CybqlQGjKdKIFpTcwoQ0w=; b=E9iBYbA+U1pfswhLoA3QIshT5J zlO4xrfrIhXauuOMhvyXXj2YGJnNJlxqxeXKpHBqC0Ra3iYB4QSzTBSsEZLMFpFVopab9Ij2Bx+WA lG+yW9YO8l1sTqbRzLLpUo5ufID/e/DLbpGc87Z9rsqFsiHNqigZkqLPvBB5s+pZtVpon4fhuWM+k RZOrJXEe3rvzo2wZfH5wrRvQLb+5i0013Xc58WEt5PjTox6NajXmHcqLGY8bSn8fefD/NXBF3ZWI+ vi4UTMz1MXf/3ikjWQ5oR2gyOoLeyUJf1Q3ea+gaRvDTvkFchQbEzJWkhqn674Gowjz9GkUFWvoWh PqLZU6xg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fTPkD-0000JR-Rs; Thu, 14 Jun 2018 10:44:45 +0000 Received: from mail-lf0-x244.google.com ([2a00:1450:4010:c07::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fTPjr-0008D5-7G for linux-arm-kernel@lists.infradead.org; Thu, 14 Jun 2018 10:44:26 +0000 Received: by mail-lf0-x244.google.com with SMTP id o9-v6so8678510lfk.1 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=Qj5xNlszP9nR6W4P3ZAvGpIc+SQBH6tYXUqt6+i75DgCHV8Aclvt/ciUofvQbpTp4a Sp1TmZznsfHrNiMZaH/7e+MmBSekMfX3IWu+CQS2zxzk7SKT7RznYEEn9OsUmXQ8BqT0 45Jbmjq+Kbs1VeVQWmi8F+nUnSvaLtZvWG9tSxcetKO/9MZTC+alLZ/bZ0h8zX0xLY0n Uw2kbPjSUzUZ77GXmT6yARV02V9/P34Ey6nyMP9STtuTPWyrmkp/WWlmvvKTcvkhj0kJ /EfK8NbtSOQUXjwtxW++RS+ZJK2xdn25v61sBpPBWNHLc2yNP9O1mGakQ0Rye3G9NG2i e8CA== X-Gm-Message-State: APt69E2zEDztu0fQFo6x9saTzLINzWBBSuj0wct64C5R+nlKMR5HKDYn 8rP4ZwUAHR0kzWY+S7pjDg/33w== X-Google-Smtp-Source: ADUXVKLQ8S6RFe5VU59a/OIS0eSY1JSpk9YPxmV7P3vQdpSEqTuym9MJTzmNvjLDNCPozMW60C51Bw== 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 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: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180614_034423_314763_4F789AA3 X-CRM114-Status: GOOD ( 15.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , rnayak@codeaurora.org, Kees Cook , "open list:THERMAL" , linux-arm-msm@vger.kernel.org, Will Deacon , smohanad@codeaurora.org, bjorn.andersson@linaro.org, edubezval@gmail.com, David Brown , Rob Herring , vivek.gautam@codeaurora.org, Catalin Marinas , andy.gross@linaro.org, Zhang Rui , "open list:ARM/QUALCOMM SUPPORT" , "moderated list:ARM64 PORT AARCH64 ARCHITECTURE" MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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__ */