From patchwork Wed Jan 18 03:55:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Golle X-Patchwork-Id: 4143 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2128440wrn; Tue, 17 Jan 2023 19:56:19 -0800 (PST) X-Google-Smtp-Source: AMrXdXsiQv/haT8GRogdoh64OBZU5c+8K4vvDA4mBblxGYZpgEMRLAOfEnTfIKvMTEVMbaKdh1DL X-Received: by 2002:a05:6a20:1456:b0:af:9c75:6699 with SMTP id a22-20020a056a20145600b000af9c756699mr8036929pzi.1.1674014179496; Tue, 17 Jan 2023 19:56:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674014179; cv=none; d=google.com; s=arc-20160816; b=BOKjJWIkamS4Ym9MCIzjcelVkXWRkeP8tK8dp7ynh6Os7bTvpHcU67lsJJQIU7odrP IFm91ydN22cD+U/iE3eIdMqjldZ7gEcF4GdV+JRO6KeMyuus3Udo+JtzATjugaFrqVsM p9nGCG0g3/eZOlwzLUVBYx++PHVFh+JaxGBjuIAMT7od/4whdb7VPFSLxtyzQaRNF1LB rciOy+I38U3ZQ15XpwHA0rPW1xM3qdZbGAqNT2p2os79lRXlFmjQU/nfwLQmsbyriF3X WrfDIt3gl5ux9ngBwr2lKMNo/NnIMZIMPTK4gtJjsuxd9eTU/SNvbVfdFwlw/swDWlan zMtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date; bh=fKlQYrbwarGXd8BnoNbYMw4HckYIZ31+uLtyC9LYpHI=; b=ep43kdIIMTDPpI7V1UkubI9e+LlPFj+VJ68A7Y8VU+VQUUoB0eN+J+/AuGt3gxKO4e e6RBUSpxyMivi/TVxXHXJCE4HBrXeoTfs75qJn+iE/D+MB1GRd5MENmPK8A3NU7l1n94 M5p7DeaqJU8RtdEXJvn/SLRGO/NeyKpjYx1a8aGzEqc2bmy7rj91iJKAygXg8sG8Yzft pIGoCcV3sqWjL71mecR3gVtRmgEf5mwFm5qwcewcIe2UKxgBkYlB0HWZWb5iPcz1ARgq 2/0MiPYHtSDpi63B94FPG3ljtf8y7dAvbv/P5zMj0qUz89oke4a6ZIyK20li/Ve5TIvR c3qw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p24-20020a634f58000000b004ad24b461a1si33741323pgl.283.2023.01.17.19.56.07; Tue, 17 Jan 2023 19:56:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229670AbjARDz1 (ORCPT + 99 others); Tue, 17 Jan 2023 22:55:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229689AbjARDzX (ORCPT ); Tue, 17 Jan 2023 22:55:23 -0500 Received: from fudo.makrotopia.org (fudo.makrotopia.org [IPv6:2a07:2ec0:3002::71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE34453FA2; Tue, 17 Jan 2023 19:55:18 -0800 (PST) Received: from local by fudo.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96) (envelope-from ) id 1pHzXZ-00032D-0e; Wed, 18 Jan 2023 04:55:09 +0100 Date: Wed, 18 Jan 2023 03:55:01 +0000 From: Daniel Golle To: AngeloGioacchino Del Regno , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Matthias Brugger , Rob Herring Cc: Steven Liu , Henry Yen , Chad Monroe , John Crispin , Frank Wunderlich Subject: [PATCH v4 0/2] thermal: mediatek: add support for MT7986 and MT7981 Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755331092526566766?= X-GMAIL-MSGID: =?utf-8?q?1755331092526566766?= As requested in a previous review, first convert the if-else selection of the raw_to_mcelsius_* function to instead use a function pointer added to struct mtk_thermal. Then add thermal support for the MT7986 SoC which can also be used on MT7981. Device Tree bindings have already been merged[1]. When submitting v3, it looked like the patch series submitted by Amjad Ouled-Ameur ("thermal: mediatek: Add support for MT8365 SoC"[2]) which also adds this function pointer would be merged first. However, this a re-spin of this series addressing the comments it has received has not yet been submitted. The change introducing the raw_to_mcelsius function pointer is hence being applied independently. Changes since v2: Rebase on top of pending patch introducing raw_to_mcelsius function pointer. Drop left-over macro extracting the unused adc_oe field. Use switch (...) instead of if-else-if-else-... statements. For now, return -EINVAL as default in case of unknown version. Imho this should be BUG(), as this version is only defined within this driver. Changes since v1: Drop use of adc_oe field in efuse, Henry Yen confirmed its use has been dropped intentionally in MTK SDK as well. [1]: https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//071e99848ccc1fbe238c4c9c7cfffd83f1dfe156 [2]: https://lore.kernel.org/linux-arm-kernel/4121bb6b-30db-7a23-f4c8-40afdda7a0b5@linaro.org/T/ Daniel Golle (2): thermal/drivers/mtk: use function pointer for raw_to_mcelsius thermal: mediatek: add support for MT7986 and MT7981 drivers/thermal/mtk_thermal.c | 150 +++++++++++++++++++++++++++++++--- 1 file changed, 140 insertions(+), 10 deletions(-)