From patchwork Fri Apr 1 15:13:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Massimiliano Minella X-Patchwork-Id: 12798443 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 63D7BC433FE for ; Fri, 1 Apr 2022 15:45:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345236AbiDAPq6 (ORCPT ); Fri, 1 Apr 2022 11:46:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351322AbiDAPom (ORCPT ); Fri, 1 Apr 2022 11:44:42 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B254A103BAF for ; Fri, 1 Apr 2022 08:19:07 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id bi13-20020a05600c3d8d00b0038c2c33d8f3so3703429wmb.4 for ; Fri, 01 Apr 2022 08:19:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=1NdprsVhjM+s7BsGf7u7DDEuZ12Z3WnLtb7OSPBuoMg=; b=ZUGfuwiDrHqDp/g+ojAICJE50HXT1l3XtK+fv1OSahrfDPU2Zt2RQYWbq8A0w2lJNL +sFt75rhKvamqqTn9JSXBy0AGr/bXt6MctiPhJE1UJpI7289KVTr2PVoYbQ1V/AEfN6s RWU4nOaG50fRhtQkLcZtGcNb/OQh3z/WgWnwOtaZ6O4bJ9MtGgjhNu0gAUFFpLH9gNKj HBijFXOL8QbQrLkRQ6xHoo5k7D8l/qN8bLf0nDmLeAFQ7L5oxEksIWIhLNI5+xGC4Uzj sKMDrryt7KtIUF5W469O6wmCAiK9Cz9jj7iqxJIWCt7nnmxjsGOvS0UUDP8qQlgqF33a ZsbQ== 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=1NdprsVhjM+s7BsGf7u7DDEuZ12Z3WnLtb7OSPBuoMg=; b=yzlXP1GaeeVfZQjGUKtwMCfSxvLTrVRfitvHcxl99ELwtxwFzxABmiwESsCUfBqyBN A6yCIgAsJghxRNkcPUQlTIX7JeFyrneWDQeu+kH4c9TkVkn+6nhgcQewoawwQiJkFJGl hb1fJGdO7xXRpgunC1xnPFYTZw+7nMKLOX7JVtoHAA5rhjLe6JG7f7PdunRA2izpwTxb Id0ZqAZaG29ulIBhjPT+lkoR04c2KJBL39Q7oIuAgkRImTGUtis+0fSZIo0D/wZp5QkF f1jduPgfUWBtdvKX+6wUiyBHcugBO2uYFgAe9TJr7UMkjizvhOP0gdtNsP/msnzH6HTt kpSw== X-Gm-Message-State: AOAM5334ddp0XdORWOs91PRPxeWPKHReDb5OMmniIgZQjwy58sqq0n9a Zo1pKdigLn8UrlvfkdOGe0E= X-Google-Smtp-Source: ABdhPJxWdEWV/WBcQuJBXwUksy9heBFiyV/941WD4rUO4S72+XqTeSc9/wX+CbzvXnE6ozc/uQQqNA== X-Received: by 2002:a05:600c:4408:b0:388:a042:344f with SMTP id u8-20020a05600c440800b00388a042344fmr9024136wmn.52.1648826345742; Fri, 01 Apr 2022 08:19:05 -0700 (PDT) Received: from localhost.localdomain ([37.164.133.248]) by smtp.gmail.com with ESMTPSA id g6-20020a5d5406000000b001f049726044sm2276101wrv.79.2022.04.01.08.19.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Apr 2022 08:19:05 -0700 (PDT) From: Massimiliano Minella X-Google-Original-From: Massimiliano Minella To: "Rafael J. Wysocki" Cc: Massimiliano Minella , Daniel Lezcano , Amit Kucheria , Zhang Rui , linux-pm@vger.kernel.org Subject: [PATCH v2] thermal: k3: Add hwmon support Date: Fri, 1 Apr 2022 17:13:51 +0200 Message-Id: <20220401151656.913166-1-massimiliano.minella@se.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Massimiliano Minella Expose the thermal sensors on K3 AM654 as hwmon devices, so that temperatures could be read using lm-sensors. Signed-off-by: Massimiliano Minella --- Changes in v2: * use devm_thermal_add_hwmon_sysfs instead of devm_add_action_or_reset drivers/thermal/k3_bandgap.c | 5 +++++ 1 file changed, 5 insertions(+) base-commit: 31035f3e20af4ede5f1c8162068327ea0b35a96e diff --git a/drivers/thermal/k3_bandgap.c b/drivers/thermal/k3_bandgap.c index 35f41e8a0b75..5d0b3ffc6f46 100644 --- a/drivers/thermal/k3_bandgap.c +++ b/drivers/thermal/k3_bandgap.c @@ -16,6 +16,8 @@ #include #include +#include "thermal_hwmon.h" + #define K3_VTM_DEVINFO_PWR0_OFFSET 0x4 #define K3_VTM_DEVINFO_PWR0_TEMPSENS_CT_MASK 0xf0 #define K3_VTM_TMPSENS0_CTRL_OFFSET 0x80 @@ -219,6 +221,9 @@ static int k3_bandgap_probe(struct platform_device *pdev) ret = PTR_ERR(data[id].tzd); goto err_alloc; } + + if (devm_thermal_add_hwmon_sysfs(data[id].tzd)) + dev_warn(dev, "Failed to add hwmon sysfs attributes\n"); } platform_set_drvdata(pdev, bgp);