Re: [PATCH v2 2/2] platform/x86: toshiba_acpi: Add fan RPM reading (hwmon interface)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9/2/22 01:29, Hans de Goede wrote:
Hi Guenter, Arvid,

On 9/2/22 00:27, Guenter Roeck wrote:
On 9/1/22 14:58, Arvid Norlander wrote:
This expands on the previous commit, exporting the fan RPM via hwmon.

This will look something like the following when using the "sensors"
command from lm_sensors:

toshiba_acpi_sensors-acpi-0
Adapter: ACPI interface
fan1:           0 RPM

Signed-off-by: Arvid Norlander <lkml@xxxxxxxxx>
---
   drivers/platform/x86/Kconfig        |  1 +
   drivers/platform/x86/toshiba_acpi.c | 72 +++++++++++++++++++++++++++++
   2 files changed, 73 insertions(+)

diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index f2f98e942cf2..4d0d2676939a 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -797,6 +797,7 @@ config ACPI_TOSHIBA
       depends on INPUT
       depends on SERIO_I8042 || SERIO_I8042 = n
       depends on ACPI_VIDEO || ACPI_VIDEO = n
+    depends on HWMON || HWMON = n
       depends on RFKILL || RFKILL = n
       depends on IIO
       select INPUT_SPARSEKMAP
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index 02e3522f4eeb..a976dfb97a5e 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -46,6 +46,10 @@
   #include <linux/toshiba.h>
   #include <acpi/video.h>
   +#ifdef CONFIG_HWMON
+#include <linux/hwmon.h>
+#endif

ifdef not needed here.

Ack.


+
   MODULE_AUTHOR("John Belmonte");
   MODULE_DESCRIPTION("Toshiba Laptop ACPI Extras Driver");
   MODULE_LICENSE("GPL");
@@ -171,6 +175,9 @@ struct toshiba_acpi_dev {
       struct miscdevice miscdev;
       struct rfkill *wwan_rfk;
       struct iio_dev *indio_dev;
+#ifdef CONFIG_HWMON
+    struct device *hwmon_device;
+#endif
         int force_fan;
       int last_key_event;
@@ -2941,6 +2948,54 @@ static int toshiba_acpi_setup_backlight(struct toshiba_acpi_dev *dev)
       return 0;
   }
   +/* HWMON support for fan */
+#ifdef CONFIG_HWMON

This should be #if IS_REACHABLE(CONFIG_HWMON)

Actually that should be IS_ENABLED since you suggested that
Arvid should use:

	depends on HWMON || HWMON = n

Yes, you are absolutely correct.

Thanks,
Guenter



[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux