From patchwork Fri Jun 16 11:50:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13282688 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5C77DEB64D7 for ; Fri, 16 Jun 2023 11:51:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Date:Message-Id:MIME-Version:Subject:Cc :To:From:References:In-Reply-To:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wDrUMKg0o31dHajHHPlnHEF18RKEkM6V5KniqZZwjnc=; b=Oo3n7CGY5QHnLT /Bbm+4MVh86pPctFNFNE6rtUnAyHw8M9IhRh3unbuJBPmo62umYbqUMsCEtPPn7nXQWbisgC9VdGT 9jCoPz7N/OX+YKDQp1C9cRHpY7CllVb0O1t9DDoyc32nR8RMeOPuV2//CZwmwVywET25pBJV9/43/ y/m0jHfly7GQSGQ3ZxF9k2Zy4vbHlLB3yFoZP76hburhNVi45nMJB38+C5EAN4icZqFPTH06IUmpx e2RhqquHzCVxasDVIpJWAWU3OvhF8yu1N+jypry7IfqJlzHLyxnKhJWgVcLC/GfVebWP+yBuTxWpV mNEOl39S2jivpe0OSroA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qA7yc-000Scw-2l; Fri, 16 Jun 2023 11:50:50 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qA7yX-000Sbq-0T for linux-arm-kernel@lists.infradead.org; Fri, 16 Jun 2023 11:50:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=USThQHd+r+y3fIZdDT3tkPIUoOuMjXqSY6LcqwbJs08=; b=Nr6oo5pwCggvc3nB7cNoOXqCVe RLs7rF7A+zjOX0kqtJVxapS66/IGF9MaO0YtNgktm0kmpeWfSd7/8O4Q0G3i/2oTxBv/AhS4Nhj5H Opz62XtBu3Rbnyrqb8gvMOUb2QU2Ul1CxQinhLjHCCfcRCjFt59x2KLGuRaz82vm4TDcdZ7w/khPm 4EJEXYgYbY+iIasyY+8EOJU51OMMtb4dZ6fvr0TBmXTiYucD684gnk9BN2xxBglkbkqpdSu5en+6A hdTCRgyg0KR7GvBPE/tpvu7vOWU2puIx2RVhJ+G0deau+yQH7Dvey1EaV5hu1/wf/5d0VRVftXwKp 48n6nVjA==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:48894 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qA7yV-0004y7-8W; Fri, 16 Jun 2023 12:50:43 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1qA7yU-00Ea4u-Je; Fri, 16 Jun 2023 12:50:42 +0100 In-Reply-To: References: From: Russell King (Oracle) To: Amit Kucheria , Andrew Lunn , Daniel Lezcano , Gregory Clement , Krzysztof Kozlowski , Miquel Raynal , "Rafael J. Wysocki" , Rob Herring , Sebastian Hesselbarth , Zhang Rui Cc: Josua Mayer , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Subject: [PATCH 2/3] thermal: armada: add support for AP807 thermal data MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Fri, 16 Jun 2023 12:50:42 +0100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230616_045045_183243_94A5861E X-CRM114-Status: GOOD ( 12.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Alex Leibovich Add support for the AP807 die thermal data. This is the same as AP806, except for the coefficients. ap807 values taken from TSENSE_ADC_16FFC spec, which says: T(in Celsius) = T(code)*TSENE_GAIN+TSENE_OFFSET where in default: TSENE_OFFSET = 128.9 TSENE_GAIN = 0.394 Signed-off-by: Alex Leibovich Tested-by: sa_ip-sw-jenkins Reviewed-by: Stefan Chulski Signed-off-by: Russell King (Oracle) Reviewed-by: Miquel Raynal --- drivers/thermal/armada_thermal.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c index 2efc222a379b..f64c2b508542 100644 --- a/drivers/thermal/armada_thermal.c +++ b/drivers/thermal/armada_thermal.c @@ -231,7 +231,7 @@ static void armada380_init(struct platform_device *pdev, regmap_write(priv->syscon, data->syscon_control0_off, reg); } -static void armada_ap806_init(struct platform_device *pdev, +static void armada_ap80x_init(struct platform_device *pdev, struct armada_thermal_priv *priv) { struct armada_thermal_data *data = priv->data; @@ -620,7 +620,7 @@ static const struct armada_thermal_data armada380_data = { }; static const struct armada_thermal_data armada_ap806_data = { - .init = armada_ap806_init, + .init = armada_ap80x_init, .is_valid_bit = BIT(16), .temp_shift = 0, .temp_mask = 0x3ff, @@ -643,6 +643,30 @@ static const struct armada_thermal_data armada_ap806_data = { .cpu_nr = 4, }; +static const struct armada_thermal_data armada_ap807_data = { + .init = armada_ap80x_init, + .is_valid_bit = BIT(16), + .temp_shift = 0, + .temp_mask = 0x3ff, + .thresh_shift = 3, + .hyst_shift = 19, + .hyst_mask = 0x3, + .coef_b = -128900LL, + .coef_m = 394ULL, + .coef_div = 1, + .inverted = true, + .signed_sample = true, + .syscon_control0_off = 0x84, + .syscon_control1_off = 0x88, + .syscon_status_off = 0x8C, + .dfx_irq_cause_off = 0x108, + .dfx_irq_mask_off = 0x10C, + .dfx_overheat_irq = BIT(22), + .dfx_server_irq_mask_off = 0x104, + .dfx_server_irq_en = BIT(1), + .cpu_nr = 4, +}; + static const struct armada_thermal_data armada_cp110_data = { .init = armada_cp110_init, .is_valid_bit = BIT(10), @@ -686,6 +710,10 @@ static const struct of_device_id armada_thermal_id_table[] = { .compatible = "marvell,armada-ap806-thermal", .data = &armada_ap806_data, }, + { + .compatible = "marvell,armada-ap807-thermal", + .data = &armada_ap807_data, + }, { .compatible = "marvell,armada-cp110-thermal", .data = &armada_cp110_data,