From patchwork Mon May 16 19:00:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Francesco Dolcini X-Patchwork-Id: 12851356 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 C7E31C433EF for ; Mon, 16 May 2022 19:01:28 +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: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:In-Reply-To:References: List-Owner; bh=KiaSbD3HItwFTTZNsMdTq6g5gmPejItV8WzUagvn69c=; b=gu/FP4hStml/oB dCeGqBBdgXvGvxMhwrNLsqbzBfwoQwsPXni6z2JtyCU1HmDN1sCHsj69K2xpKVLUyoR6syam1/eTN BuARPxRGI48bZvSMr03ENhk7kwodgzyV3Z9m2aEUe/Ftnkw+1nn/KGJe29NjybnUh9fvjqo1SfumE 8ATMIDWqjCIVmPP4LAmyo2MnDrr13eOgiPI0cxP3+jSXaGmPlrryabUu0f7ece7KX6v/GtNMOvgr8 bRWRi7WGAwuF45a1MbQ1gLrb6cMSfY2xxbvWIlAIvIvmGqJxwj/1tbyE0gzGUenRN73osBlIWX1Q7 w55cqQXu2vs2Ip0CPL6g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nqfwz-009h8d-Ep; Mon, 16 May 2022 19:00:13 +0000 Received: from de-smtp-delivery-63.mimecast.com ([194.104.111.63]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nqfwv-009h5J-Ml for linux-arm-kernel@lists.infradead.org; Mon, 16 May 2022 19:00:11 +0000 Received: from CHE01-ZR0-obe.outbound.protection.outlook.com (mail-zr0che01lp2108.outbound.protection.outlook.com [104.47.22.108]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id de-mta-18-H2utoj4aMT6YV9Y7gFwn4w-2; Mon, 16 May 2022 21:00:05 +0200 X-MC-Unique: H2utoj4aMT6YV9Y7gFwn4w-2 Received: from ZRAP278MB0495.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:2e::8) by ZRAP278MB0548.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:27::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.13; Mon, 16 May 2022 19:00:03 +0000 Received: from ZRAP278MB0495.CHEP278.PROD.OUTLOOK.COM ([fe80::f465:3051:c795:3c2]) by ZRAP278MB0495.CHEP278.PROD.OUTLOOK.COM ([fe80::f465:3051:c795:3c2%9]) with mapi id 15.20.5250.018; Mon, 16 May 2022 19:00:03 +0000 From: Francesco Dolcini To: Daniel Lezcano , l.stach@pengutronix.de, linux-pm@vger.kernel.org CC: Francesco Dolcini , Amit Kucheria , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-arm-kernel@lists.infradead.org, Tim Harvey , Jon Nettleton , "Rafael J . Wysocki" Subject: [PATCH v1] thermal: imx: Make trip point offset configurable Date: Mon, 16 May 2022 21:00:01 +0200 Message-ID: <20220516190001.147919-1-francesco.dolcini@toradex.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: MR1P264CA0149.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:54::15) To ZRAP278MB0495.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:2e::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fdb830fc-4951-4295-be2c-08da376e48ed X-MS-TrafficTypeDiagnostic: ZRAP278MB0548:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0 X-Microsoft-Antispam-Message-Info: 3L8a7sxO+GJQnQLmvZBoEpa4RsUT1eBsxHpVPscs2IxANzgl8CumQLjYc9ObOOtcfbXQhc4GKd6031H51vORxJE7tFSLSAkluPxGUCj6iH+BVOxTVnFezklxzO1TGfUPtl2obcYW1Wyc7MKz5JeU5HKe3iNeaiP+C1jGxKG4gX1nf4uj3yZeOkb5Hah/n6y1B1kgD4+vEABzRXfnfBkckVViep7ApQjmfk4VbT9EwjXbgTpjSZNeZyfPYQUVuOZH0oAGzcj7JkDPFVkz6QuqDuDbwp4UGTx/zIz50yXuBm6vQ34Z0u7Oz3kX6jEuovS2paxsNwFpIxueKCngA040tabq4cUnz+8TvRaDS7gcWuZtiQW+5vV2bQLHCaY5Hjfk48ssOazP22BBhGs7V+wmjZSdUVaDCo2xINhhy6IghMbHNLNd7yiSuYgzQiai7i+far873BbXYPZvitNMYpJMOMNlvSz1JELFWQunBooOW8bB4iWOISZZ1drHRt5QNqUsJtFmANd/33z274lGNabgbMjcvsGbwR5xi6jqkcvtA0spkDR9PONoNA48mFTiM7NWuy5gLRI1KN/RK/N+GdWqXpt6TP7sIMSS7+DDlRAbJtt73kSENZVrZhuD/HVfxfzXkHB9GdIiOb2ulqup3BUuHphtdjUOE61e8EA4uUKWDhC6ce2ilT4LeBE5WIJKF+ZOYtWjIEuBBp7aTsb2YmD9yNcabYXWuYr7w25L6Ap1FoNRn4EW4JCbCOnMyc8+cNq2BOcUaNi3Od96a5UYvB5FHemA0vY1UYxRlAeBS9QqBhI= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:ZRAP278MB0495.CHEP278.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230001)(4636009)(39850400004)(366004)(376002)(346002)(136003)(396003)(4326008)(44832011)(86362001)(83380400001)(66476007)(38100700002)(508600001)(66556008)(966005)(66946007)(52116002)(5660300002)(2906002)(36756003)(1076003)(8676002)(41300700001)(38350700002)(8936002)(54906003)(186003)(2616005)(316002)(6506007)(6486002)(7416002)(6512007)(26005); DIR:OUT; SFP:1102 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: s22sw+ImBaROWhuFS/gPuCjfEG1GkO3YK3rpiSz0QVqMErQQHvEo8BRpiqJt0ThgA7Qhem+n4eSgwabs9oJmGDDelr4RpEVHvgdeRW6e3PnNTTE2/gzg4KvE25NzGQCNIDjZuxWFlVznF0UeXTwUZaj1LyI9Hj5w2DrUw0N2pSczYksFvI/qKVuMCvk/tb8LjJBVDzVXgoHLo9sE0LOI7bNsm2jCfOoNygnTql5wggQ2RYn64tdjq/ASYtalVMbDG4QLj8Hi+ki+/TbK6Gmsacv+rJE8/JjBznS9lekV/3gy98lSri7ukg9UrlWTpQ6trqhLw2QOUXGrvxMsVZaACdKS0qq9K81qgxO4pw95jLy8/TtywyCiYzyqFCnZXtVCUcxo5CKppLQ+zmvZLrtHgDbOS/LGHlkS+RuC9/vlXmxMyioXRKJmR/oh0OczdPMrDfra3XZGgbOsbtWNNJknzA+VKS9yHMH6quzrhTsbm2sVSouAWg4vByGbmkZzb3iFB90IvSroR9SBlCgkNPbX3V1K6Nd4VGJpnq6X/cgp8KhzPHmfiawZAtxH6hUBZfgwmZZ1L8xf4ySoS99HyH6C6N8LsnQkcRJFg9eLhzgHxHKpZv4imVAHD/Y7ojbUXaxnama/oQ1mU3PTxTKAQG6HOBTX+RcD2e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gXiQjL0sALChkK0JtTRDc= X-OriginatorOrg: toradex.com X-MS-Exchange-CrossTenant-Network-Message-Id: fdb830fc-4951-4295-be2c-08da376e48ed X-MS-Exchange-CrossTenant-AuthSource: ZRAP278MB0495.CHEP278.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 May 2022 19:00:03.6753 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d9995866-0d9b-4251-8315-093f062abab4 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ve9BB0eBvapQl3b3xsNAOnjS5Hbs93EJA4dwg4GxrcP+DiEtUM5whD2JjNzu9l7GQ+6jqw49X/GISszc5MmO/MBRrmRp6D41tpQ2a+6tML0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: ZRAP278MB0548 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CDE13A77 smtp.mailfrom=francesco.dolcini@toradex.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: toradex.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220516_120010_068137_709EEF1C X-CRM114-Status: GOOD ( 10.25 ) 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 Currently the imx thermal driver has a hardcoded critical temperature value offset of 5 Celsius degrees from the actual SoC maximum temperature. This affects applications and systems designed to be working on this close to the limit, but yet valid, temperature range. Given that there is no single value that will fit all the use cases make the critical trip point offset from the max temperature configurable using a newly added trip_offset module parameter, passive trip point is set to 5 Celsius degrees less than the critical. By default the system behaves exactly as before. Link: https://lore.kernel.org/all/20220420091300.179753-1-francesco.dolcini@toradex.com/ Signed-off-by: Francesco Dolcini --- drivers/thermal/imx_thermal.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index 16663373b682..42d1f8a3eccb 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c @@ -86,6 +86,10 @@ enum imx_thermal_trip { #define TEMPMON_IMX6SX 2 #define TEMPMON_IMX7D 3 +static int trip_offset = 5; +module_param(trip_offset, int, 0444); +MODULE_PARM_DESC(trip_offset, "Critical trip point offset from CPU max temp in Celsius degrees (default 5)"); + struct thermal_soc_data { u32 version; @@ -504,11 +508,11 @@ static void imx_init_temp_grade(struct platform_device *pdev, u32 ocotp_mem0) } /* - * Set the critical trip point at 5 °C under max - * Set the passive trip point at 10 °C under max (changeable via sysfs) + * Set the critical trip point at 5 °C under max (changeable via module param) + * Set the passive trip point at 5 °C under critical (changeable via sysfs) */ - data->temp_critical = data->temp_max - (1000 * 5); - data->temp_passive = data->temp_max - (1000 * 10); + data->temp_critical = data->temp_max - (1000 * trip_offset); + data->temp_passive = data->temp_critical - (1000 * 5); } static int imx_init_from_tempmon_data(struct platform_device *pdev)