Received: by 10.223.176.5 with SMTP id f5csp2241166wra; Mon, 5 Feb 2018 00:15:09 -0800 (PST) X-Google-Smtp-Source: AH8x227CJ+pr1DyQY9LOrPKkszdgV2t0/E5a6BtXdyvIZIk35Iz5aQUKOnC4TPQdEU/uF2wSzpZA X-Received: by 2002:a17:902:5a05:: with SMTP id q5-v6mr9382400pli.152.1517818509464; Mon, 05 Feb 2018 00:15:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517818509; cv=none; d=google.com; s=arc-20160816; b=WcPzpjC8/sF/pYB3uTUVhYv2HqCRfEgqXO9NSgPkohZbpqriuwqhnAeEHoSJeEK0EL KRHoRhYB89ahlOGPqmO7VMg4hQN+0Fbf+nmZYLGlum6ivjUvtA3YYTE6fE7fiylDt3Yo niV83npYda7dHH8vE4BFTWj2FZfK8d4QKrnvzL19C/vsXnmgAtQO3Si9qzENpB5MoOiQ ixjE5GxclS+/Wm89a/XF2fQ4Zo/Lt2hJv0y0nI/Q8QPlK4ptZ3sDrw/SV0zvdvqGq9Km xeuiUzb84Km14vMexBT7DFtVeumMtsLody+ZATUZdn6p7Y7XoxFNo+Fwd0ON+DFIHqXF ISvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=5Xz1Q2y8h8XF+Vt138kWi66Qfk2T/Al9lGOrZW+bN74=; b=uUZY31FPqTMCAAojOH8LGxNg5iuOeQByPB5D7czYCmh3Y9rkh795MvXnii1/VcG0y/ YBAJyGrgTsI9zWNOwAHebLybM8UU80n0Ns46OyIydpu56pRtqdUyzRGYffj5x/jlGxn+ 613lQ9Eg+L0Z3lpZeulgDT3pQSnGOmVflPtIJoDJCVYaPoYhPTzXOyD4KRfXmOG24LlM LKcmcyA1jD92SyCkvY/wFu+ygd2hy5IBxYEShoorvlH0YeDxZVBqIWucdHZ4cbEsqHaj VDza+2E2FZyrI4BFEpizaSHmZ88CdZhtTL9S6Q48GVSvtNo7zQujkZ71bzc5kmKrnqHK AhHw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e82si6529819pfd.331.2018.02.05.00.14.54; Mon, 05 Feb 2018 00:15:09 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752712AbeBEIMZ (ORCPT + 99 others); Mon, 5 Feb 2018 03:12:25 -0500 Received: from mailgw01.mediatek.com ([210.61.82.183]:65141 "EHLO mailgw01.mediatek.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752623AbeBEIMA (ORCPT ); Mon, 5 Feb 2018 03:12:00 -0500 X-UUID: 0c2a759cf7b54b6d9baef2a8b7b78bed-20180205 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 755776825; Mon, 05 Feb 2018 16:11:55 +0800 Received: from mtkcas09.mediatek.inc (172.21.101.178) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Mon, 5 Feb 2018 16:11:53 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkcas09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1210.3 via Frontend Transport; Mon, 5 Feb 2018 16:11:53 +0800 From: To: , , CC: , , , , , Sean Wang , Shunli Wang Subject: [PATCH 2/2] thermal: mediatek: add support for MT7622 SoC Date: Mon, 5 Feb 2018 16:11:52 +0800 Message-ID: <796b53ce7fc5e81a04c5ab9cfa4cee67015b355f.1517817887.git.sean.wang@mediatek.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <0b7dabc3b2c7ed93b88ec0923c2cce2f84fba5b1.1517817887.git.sean.wang@mediatek.com> References: <0b7dabc3b2c7ed93b88ec0923c2cce2f84fba5b1.1517817887.git.sean.wang@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sean Wang MT7622 SoC has built-in thermal controller with one sensing point, the patch just is to extend the functionality of the existing logic. Signed-off-by: Sean Wang Signed-off-by: Shunli Wang --- drivers/thermal/mtk_thermal.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c index 1e61c09..8a53151 100644 --- a/drivers/thermal/mtk_thermal.c +++ b/drivers/thermal/mtk_thermal.c @@ -158,6 +158,12 @@ /* The number of sensing points per bank */ #define MT2712_NUM_SENSORS_PER_ZONE 4 +#define MT7622_TEMP_AUXADC_CHANNEL 11 +#define MT7622_NUM_SENSORS 1 +#define MT7622_NUM_ZONES 1 +#define MT7622_NUM_SENSORS_PER_ZONE 1 +#define MT7622_TS1 0 + #define THERMAL_NAME "mtk-thermal" struct mtk_thermal; @@ -249,6 +255,12 @@ static const int mt2712_adcpnp[MT2712_NUM_SENSORS_PER_ZONE] = { static const int mt2712_mux_values[MT2712_NUM_SENSORS] = { 0, 1, 2, 3 }; +/* MT7622 thermal sensor data */ +static const int mt7622_bank_data[MT7622_NUM_SENSORS] = { MT7622_TS1, }; +static const int mt7622_msr[MT7622_NUM_SENSORS_PER_ZONE] = { TEMP_MSR0, }; +static const int mt7622_adcpnp[MT7622_NUM_SENSORS_PER_ZONE] = { TEMP_ADCPNP0, }; +static const int mt7622_mux_values[MT7622_NUM_SENSORS] = { 0, }; + /** * The MT8173 thermal controller has four banks. Each bank can read up to * four temperature sensors simultaneously. The MT8173 has a total of 5 @@ -336,6 +348,25 @@ static const struct mtk_thermal_data mt2712_thermal_data = { .sensor_mux_values = mt2712_mux_values, }; +/* + * MT7622 have only one sensing point which uses AUXADC Channel 11 for raw data + * access. + */ +static const struct mtk_thermal_data mt7622_thermal_data = { + .auxadc_channel = MT7622_TEMP_AUXADC_CHANNEL, + .num_banks = MT7622_NUM_ZONES, + .num_sensors = MT7622_NUM_SENSORS, + .bank_data = { + { + .num_sensors = 1, + .sensors = mt7622_bank_data, + }, + }, + .msr = mt7622_msr, + .adcpnp = mt7622_adcpnp, + .sensor_mux_values = mt7622_mux_values, +}; + /** * raw_to_mcelsius - convert a raw ADC value to mcelsius * @mt: The thermal controller @@ -638,6 +669,10 @@ static const struct of_device_id mtk_thermal_of_match[] = { { .compatible = "mediatek,mt2712-thermal", .data = (void *)&mt2712_thermal_data, + }, + { + .compatible = "mediatek,mt7622-thermal", + .data = (void *)&mt7622_thermal_data, }, { }, }; -- 2.7.4