From patchwork Fri Apr 22 16:11:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: icenowy@outlook.com X-Patchwork-Id: 12823725 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 E0A84C433F5 for ; Fri, 22 Apr 2022 16:14:31 +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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DMZGcUNTWtZzYGDgS1TuWlVoJ+Lh39qJA8+ekGkBDNk=; b=ftOSGHoUzLgoOb AXW5TqGF1XMRLRZlWVIWC0beGlDr9GbmoAKMq4NE5/OxXjntPSzilEf9YYBBxwf7pdBeKV3dMt4XV fRSPg98AQPg6/VadeI9tpk7S0k8UL/alKCOd3HiaOX9WFyPJ9BCdbYbbS+cWr2uHK3j48OQ4c9ly0 R8KGxMzAWJ79Bp/x4uou7DDWV2rcTXY1X53MoniBaX7NNjKyIATcT6tTAXCutMIjgk3zsbEHKtoC5 2/PvldeGlVnAYBbsOGpPE8sZH4+owGJc2xtGb2jPZYsoEKQR1cHnPnAMfx+XdxCxd0uXokXspgQwa UFVYMskBggEWrA1hCOUQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nhvty-001MC3-8f; Fri, 22 Apr 2022 16:12:58 +0000 Received: from mail-bn8nam12olkn20821.outbound.protection.outlook.com ([2a01:111:f400:fe5b::821] helo=NAM12-BN8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nhvtR-001M2D-6D for linux-arm-kernel@lists.infradead.org; Fri, 22 Apr 2022 16:12:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iR1VQ9HarPAQGINKnH+JY+ZuXMg5uWENxmn8VH9YsHBniirmW8xgcCxET4YBDgQDc86ip8bzESDeuhBpo8SlkgVZl7d++0/2coNINMQs5qVA28dd8CpC2WgzBJ8XKTiOoJ6Y5rTdpBa7OHBahlvm+m0HOLW2mTUqbcbNIgEwFNWdtvjCrKMIERfF8iKhtMSlb7XIuvH5IOfd3AeI/86WKVE38sYjohvyWYF+H2nW+98WR8Xo6myNZYl1DGdogKvWQH0+E4xCvSnFAbxRq+VWNv8fcj0lD2w3sV4CM1wVKy+4WciBquhrj/77s13rg1Ov2GWQHclK2H8nKLaRx0tCew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=yAF2HdcjwCdgr2Kjx5dH8Vy5izGEjjHNh8wXWPDzMX8=; b=bjnSbhjA8Ik5QVoEgMTghqKNEvEl7PM8ejRzOiQZ2FXsdDrig9w2LM9t9X0L3E7pu2Bra6GNAeiqkZdCASJJCZazPS/XaO6Q550LvidvLZ8MzFY/9UVVgRtQC+NAzQwchD36TZechXmjV1Rp/+XjLCRFcic6w5ZhnD0YcPZk89YyA5b2pbHHOhNKGZnP0o1G1tl/uVc5d/rTQAyQz0H0koUOFBTfFFpB/7bYEOI34RI9mplvdqXydb+Sccyw66ME4R7yP49TuJdKlfrqMMCG9qjdXrkHUbtRBYWgJ/5ogo8Odu/LWzFjC2cMOD7EHS4PbbN3o0T6dvw69qvq313TIg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yAF2HdcjwCdgr2Kjx5dH8Vy5izGEjjHNh8wXWPDzMX8=; b=sjo0urha1p/LmfTjCmyp1lwsPfyFYpse2gulcjalwPTzgAJbWxZJUsOK2dzswhocxDvo+fjqyMkU+GLd2XjkJ2S0SrJMzp9AHzy9PmnC/0IChW1Bt8kDJg7CA704BFrPXNn+leUijm5nKrPawwCfm8Jy9sBtxYyNH9efbMDldafO7Qlly88QwxNJpoIVDVImupawj0XVWVwnv9HPzxkl3ISOTtJibgZzKKzV/KUzjV07AHxMAB7s7/u6FB/ZgrlPa12uKPZ65XPDSap0TTbwKMAtobGgj99FVMsZm4MapMs/J0U3bfVZWEnSU4d+8NNiHOYZrLox9hovfeoWRAmJng== Received: from BYAPR20MB2472.namprd20.prod.outlook.com (2603:10b6:a03:155::16) by CH0PR20MB3756.namprd20.prod.outlook.com (2603:10b6:610:dc::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.14; Fri, 22 Apr 2022 16:12:20 +0000 Received: from BYAPR20MB2472.namprd20.prod.outlook.com ([fe80::3480:160a:eb92:d6e3]) by BYAPR20MB2472.namprd20.prod.outlook.com ([fe80::3480:160a:eb92:d6e3%6]) with mapi id 15.20.5186.015; Fri, 22 Apr 2022 16:12:20 +0000 From: icenowy@outlook.com To: Vasily Khoruzhick , Yangtao Li , "Rafael J . Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Rob Herring , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Icenowy Zheng Subject: [PATCH 2/2] thermal: sun8i: add R329 THS Date: Sat, 23 Apr 2022 00:11:56 +0800 Message-ID: X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220422161156.1075227-1-icenowy@outlook.com> References: <20220422161156.1075227-1-icenowy@outlook.com> X-TMN: [WXW8Gh6Z9bVddR2G2K6RciEf6Wd9n7y7] X-ClientProxiedBy: HK0PR01CA0070.apcprd01.prod.exchangelabs.com (2603:1096:203:a6::34) To BYAPR20MB2472.namprd20.prod.outlook.com (2603:10b6:a03:155::16) X-Microsoft-Original-Message-ID: <20220422161156.1075227-2-icenowy@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7522bf6c-8989-4284-9a98-08da247ae073 X-MS-TrafficTypeDiagnostic: CH0PR20MB3756:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NAHSy0aOhD+05ROBRr7bAgh5UG65RCpjH6xECWk/ERIEfLL4GD5OvDtnv4flQTINTbBoLtQoog6qOc9E9nsTvZGdHq1D4A42WKcXUWwzBxU6eXFFJ1m8CEtMSADhN+Bqs/DxAfOhmmwr3XqYDLsF8hBP3IcK1d1y73/MRIfgW7zHrkrFNulN0XrFD8VAWMEsL1o9C72j/xhBGW8VQBfnMg9zSz2cNXnSgwis0WbXShCBbDnEigWMdBAMzZwazmP1xtVWWtiAOS8tBVnW1lgQhM+kQ7usYhJDiJqjwQRinOpUgTKGa5LjRYCz360tzGQLTBZUHL1BwEE+Q1y+i+PYryeCCufPmENz5nko9N/FADNy9BcpQ75qHvJkGnt7si7l1d/605AQ0MTWKhfRDi5z4Qwe4z0ZYzT1OyE8DbWuoAJF7vMKheNhUeQaMPo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BFIEP5wXdp0AVAVJ+EoaNJHFBRq+5q/J9nUuScklK9XWbDGPGTknKUp6v/tWiK85vp0tKgu4rEFqYuoqQFZlyb6DU6S/22/XVtPrIbfZOr7EVF303dyPAD7fMJVtDTzDdTQvHosa64FX8rLjT/6W3R8nppkPug92hPCDJeRQbCPLtm8J/0dOmjq1AIkOlpntx4Jcla8FIBQtrD7weq5wt1vVY/bd52EFxD/M8/XsShPHtyBJvikPntFmK7ojSRMgCIstc2KObN1AXTJnlKl1NLPvcpSs56aQlBo02eNoRk/nAHbwvwOBrYcgFFsXqhuSVJcmPypXHRCumm/xM9ohFWHLNCv/604Ab/kQ9aPHZbALAbwJpeOLfiANvQk0rHOmgIHmG8e9mscBmSOjwIFp922jMbmUP9d1882dEARyxOr+HUoD27h9IxAj6vMjc0US+WuQIa7URHFvbbU3bU7b1ZLYK5blEI+YEWtKRPmCzJcKEuskXAOom5/35stLUsjinsMhKB5sJmAY4NVdt8dUEra64En49c4r8sIUVlJ7HWeEAmlrYaw= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7522bf6c-8989-4284-9a98-08da247ae073 X-MS-Exchange-CrossTenant-AuthSource: BYAPR20MB2472.namprd20.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Apr 2022 16:12:19.9441 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR20MB3756 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220422_091225_312608_28ABE06D X-CRM114-Status: GOOD ( 12.96 ) 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: Icenowy Zheng The thermal sensor controller on R329 is similar to the one on H6, but with only one sensor. Calibration method is still unknown because no calibration is implemented in BSP kernel, neither is it documented in the user manual. Add its support to sun8i-thermal driver. Calibrating it is now prevented. Signed-off-by: Icenowy Zheng --- drivers/thermal/sun8i_thermal.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c index d9cd23cbb671..3a2f381005b4 100644 --- a/drivers/thermal/sun8i_thermal.c +++ b/drivers/thermal/sun8i_thermal.c @@ -312,7 +312,8 @@ static int sun8i_ths_calibrate(struct ths_device *tmdev) goto out; } - tmdev->chip->calibrate(tmdev, caldata, callen); + if (tmdev->chip->calibrate) + tmdev->chip->calibrate(tmdev, caldata, callen); kfree(caldata); out: @@ -628,6 +629,17 @@ static const struct ths_thermal_chip sun50i_h6_ths = { .calc_temp = sun8i_ths_calc_temp, }; +static const struct ths_thermal_chip sun50i_r329_ths = { + .sensor_num = 1, + .has_bus_clk_reset = true, + .offset = 188744, + .scale = 672, + .temp_data_base = SUN50I_H6_THS_TEMP_DATA, + .init = sun50i_h6_thermal_init, + .irq_ack = sun50i_h6_irq_ack, + .calc_temp = sun8i_ths_calc_temp, +}; + static const struct of_device_id of_ths_match[] = { { .compatible = "allwinner,sun8i-a83t-ths", .data = &sun8i_a83t_ths }, { .compatible = "allwinner,sun8i-h3-ths", .data = &sun8i_h3_ths }, @@ -636,6 +648,7 @@ static const struct of_device_id of_ths_match[] = { { .compatible = "allwinner,sun50i-a100-ths", .data = &sun50i_a100_ths }, { .compatible = "allwinner,sun50i-h5-ths", .data = &sun50i_h5_ths }, { .compatible = "allwinner,sun50i-h6-ths", .data = &sun50i_h6_ths }, + { .compatible = "allwinner,sun50i-r329-ths", .data = &sun50i_r329_ths }, { /* sentinel */ }, }; MODULE_DEVICE_TABLE(of, of_ths_match);