From patchwork Tue Jun 13 09:30:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 107231 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp425070vqr; Tue, 13 Jun 2023 03:01:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7t4hPBKcF0SU8DCNxM5BUgdVKzV2qwlAU+smbHYdAfch4buUgMZju7jeKX9JDkAEVwFQSA X-Received: by 2002:a17:907:98d:b0:957:1df0:9cbf with SMTP id bf13-20020a170907098d00b009571df09cbfmr11308347ejc.19.1686650508237; Tue, 13 Jun 2023 03:01:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686650508; cv=none; d=google.com; s=arc-20160816; b=Zaq6Pq7rCe317BGJKhol5WuylO8bsqwI7Tpgg2L7OAGz3w1fS5M/rfC9XoirmTb7tp TUzJBoahNaayCeON2hq02JdywqG2uTIVF262FBzSp5FGUdR2ejhI0XmZJJY7BxS9//9V Ccf2S43oVxgG3LifKNux+7tJToHaDSUZ57CBhfDDenlT5APDH4bFYYDbYELCxlb7UDqw CkjLPabxLqzBqWaIOWXIkV11unLczoaIAmKu/S+JaXOJcw1CYiEsLYrmiLpWr38+a8hd rimUPkKLNI6ppHnDnvqK+tIxih4RqdXs0xQb9WgiKLug1D5MWsXuRhBdLKw7pYUcyOAr Qdtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Gc080pZonONkhSsubLG/knzeXyUNBhLK5ILmHhWW6gY=; b=ke/Skg5Ifq+t7u4r42Pwse1vqXl4zYVDbA1txKVawp2tjwg9jY3r+mS9i+RzvEQTwt /wSz535PSp/bRnod0fQtAnWEbK/kD2Uk3BBULOqdauD8XcN1leM1J4HEhgBAGR6dZf2t P/WHPx1deU6NdXqL/9dgoOtaFi3R3lS22u5Xlzx5GkWQ9Bvycteq+Q9g0dvnfSIo8zy0 2RdJTOhuS1n6I6+OqPs1JgYJJEM0Si86fDSSy6QCJGwNeLvXois7EeF5quwQhNrscZCV rrO8IDj/IH/OiBSTtZnV4aLneU+JXr1rAZ+R1vGj9pjmF0rVH7w4TdVjKfaqntPJ9k/e D8yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="F5lwH/cp"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dk16-20020a170906f0d000b0096a2eba9b0fsi6424229ejb.174.2023.06.13.03.01.13; Tue, 13 Jun 2023 03:01:48 -0700 (PDT) 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; dkim=pass header.i=@chromium.org header.s=google header.b="F5lwH/cp"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240605AbjFMJbQ (ORCPT + 99 others); Tue, 13 Jun 2023 05:31:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233715AbjFMJbN (ORCPT ); Tue, 13 Jun 2023 05:31:13 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53A0618E for ; Tue, 13 Jun 2023 02:31:11 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-650352b89f6so4053501b3a.0 for ; Tue, 13 Jun 2023 02:31:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1686648671; x=1689240671; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Gc080pZonONkhSsubLG/knzeXyUNBhLK5ILmHhWW6gY=; b=F5lwH/cp1FKK1VmvuKHlk391kR8oaI/Gw53UTVgdZp4Bvu5DWRhyYKwbhIxte7QsXo aTcMjBXzirBtr5LzsxRvjqXnou8A4EvWuAx0Ja+JVeLThbN63hlwoXfUnnl/PX7XnIZf pn9NbU31FXmX9FA0w1O/4zA0Y8vTxsnMH9MSo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686648671; x=1689240671; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Gc080pZonONkhSsubLG/knzeXyUNBhLK5ILmHhWW6gY=; b=CrMoBhjT+UTZx19yvxeGE+06zFmq4xCCWLQLckZWCk0dvz6BB7UQ9kbndBvoOiC+KG RPL5T04XIHFi7Pkg6Bv+T50uHV6LEcug87BvHDoQhEVW8vFCJbKWubVAOO2HZYN9TSDA WIa/UuFebGrwNIgBn3FNsXY2z6P9Umr9sFUPkqmN5VYBMlTykPL0GdSY262YhBqckkZc A4r819Gh0G5JW/zn06Ck0lp7jOagaS0iYFPc4eepGAclvO/+t1JEUo9qbgfCwglcsBsG ChviWdnTG9oxVoOd5+SJQFlxhm9HQNgRzbRTJlmMpeN7/JGDbItdlCNa1TJGEOs9605n mqng== X-Gm-Message-State: AC+VfDwiYUNpMEJHbUGVhkDRe66PwGet3+uN/KKUhs9KWgx+nMTaHdvw 0jOd2lojDy3Qk5f4NSi1Z+WKEA== X-Received: by 2002:a05:6a21:99aa:b0:114:6f3c:4332 with SMTP id ve42-20020a056a2199aa00b001146f3c4332mr13451371pzb.24.1686648670764; Tue, 13 Jun 2023 02:31:10 -0700 (PDT) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:2d00:6d98:ebb3:585]) by smtp.gmail.com with ESMTPSA id d5-20020a170902c18500b001b3df3ae3f8sm2160680pld.281.2023.06.13.02.31.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jun 2023 02:31:10 -0700 (PDT) From: Chen-Yu Tsai To: "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui Cc: Chen-Yu Tsai , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, AngeloGioacchino Del Regno Subject: [PATCH] thermal/drivers/generic-adc: Register thermal zones as hwmon sensors Date: Tue, 13 Jun 2023 17:30:52 +0800 Message-ID: <20230613093054.2067340-1-wenst@chromium.org> X-Mailer: git-send-email 2.41.0.162.gfafddb0af9-goog MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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?1768580564950695652?= X-GMAIL-MSGID: =?utf-8?q?1768581242996053667?= Register thermal zones as hwmon sensors to let userspace read temperatures using standard hwmon interface. Signed-off-by: Chen-Yu Tsai --- drivers/thermal/thermal-generic-adc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/thermal/thermal-generic-adc.c b/drivers/thermal/thermal-generic-adc.c index 017b0ce52122..e95dc354f192 100644 --- a/drivers/thermal/thermal-generic-adc.c +++ b/drivers/thermal/thermal-generic-adc.c @@ -13,6 +13,8 @@ #include #include +#include "thermal_hwmon.h" + struct gadc_thermal_info { struct device *dev; struct thermal_zone_device *tz_dev; @@ -153,6 +155,12 @@ static int gadc_thermal_probe(struct platform_device *pdev) return ret; } + ret = devm_thermal_add_hwmon_sysfs(&pdev->dev, gti->tz_dev); + if (ret) { + dev_err(&pdev->dev, "Failed to add hwmon sysfs attributes\n"); + return ret; + } + return 0; }