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 D4876C00A5A for ; Thu, 19 Jan 2023 17:03:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230431AbjASRDS (ORCPT ); Thu, 19 Jan 2023 12:03:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230113AbjASRDR (ORCPT ); Thu, 19 Jan 2023 12:03:17 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51B5749429 for ; Thu, 19 Jan 2023 09:03:15 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id d4-20020a05600c3ac400b003db1de2aef0so1753820wms.2 for ; Thu, 19 Jan 2023 09:03:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=xoDg7X6k/SjUQcyWVxb++knJQou/HfRjq27D3pK1OL0=; b=1hrdE6EhVZapN/amnndIOVoCyNf2PV5AUtAzDtKRv2WE7dv+4JYyd12hJtZZmEQfNg 3unnzAFt3Ei2XSXRQ/382g6ej48VXzNYBSocOMr2bvg3dUc9WGRZhEkCDD8OjAxdeFDS j/hEXC0lom9dHs+G9YMstoUY1PzRiX4Gq9UniA38h1YFkA4N6cDzUHMgV/ta21+W7iqA sYtJ5hc5jHIH69AI267vdjXQH8ttU24qNCX6UVpI5JojnLTa9HdfJoK1VbvfIHs4aHVA 1LUXsoBE/oGphFk0PGffJ/ThRyFprXILexDcb91ZNqkjorykOr6X1SKXSKRMuSuEvh8A 5AAg== 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:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xoDg7X6k/SjUQcyWVxb++knJQou/HfRjq27D3pK1OL0=; b=FbDajjXKoBb5J3pKbHsQ2CCbZdvCpn0zRnfprBZXCRLpwRoy8VTInvnzOwXaTk9t9s jJ5uj5cL9lILkmvaVX8SyGym6Joconz5HJ8FQy9RAFB7qcikOKZI/XBzSBnXQKqoQT6I vQ4BVEC1imAN5bCZp0LicYEJABQ4kkMYHf3u58eHzYMNa5ekV8R6FNhLMS+g6r7N0ze4 nIHi1qiIcLAOD5a+W9s3kqCb2NC31nzXBUlvj6D9KqWpXtoeu9GkY1t7OwvAdqeSvV38 7jwbsoDKowRrHi4Hrrk1Aax+ir6TMHQ/zQU4GXkVZFiIAbwh4GAYKjbwyhkfYEICD8hJ ybjA== X-Gm-Message-State: AFqh2kpZmBQoUg6Wg42ipOOP0K4G5PsSFjY0l/7Bsprm6H1k2tvjuwpx kyQpAho2StTGBP7QYKcZcCWKSQ== X-Google-Smtp-Source: AMrXdXvVqir7OAh4deRHUpeRJymXdvbDE5Wl8w9DSxpLlPsa1In7nF1ob0+NOI0SLMtg6L6CnI5eQg== X-Received: by 2002:a05:600c:1d8e:b0:3d9:f9ef:3d23 with SMTP id p14-20020a05600c1d8e00b003d9f9ef3d23mr11316499wms.23.1674147793846; Thu, 19 Jan 2023 09:03:13 -0800 (PST) Received: from [10.8.2.10] ([195.200.221.42]) by smtp.gmail.com with ESMTPSA id g10-20020a05600c4eca00b003a3442f1229sm6193662wmq.29.2023.01.19.09.03.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 19 Jan 2023 09:03:10 -0800 (PST) Message-ID: <187b0fe1-1f14-d8b8-c827-1e824da0b1d3@baylibre.com> Date: Thu, 19 Jan 2023 18:03:07 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.0 Subject: Re: [PATCH v7 4/4] thermal: mediatek: add another get_temp ops for thermal sensors To: Daniel Lezcano , "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> <0644aede-c281-3919-50e0-4466f6587d81@linaro.org> Content-Language: en-US From: Amjad Ouled-Ameur In-Reply-To: <0644aede-c281-3919-50e0-4466f6587d81@linaro.org> 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 Hi Daniel, On 12/29/22 16:49, Daniel Lezcano wrote: > 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 ? MT8365 SoC has 4 x A53 CPUs. The SoC has 4 thermal zones per sensor. Thermal zone 0 corresponds to all 4 x A53 CPUs, the other thermal zones (1, 2 and 3) has nothing to do with CPUs. The cooling device type used for CPUs is passive. FYI, thermal zones 1, 2 and 3 are present in the SoC for debug-purpose only, they are not supposed to be used for production. Regards, Amjad > > 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 >> >