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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2B27C4332F for ; Thu, 29 Dec 2022 15:49:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231442AbiL2PtU (ORCPT ); Thu, 29 Dec 2022 10:49:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229996AbiL2PtT (ORCPT ); Thu, 29 Dec 2022 10:49:19 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5596713E26 for ; Thu, 29 Dec 2022 07:49:17 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id bi26-20020a05600c3d9a00b003d3404a89faso11533199wmb.1 for ; Thu, 29 Dec 2022 07:49:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=OcHD+68JKivFTNKn8cO/CBcZZAARu6aqYEBF3jaYXXY=; b=wov4t/Dp6UbuGwqLvgc4vMkRfInBScyFz5VfMRxkFh9qxszC85YMpmSHny1gXPrVsS g32f4reKOVtWQMJ8tXOoxbkRbjZCZ1m5SUTFsEeNVyo3qe4fzbUv7mzyONTfBVWN/ygF VCv0lEJwgaS8OQpQtH1AmoCHEbO8WSsmtXkJwQMKbTVyQhOUnzPNh5aURydy23AIStHq 7IW6dSqOnW/cLTthbtNHuMUuvGcSnsN4MUGA1Z6MgEXnnWMIIXtkOr33tpHLHB4icRu/ EKo8oFJTgXBFfNfzRgvO95/Kqn05D0Qao4eQAzZ4kyo7nkuPJ1BIRmhp7+wC87dbet08 SVKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=OcHD+68JKivFTNKn8cO/CBcZZAARu6aqYEBF3jaYXXY=; b=ceaf/DMmgppXGxNedSv/fLWGp4d4vcJnvnWU6yespys4ahh9JftlEdpGpAc5MMzuTO /NsKMhyTO8zu+zGqnZ4dEeJ5Xx+AT4jKHaC+QbsYxvkz0LX95BYWUqJiPKgf96CwC+Uo rD1TcE/W9uOYo2+O19gXDRSTeeALP6sAOJIymdk+lGvp0kFPCPhO0tuRnrVB766fLLyG pA2PfnyXw1yROJswVVOZTZYgAAX/KsSzD8uliF66idt36MG/yahosR8qFLC5VcRSSJ0W T8nw0AKj9ZX6ScSdlk8awogUcTppXURvJMcjLMW41L90hl8PHjAKdqusoN7lRzl2OHu2 yFlQ== X-Gm-Message-State: AFqh2kpDWFyy2xDlxNhD0zplkIg3cQhoF1wGWmkk8sKs9OBvJQvL2IpI r460quKXyKcEgR+sMQHBPzDGXg== X-Google-Smtp-Source: AMrXdXtGRRh5vsIthQvg5P5kw1KkeD+SE+4wsU583Cr1cJtcHYeGo9tuCyPGsdjApkph9RNzbdVSaQ== X-Received: by 2002:a05:600c:3b02:b0:3c7:18:b339 with SMTP id m2-20020a05600c3b0200b003c70018b339mr25804533wms.37.1672328955770; Thu, 29 Dec 2022 07:49:15 -0800 (PST) Received: from [192.168.10.46] (146725694.box.freepro.com. [130.180.211.218]) by smtp.googlemail.com with ESMTPSA id d10-20020a05600c3aca00b003d34faca949sm24381530wms.39.2022.12.29.07.49.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 29 Dec 2022 07:49:15 -0800 (PST) Message-ID: <0644aede-c281-3919-50e0-4466f6587d81@linaro.org> Date: Thu, 29 Dec 2022 16:49:13 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH v7 4/4] thermal: mediatek: add another get_temp ops for thermal sensors Content-Language: en-US To: Amjad Ouled-Ameur , "Rafael J. Wysocki" , Amit Kucheria , Rob Herring , Krzysztof Kozlowski , Zhang Rui Cc: AngeloGioacchino Del Regno , Fabien Parent , Matthias Brugger , Markus Schneider-Pargmann , linux-pm@vger.kernel.org, Rob Herring , Michael Kao , linux-kernel@vger.kernel.org, Hsin-Yi Wang , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org References: <20221018-up-i350-thermal-bringup-v7-0-ebf08ff2eddb@baylibre.com> <20221018-up-i350-thermal-bringup-v7-4-ebf08ff2eddb@baylibre.com> <4121bb6b-30db-7a23-f4c8-40afdda7a0b5@linaro.org> From: Daniel Lezcano In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org On 06/12/2022 10:18, Amjad Ouled-Ameur wrote: > Hi Daniel, > On Mon Dec 5, 2022 at 8:39 PM CET, Daniel Lezcano wrote: >> >> Hi Amjad, >> >> >> On 05/12/2022 11:41, Amjad Ouled-Ameur wrote: >> >> [ ... ] >> >>>>> @@ -1161,11 +1197,24 @@ static int mtk_thermal_probe(struct platform_device *pdev) >>>>> >>>>> platform_set_drvdata(pdev, mt); >>>>> >>>>> - tzdev = devm_thermal_of_zone_register(&pdev->dev, 0, mt, >>>>> - &mtk_thermal_ops); >>>>> - if (IS_ERR(tzdev)) { >>>>> - ret = PTR_ERR(tzdev); >>>>> - goto err_disable_clk_peri_therm; >>>>> + for (i = 0; i < mt->conf->num_sensors + 1; i++) { >>>>> + tz = devm_kmalloc(&pdev->dev, sizeof(*tz), GFP_KERNEL); >>>>> + if (!tz) >>>>> + return -ENOMEM; >>>>> + >>>>> + tz->mt = mt; >>>>> + tz->id = i; >>>>> + >>>>> + tzdev = devm_thermal_of_zone_register(&pdev->dev, i, tz, (i == 0) ? >>>>> + &mtk_thermal_ops : >>>>> + &mtk_thermal_sensor_ops); >>>> >>>> Here you use again the aggregation >>> I addressed this concern in V6, could you please take a look and let me >>> know what you think [0]. >>> >>> [0]: https://lore.kernel.org/all/5eb0cdc2-e9f9-dd42-bf80-b7dcd8bcc196@baylibre.com/ >> >> May I misunderstanding but AFAICS, this patch is setting the >> mtk_thermal_ops if the sensor id is zero. The get_temp is computing the >> max temperature in this ops which is what we don't want to do. > > Correct, but I think that is out of scope of this patchset, as the current > driver already uses mtk_thermal_ops for sensor 0. The focus of this patchset > is to add support for the other sensors. > > Besides, what do you suggest as a clean implementation if the current one > no longer meets thermal core requirements ? IIUC, there is a sensor per couple of cores. 1 x 2Bigs, 1 x 2Bigs, 1 x 4 Little, right ? If it is the case, then a thermal zone per sensor with the trip points and a cooling device for each of them. The two thermal zones for the big will share the same cooling device. The little thermal zone will have its own cooling device. If there is the GPU, then its own cooling device also with devfreq. >> Linaro.org │ Open source software for ARM SoCs >> >> Follow Linaro: Facebook | >> Twitter | >> Blog > -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog