From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89708C48BD1 for ; Fri, 11 Jun 2021 18:58:41 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 446AD613B8 for ; Fri, 11 Jun 2021 18:58:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 446AD613B8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=gateworks.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8CuXQbIzA2gjVc0ca1/VPvrxF2gI3V50u5YRDN2Tpvw=; b=ZKZkqDxyzS4Sh3 SBUE4oHbgpAKnxG3q9gi7Hf4ztQoPSFdbNzjGjTwXOrkvUgyn/uJQzTrwOLQz9WGZ5jJAfwbQNh42 4Xus7tYuP/DfM4paxdmGldwuceaUwDDFxs7xHWt0JVy3u5+Xz5Pg5lgytWbmQFKRVxod2qf4stoNF fRdyHvsW5y3VNvW3tCqmeP299Z5fLv6VzQwo/9hWch9n4jEGIPmHMahuuoMsqpmKJLQVOWiXYIt61 OFXK/XKwf6/D1RuP13ytQiv88k2nFYt3Ke5GqhRWZpwdGY8c2SplZ9at4gTQESSgYmCTAqikViEL4 h+IfVwKDyTXIs09t0BLA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lrmKY-006XD2-DA; Fri, 11 Jun 2021 18:56:34 +0000 Received: from mail-pl1-f173.google.com ([209.85.214.173]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lrmKU-006XCi-Bv for linux-arm-kernel@lists.infradead.org; Fri, 11 Jun 2021 18:56:31 +0000 Received: by mail-pl1-f173.google.com with SMTP id u18so2662292plc.0 for ; Fri, 11 Jun 2021 11:56:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gateworks-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=aQ0QO0h8aoEGycfmGR0+TIM0LJMpu0pkcrcpKPrPTs8=; b=o92kW98hiYSJapWCq+w+uXr2rKomAWGwu5lEddmV/tnaoJ7jRPd1spC7Az2abOoJhK /Ji99ZmgXJmz3KNUn1CtldZzl3CHvBMjTGUmzqf7fNu2pEsAXch4J/nIKZgsKlM7TFZ0 eqZ71WJhulmIl0F92L85C+6NNfYMMZvmFPm2qgVzxEeeM2bIFoMvAGGbXPqmy/m3AehF nEC4h3Sk4fj3u2WKBO+XD2Ghf3U0k33BWRsWlcx/msIh9UQby8+33a7ixAiOk/trEUmQ 6uGXorNvNV/cyhPQG3ng0hpI4yIgfVCZpJ7XZkyGe9Sp+w+AIAbC2aWNtTrsqkFMrFBm cePA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=aQ0QO0h8aoEGycfmGR0+TIM0LJMpu0pkcrcpKPrPTs8=; b=i2a2tBxjADYFHIQ+U1tKovsanuIy3sOxL+AobPNN16lu0j9fCgdBkLI71OByQeDGow aNC2Em1DHgFBgR8I1XfgMI0T82Cds1wfNotsM0B7LK45V1GfpgVisfBtciGanLPVj8t0 Rvh78EbiLQBa3peQUEu78nmWn5A+6GeHsHzBHbJRRuIFh0h1jm4ZrpZtdHrTT8PAHmA9 i1E3a+yaeV9pTxH6n0QkK2wMa1GFMqZ3fa6bb4uK2IhkmBBifNhcj3TOu1+aJrOwt6dV /CLTxdo28AsxdLnaKNhb6O2xF8uGL6SJlbs04eGLuJERE3VdVVBnQJlwqr8QACu60jvu CMRQ== X-Gm-Message-State: AOAM530WdPLwEp1BkGmR/3ghfH4BHGUy/irCOZCKbubl0zxVucJDOuzy otzacRCW18XhSPQ3lPXR8oh/7UwkpEVCEkVJR4JgnQ== X-Google-Smtp-Source: ABdhPJy7CAd3K4ZYdyXL8F5lowsQYZsXeVHU6EhUe5rTmFq8qT7FHT3TG02781ZGIZ394iapgifFVuKbcdrUR739esA= X-Received: by 2002:a17:903:1241:b029:10f:ff8c:a3fe with SMTP id u1-20020a1709031241b029010fff8ca3femr5166494plh.13.1623437727770; Fri, 11 Jun 2021 11:55:27 -0700 (PDT) MIME-Version: 1.0 References: <20210601174917.1979-1-tharvey@gateworks.com> <5eba4438-239c-71d1-56ec-4edd70e87ec3@kontron.de> <273e2859-7874-e273-9599-139274891023@kontron.de> <717608d8-685a-0435-aaa2-3bd4f82f3b97@kontron.de> In-Reply-To: <717608d8-685a-0435-aaa2-3bd4f82f3b97@kontron.de> From: Tim Harvey Date: Fri, 11 Jun 2021 11:55:16 -0700 Message-ID: Subject: Re: [PATCH 1/4] arm64: dts: imx8mm-venice-gw700x: override thermal cfg for industrial temp To: Frieder Schrempf Cc: Jacky Bai , Rob Herring , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , dl-linux-imx , Device Tree Mailing List , Linux ARM Mailing List X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210611_115630_434057_28521162 X-CRM114-Status: GOOD ( 40.33 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Jun 7, 2021 at 1:34 AM Frieder Schrempf wrote: > > On 07.06.21 10:00, Jacky Bai wrote: > >> Subject: Re: [PATCH 1/4] arm64: dts: imx8mm-venice-gw700x: override > >> thermal cfg for industrial temp > >> > >> On 07.06.21 09:30, Jacky Bai wrote: > >>>> Subject: Re: [PATCH 1/4] arm64: dts: imx8mm-venice-gw700x: override > >>>> thermal cfg for industrial temp > >>>> > >>>> On 04.06.21 17:42, Tim Harvey wrote: > >>>>> On Wed, Jun 2, 2021 at 12:11 AM Frieder Schrempf > >>>>> wrote: > >>>>>> > >>>>>> On 01.06.21 19:49, Tim Harvey wrote: > >>>>>>> Override the default temperature alert/crit for Industrial temp > >>>>>>> IMX8M Mini. > >>>>>>> > >>>>>>> Signed-off-by: Tim Harvey > >>>>>>> --- > >>>>>>> .../boot/dts/freescale/imx8mm-venice-gw700x.dtsi | 12 > >>>> ++++++++++++ > >>>>>>> 1 file changed, 12 insertions(+) > >>>>>>> > >>>>>>> diff --git > >>>>>>> a/arch/arm64/boot/dts/freescale/imx8mm-venice-gw700x.dtsi > >>>>>>> b/arch/arm64/boot/dts/freescale/imx8mm-venice-gw700x.dtsi > >>>>>>> index c769fadbd008..512b76cd7c3b 100644 > >>>>>>> --- a/arch/arm64/boot/dts/freescale/imx8mm-venice-gw700x.dtsi > >>>>>>> +++ b/arch/arm64/boot/dts/freescale/imx8mm-venice-gw700x.dtsi > >>>>>>> @@ -493,3 +493,15 @@ > >>>>>>> >; > >>>>>>> }; > >>>>>>> }; > >>>>>>> + > >>>>>>> +&cpu_alert0 { > >>>>>>> + temperature = <95000>; > >>>>>>> + hysteresis = <2000>; > >>>>>>> + type = "passive"; > >>>>>>> +}; > >>>>>>> + > >>>>>>> +&cpu_crit0 { > >>>>>>> + temperature = <105000>; > >>>>>>> + hysteresis = <2000>; > >>>>>>> + type = "critical"; > >>>>>>> +}; > >>>>>> > >>>>>> As this is not really board-specific, I think the proper way to > >>>>>> handle this for > >>>> all boards is to let the thermal driver read the temperature grading > >>>> from the OTP fuses and set the trip-points accordingly, similar to > >>>> what is done on i.MX6 [1]. > >>>>>> > >>> ... > >>>>> > >>>>> Frieder, > >>>>> > >>>>> Yes, I thought about adding that kind of support to imx8mm_thermal.c > >>>>> but the difference is that imx8mm has alerts defined by dt and imx6 > >>>>> does not so is it right to override dt alerts on imx8m? What if > >>>>> someone designs a board that they specifically want a lower alert > >>>>> than the cpu grade they are using based on something else on the board? > >>>>> > >>>>> My approach to this was to eventually actually adjust the imx8m dt > >>>>> alerts in boot firmware based on some boot firmware setting or > >>>>> specific board support and leave the kernel alone. > >>>> > >>>> Allowing board-specific trip points sounds like a valid request, but > >>>> I still think we need a way to handle the temperature grading in the > >>>> driver if no board-specific trip-points are given. > >>>> > >>>> What if we just set the temperature property in the trip nodes in > >>>> imx8mm.dtsi to zero? The thermal driver would detect this and setup > >>>> the correct values according to the grading. If the dt already > >>>> provides non-zero temperature values (through the board dts) the > >>>> driver will just leave the values and disregard the grading. > >>>> > >>>> I think this solution would be covering all needs. > >>> > >>> I thought to add the grading check in the imx8mm_thermal.c to > >>> dynamically set the trip points temp, but it seems hard to do it due > >>> to the fact of_thermal is used, as no helper API is exported by of_thermal, > >> no better way to override the trip point temp. > >>> > >>> glad to see any good suggestions. > >> > >> Right, the driver doesn't handle the trip-points directly. This is all hidden in the > >> framework. So this might not be so easy to implement. > >> > >> What about this other approach: Adding all the possible trip-points for the > >> different gradings to the SoC-devicetree and then let the thermal driver > >> remove the trip nodes from the dt that are not valid for the detected grading, > >> just before the driver registers the sensor/zone. > > > > It is more reasonable for the firmware/bootloader to handle this by checking the grading. > > If possible, I would rather like to avoid creating another dependency on bootloader/firmware. I think the kernel should be able to detect the grading by itself and adjust its behavior accordingly. We also do this for the speed grading in cpufreq. Frieder and Jacky, I'm ok with dropping this dt patch and instead implementing something in boot firmware that automatically detects and adjusts there. I'm not given the time to work through a more complicated or more elegant solution kernel-only approach for this and handling it in the boot firmware will not break anything or create a dependence from where we currently stand. We already have things in boot firmware that populate mac addresses, mtd partition ids, etc in dt during runtime. Best regards, Tim _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel