From patchwork Tue Jul 19 05:49:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 12922133 X-Patchwork-Delegate: daniel.lezcano@linaro.org 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 6F23BC43334 for ; Tue, 19 Jul 2022 05:49:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236924AbiGSFtq (ORCPT ); Tue, 19 Jul 2022 01:49:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236925AbiGSFtp (ORCPT ); Tue, 19 Jul 2022 01:49:45 -0400 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C26D30F50 for ; Mon, 18 Jul 2022 22:49:44 -0700 (PDT) Received: by mail-lf1-x132.google.com with SMTP id u19so14169461lfs.0 for ; Mon, 18 Jul 2022 22:49:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=EV7J2evjbv3FZUZN1eeFth4oNvs49+wln9t6xNZ58P4=; b=BVePoaWkGV7zZKFou3iA9JV9G1g1TzYhf2PN1ioevNsOvkF+DwdLQdWbZbHLzDd31w Fl1hcDZi15cFUVjMl8CD1d+oMSf7W9T0Ly86gs35Nzps5xuqvn1k2D0yJ/TytoNnbZGO 9qLR0Rmn6V3PQTbYroplo0aY53Fzhbv2EtdmrCWr2JLx3eOlHEEe3LJjrjgeEn++khy0 z2AMYIJEhCxZgCD1lpS51rGnBXdkH0XsXyfe2m1gU16ExC9njyGzQqESF6ex/Bzm1JmI 1XO+pDMJ7Hhe/7QXfmznMJhUNLYXeKgo/3OyEvsmTyr4agBe0FCsXsyGHlIYQFRL+XkC HglA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=EV7J2evjbv3FZUZN1eeFth4oNvs49+wln9t6xNZ58P4=; b=75oDUP5cLMR9qRq5Wp0g2lBGZVK7WvDUaW5FolCqPsnlvCQOEcMPbjLpAZyfjPIOOl It2ad/yLPcgKnPZpR2S0pdJ8wA66D1c5nlHpmhBs3ZrPdA6PWgnqCXMpxnI1GSc7RsoW tBWzp2d6+6BRE1Hi927srQKIZ2tdAuEAHmrmRMvCfjsIizsjvqUWPW3swvaBIenP/tiJ CiK6mQjl+rbKPkO4/KDyWpiim2tnQ/Tjv/1i/JFZPuHwEZ9nfNm1pdDsAzbns8fIx94p iawSjMHSPJ5v137L7yIFg1U7YYBTesyPz3PI5VyEc9u1sj4fUVwSJ8rEWiFHRSOptZTQ bKEQ== X-Gm-Message-State: AJIora/YOlU5a6OIG8XpAGfrn2F52c+dmvawoJOn87ZPl/JcolIcxbkD gQxXrFZSnLT+Fkc9W6RauTNxPg== X-Google-Smtp-Source: AGRyM1s50HLvXHw1o/rk7nFQkMWxClg3l9vwg65DaAkfly0jvgRlJkvYI3Gdo8qek7W02gBo68lTDg== X-Received: by 2002:ac2:51a6:0:b0:489:c578:cf75 with SMTP id f6-20020ac251a6000000b00489c578cf75mr15931550lfk.24.1658209782349; Mon, 18 Jul 2022 22:49:42 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id s10-20020a195e0a000000b0048137a6486bsm3005120lfb.228.2022.07.18.22.49.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 22:49:41 -0700 (PDT) From: Dmitry Baryshkov To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Amit Kucheria , Thara Gopinath , "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui Cc: linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH 1/2] thermal/drivers/qcom/temp-alarm: register thermal zones as hwmon sensors Date: Tue, 19 Jul 2022 08:49:39 +0300 Message-Id: <20220719054940.755907-1-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Register thermal zones as hwmon sensors to let userspace read temperatures using standard hwmon interface. Signed-off-by: Dmitry Baryshkov Reviewed-by: Bhupesh Sharma --- drivers/thermal/qcom/qcom-spmi-temp-alarm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c index 7419e196dbb0..770f82cc9bca 100644 --- a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c +++ b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c @@ -16,6 +16,7 @@ #include #include "../thermal_core.h" +#include "../thermal_hwmon.h" #define QPNP_TM_REG_DIG_MAJOR 0x01 #define QPNP_TM_REG_TYPE 0x04 @@ -458,6 +459,10 @@ static int qpnp_tm_probe(struct platform_device *pdev) return ret; } + if (devm_thermal_add_hwmon_sysfs(chip->tz_dev)) + dev_warn(&pdev->dev, + "Failed to add hwmon sysfs attributes\n"); + ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, qpnp_tm_isr, IRQF_ONESHOT, node->name, chip); if (ret < 0) From patchwork Tue Jul 19 05:49:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 12922134 X-Patchwork-Delegate: daniel.lezcano@linaro.org 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 E211CCCA483 for ; Tue, 19 Jul 2022 05:49:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236925AbiGSFtr (ORCPT ); Tue, 19 Jul 2022 01:49:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236929AbiGSFtq (ORCPT ); Tue, 19 Jul 2022 01:49:46 -0400 Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E88F730545 for ; Mon, 18 Jul 2022 22:49:44 -0700 (PDT) Received: by mail-lj1-x231.google.com with SMTP id q7so16126958lji.12 for ; Mon, 18 Jul 2022 22:49:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Lu2f/RUqKmEFqPL/kDzBfQuqWdQ8J2yKeAq9MQAfieU=; b=M+S6gAxBuGjDweoZMIsYt4GfCowiYbKNqewdpDkPVHCOXDlmPT4FqWA0kXgTfEsSxG m0MDdI53C+TLNeee3g0a/W0dDXGwUYu8Ckhwdk1ST07Ilp6E5x+8UXqtD0h5wu3u2r/b jhXDbBK9AbwxPHzDvD3bmRt34iw5CJfK7Af/jXzsZwpgBGeBae6Hqp2dkTuJ/lgkUOiU 4H9JE8FDw8C0a1dQosPPiNKvh4yR9c0998IMF0B9Vo4VHHuEQiWPJreFdxymO9aEtfyQ qsqkj0eRc9Yq2rAjVs1reBUKwA1RM0W1uqWdSgDovHq3QhkSud2lMWefxVHpGqNnj/at A1JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Lu2f/RUqKmEFqPL/kDzBfQuqWdQ8J2yKeAq9MQAfieU=; b=3XWC0SLo/sLCVtEsmiDHMucNrsziIWfVJPfoaeC0RnjB/N6MV61x8mOhiumSyGn6/r tNqKDXpw7NqMk46FtZegUAemLCCrYDSRodKoWR4skgWpljqgZ6pZqGdhbrqiRUBv3fEb gsRx97r+jUbAhuOT0CXXVkI6c8pJg7Oqm1juouWwJi5qmmZqrs3ap59zZ+6Yxh1mE30+ tHZdHMwnEsbKyNyDOScBcMBBFQEgw3Fycx4eDJg7ogS2qKhoyXkvTwRW2FQ0KXkPn8YB uHthtobQwXHlTmO+z/xXcFV3Cg9XSANxFDidAWJe1Zc5XYaVMC7gYpcsAqyrHiupWU7T shtA== X-Gm-Message-State: AJIora//A7S3PIxnjp7LLEu2nyqpqHZZUXZ/s0EY4FceFriBjezt8+Ds oHmR/nvM7784Icjb5oqKZ78z9Q== X-Google-Smtp-Source: AGRyM1si3O6JCpnUTqZjjBq5+e6I5A/DPpxxJDSNQS8ULgxtmDWyueUN0DxTmhjEWeqKDvUzRDhUAQ== X-Received: by 2002:a2e:9095:0:b0:25d:643a:28dd with SMTP id l21-20020a2e9095000000b0025d643a28ddmr14510584ljg.322.1658209783306; Mon, 18 Jul 2022 22:49:43 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id s10-20020a195e0a000000b0048137a6486bsm3005120lfb.228.2022.07.18.22.49.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 22:49:42 -0700 (PDT) From: Dmitry Baryshkov To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Amit Kucheria , Thara Gopinath , "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui Cc: linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH 2/2] thermal/drivers/qcom/spmi-adc-tm5: register thermal zones as hwmon sensors Date: Tue, 19 Jul 2022 08:49:40 +0300 Message-Id: <20220719054940.755907-2-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220719054940.755907-1-dmitry.baryshkov@linaro.org> References: <20220719054940.755907-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Register thermal zones as hwmon sensors to let userspace read temperatures using standard hwmon interface. Signed-off-by: Dmitry Baryshkov Reviewed-by: Bhupesh Sharma --- drivers/thermal/qcom/qcom-spmi-adc-tm5.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c index d9c9c975f931..073943cbcc2b 100644 --- a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c +++ b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c @@ -20,6 +20,8 @@ #include #include +#include "../thermal_hwmon.h" + /* * Thermal monitoring block consists of 8 (ADC_TM5_NUM_CHANNELS) channels. Each * channel is programmed to use one of ADC channels for voltage comparison. @@ -687,6 +689,9 @@ static int adc_tm5_register_tzd(struct adc_tm5_chip *adc_tm) return PTR_ERR(tzd); } adc_tm->channels[i].tzd = tzd; + if (devm_thermal_add_hwmon_sysfs(tzd)) + dev_warn(adc_tm->dev, + "Failed to add hwmon sysfs attributes\n"); } return 0;