From patchwork Wed Jan 18 15:40:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Golle X-Patchwork-Id: 4183 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2408724wrn; Wed, 18 Jan 2023 07:46:44 -0800 (PST) X-Google-Smtp-Source: AMrXdXvqK5NuvMVWMpw4wuZuHAMwAOfn0J3sR898KvZpBtglOEjpg3E1+iWPeLG+ILNmYcdFTAod X-Received: by 2002:a05:6402:4002:b0:479:8313:2fdd with SMTP id d2-20020a056402400200b0047983132fddmr9227655eda.10.1674056804855; Wed, 18 Jan 2023 07:46:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674056804; cv=none; d=google.com; s=arc-20160816; b=WGz06JnlijMgneuY8Cih+0iTB+6qKeFytvuwCATBS1/TACspl7DlgM3BvlqZyRfsh1 O6W0oYJ1RUSZxR+SABot9a4j0Kg/5hCuHGHahEEwCIeUJ+BYYOa9Hp+ufiiwHh5wY0qj YZGNJ1zMMCnVlNRIR2vD9u+RbAMsvQwo5N0x6XES6DMhLucmes5d2joZUhaX8n0tGLjq E5xI2/xzhANw0oqlqR1vjTjOSbJXm6qUr9BbOJEqPoMKp4zv9AMDeVdaVVMpgccBLPGv sJGnj/+/Ocaad7MvCijnZWoPvyAvD+Bd2QNedVouWLHAomAAiZ9LDZPDSbSf1oVW/kDq Bs2A== 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=d5E+3PKlxbfGjEEZmC5WyTIcXVJieqdeCZUgJSSU6Ac=; b=IjwnYXUesnRvoO6Zt/uhaKyTlnNh9l2UjWzj52nwdXWy0gkBJWrSmunRtPmC4ZxDSG DoLVuSJNM7mPDabNrJX57G+pI7Aocm6vrs1sGH8PO9Efbk7N+8OkioxBuFSFobNuoIX/ LGKFxwejz91hG3uoMwyzM5UZUI6tLukEhzQ5uyI8JvBmTCm/u9MY6NUxcRRVOMRqUTnm dqDEpUlCKHtU2n35iVXIxPP9oUQmfZeQ3nBLPSKuLbCXQazADHmrKQglOlbjZROSMeGO 7aTAAP9RYJEGM6Y6plSHfm75cteoYTQ/j3uW9xBI4bqSvtFXpsqbLlDlgS9yVyxdI+rD YFHg== 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 y15-20020a056402358f00b0049df78b34efsi14661846edc.57.2023.01.18.07.46.20; Wed, 18 Jan 2023 07:46:44 -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 S229789AbjARPkm (ORCPT + 99 others); Wed, 18 Jan 2023 10:40:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229994AbjARPki (ORCPT ); Wed, 18 Jan 2023 10:40:38 -0500 Received: from fudo.makrotopia.org (fudo.makrotopia.org [IPv6:2a07:2ec0:3002::71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEE6310DE; Wed, 18 Jan 2023 07:40:36 -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 1pIAY6-0007gG-1J; Wed, 18 Jan 2023 16:40:26 +0100 Date: Wed, 18 Jan 2023 15:40:19 +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 Subject: [PATCH v5 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?1755375737046281800?= X-GMAIL-MSGID: =?utf-8?q?1755375788034937440?= 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]. Changes since v4: Only use switch statement where requested[2] and keep if-else logic in other places. When submitting v3, it looked like the patch series submitted by Amjad Ouled-Ameur ("thermal: mediatek: Add support for MT8365 SoC"[3]) which also adds this function pointer would be merged first. However, 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/commit/?h=thermal/bleeding-edge&id=071e99848ccc1fbe238c4c9c7cfffd83f1dfe156 [2]: https://lore.kernel.org/lkml/0b72a12c-286f-79d0-09e9-b1761530850a@collabora.com/ [3]: 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 | 143 +++++++++++++++++++++++++++++++--- 1 file changed, 133 insertions(+), 10 deletions(-) base-commit: 9ce08dd7ea24253aac5fd2519f9aea27dfb390c9