From patchwork Tue Nov 5 03:17:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhangqing X-Patchwork-Id: 11226907 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9F5991390 for ; Tue, 5 Nov 2019 03:24:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 86F9B21882 for ; Tue, 5 Nov 2019 03:24:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730299AbfKEDYG (ORCPT ); Mon, 4 Nov 2019 22:24:06 -0500 Received: from lucky1.263xmail.com ([211.157.147.133]:54260 "EHLO lucky1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729967AbfKEDYG (ORCPT ); Mon, 4 Nov 2019 22:24:06 -0500 Received: from localhost (unknown [192.168.167.16]) by lucky1.263xmail.com (Postfix) with ESMTP id 4850078DB4; Tue, 5 Nov 2019 11:17:28 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-ANTISPAM-LEVEL: 2 X-ABS-CHECKED: 0 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (postfix) whith ESMTP id P5865T139886076045056S1572923844811932_; Tue, 05 Nov 2019 11:17:28 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <8cee74a44653a01e2bbf72ea3691cd3a> X-RL-SENDER: zhangqing@rock-chips.com X-SENDER: zhangqing@rock-chips.com X-LOGIN-NAME: zhangqing@rock-chips.com X-FST-TO: heiko@sntech.de X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 From: Elaine Zhang To: heiko@sntech.de Cc: amit.kucheria@verdurent.com, rui.zhang@intel.com, edubezval@gmail.com, daniel.lezcano@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, xxx@rock-chips.com, xf@rock-chips.com, huangtao@rock-chips.com, andy.yan@rock-chips.com, Elaine Zhang Subject: [PATCH v1 2/3] thermal: rockchip: Support the RK3308 SoC in thermal driver Date: Tue, 5 Nov 2019 11:17:25 +0800 Message-Id: <1572923846-23310-3-git-send-email-zhangqing@rock-chips.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1572923846-23310-1-git-send-email-zhangqing@rock-chips.com> References: <1572923846-23310-1-git-send-email-zhangqing@rock-chips.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org RK3308 SOC has two Temperature Sensors for CPU and GPU. Signed-off-by: Elaine Zhang Reviewed-by: Heiko Stuebner --- drivers/thermal/rockchip_thermal.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c index 343c2f5c5a25..c50ff6314389 100644 --- a/drivers/thermal/rockchip_thermal.c +++ b/drivers/thermal/rockchip_thermal.c @@ -918,6 +918,30 @@ static void rk_tsadcv2_tshut_mode(int chn, void __iomem *regs, }, }; +static const struct rockchip_tsadc_chip rk3308_tsadc_data = { + .chn_id[SENSOR_CPU] = 0, /* cpu sensor is channel 0 */ + .chn_id[SENSOR_GPU] = 1, /* gpu sensor is channel 1 */ + .chn_num = 2, /* 2 channels for tsadc */ + + .tshut_mode = TSHUT_MODE_CRU, /* default TSHUT via CRU */ + .tshut_temp = 95000, + + .initialize = rk_tsadcv4_initialize, + .irq_ack = rk_tsadcv3_irq_ack, + .control = rk_tsadcv3_control, + .get_temp = rk_tsadcv2_get_temp, + .set_alarm_temp = rk_tsadcv2_alarm_temp, + .set_tshut_temp = rk_tsadcv2_tshut_temp, + .set_tshut_mode = rk_tsadcv2_tshut_mode, + + .table = { + .id = rk3328_code_table, + .length = ARRAY_SIZE(rk3328_code_table), + .data_mask = TSADCV2_DATA_MASK, + .mode = ADC_INCREMENT, + }, +}; + static const struct rockchip_tsadc_chip rk3328_tsadc_data = { .chn_id[SENSOR_CPU] = 0, /* cpu sensor is channel 0 */ .chn_num = 1, /* one channels for tsadc */ @@ -1033,6 +1057,10 @@ static void rk_tsadcv2_tshut_mode(int chn, void __iomem *regs, .data = (void *)&rk3288_tsadc_data, }, { + .compatible = "rockchip,rk3308-tsadc", + .data = (void *)&rk3308_tsadc_data, + }, + { .compatible = "rockchip,rk3328-tsadc", .data = (void *)&rk3328_tsadc_data, },