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 E75BFC4708D for ; Mon, 26 Dec 2022 10:27:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231789AbiLZK1j (ORCPT ); Mon, 26 Dec 2022 05:27:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229597AbiLZK1j (ORCPT ); Mon, 26 Dec 2022 05:27:39 -0500 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C75891113 for ; Mon, 26 Dec 2022 02:27:36 -0800 (PST) Received: by mail-wm1-x330.google.com with SMTP id g25-20020a7bc4d9000000b003d97c8d4941so1510722wmk.4 for ; Mon, 26 Dec 2022 02:27:36 -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:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=KALJq/V5r25unN7gpBUsW9CyIRW7TsaG7eOK1RtrxG4=; b=XzoOX9nL0mKaY5BM2p/ifqJKZH4E/8KMeSnguCGzpxWpEBvgYTmiK+K1kVTtCCt5ux OyeIMNGwB/MHMmzj4+0bTPPRaXqZJYUtFh8+g3Int9c4AnhoS6LOwB4zNkd40tvX2IFm D07fTPm/juu0sQOmHMoKo96EpBDk9YKJJTvnEa6MUGtyvlTJMFtHsV2ezn3fhkfhVAEv uQwMrri1uBw4vqyHiz5Mn38wOqmP/b8UtUC0vynz3Y5gGeG9nVIScx+Zy+rAMPzDeu3e /FQ4P4KDt9S1O2HqkspgszzZSn5be/Vush6RLNcG+RoOwUGv9MPa0k9fB79P+aPZSb6W aZ3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KALJq/V5r25unN7gpBUsW9CyIRW7TsaG7eOK1RtrxG4=; b=EBbbUyRxKrm2hvtY9pj5AdDr0+7Sdiry4F26wHzuvhzQ1oeJjfn1jFg2azu7Nvx6JJ /qhfF5f7kL3WwvXNJRr81lV7GLWo1TJx9fNeK6qmck+LJEDEv54mGkx9xe5bqGQhxnqs /V30aokMcTl/trZqaPXNwuwf0DAOZ0Kt+BlCLHhaPOfm2Yr/buz3yYsSNyxfXplUpoH4 GirvaLzvgJNaCXyKKVC+961o5QwQq6lIGQHgQwSauBtKwdReGw8jxcAwCIJ1qDgy9icJ 3KFqbKR+XcFTQOrL9COrdxedqDxMxhmZ9h3WLk7wnk9y/JqiQqHJEywQ+ZoXwesXSLzS ml3w== X-Gm-Message-State: AFqh2kr7rH1/r1Mxnmg7u66I7q3YEvd3Z7pms/oYcE98nSUyrVBkUNCp cBEH7u+gJODoD0wEbTqKiCNwUA== X-Google-Smtp-Source: AMrXdXvPOLaWe2a9phpQit63w0mHUGY18F/dL/xLYS/XbGC0BC2+uZqL8drVpMoEOVKN6hV2HSTLSQ== X-Received: by 2002:a05:600c:3209:b0:3cf:5fd2:87a0 with SMTP id r9-20020a05600c320900b003cf5fd287a0mr12566712wmp.40.1672050455288; Mon, 26 Dec 2022 02:27:35 -0800 (PST) Received: from [192.168.0.20] (117.215.132.195.rev.sfr.net. [195.132.215.117]) by smtp.gmail.com with ESMTPSA id l17-20020adfe9d1000000b0024165454262sm9841286wrn.11.2022.12.26.02.27.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 26 Dec 2022 02:27:34 -0800 (PST) Message-ID: Date: Mon, 26 Dec 2022 11:27:33 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH v7 4/4] thermal: mediatek: add another get_temp ops for thermal sensors From: Amjad Ouled-Ameur To: Daniel Lezcano 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> Content-Language: en-US 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 Hi Daniel, On 12/6/22 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 ? Could you please address this ? Kindly, Amjad > Regards, > Amjad >> >> -- >> Linaro.org │ Open source software for ARM SoCs >> >> Follow Linaro: Facebook | >> Twitter | >> Blog