linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 0/2] Surface fan monitoring driver
@ 2024-01-31  0:58 Ivor Wanders
  2024-01-31  0:58 ` [PATCH v5 1/2] hwmon: add fan speed monitoring driver for Surface devices Ivor Wanders
  2024-01-31  0:58 ` [PATCH v5 2/2] platform/surface: aggregator_registry: add entry for fan speed Ivor Wanders
  0 siblings, 2 replies; 9+ messages in thread
From: Ivor Wanders @ 2024-01-31  0:58 UTC (permalink / raw)
  To: Jean Delvare, Guenter Roeck, Jonathan Corbet, Maximilian Luz,
	Ivor Wanders, Hans de Goede, Mark Gross
  Cc: linux-hwmon, linux-doc, linux-kernel, platform-driver-x86


Fifth version of a hwmon driver to monitor the fan's rpm on Microsoft 
Surface devices, originally submitted in [1], [2], [3], v4 at [4].
Only change since v4 is rebasing on mainline kernel tree's master.

Changes in v5:
  - Rebased on mainline kernel tree's master branch.
Changes in v4:
  - Return 0 from surface_fan_hwmon_read instead of ret.
  - Use PTR_ERR_OR_ZERO in probe instead of if statement.
Changes in v3:
  - Removed type and attr checks in read and is_visible.
  - Removed assigning sdev to ssam_device drvdata.
  - Propagate return from __ssam_fan_rpm_get.
  - Renamed hwmon chip name from 'fan' to 'surface_fan'.
  - Removed unnecessary platform_device header.
Changes in v2:
  - Removed all unsupported sysfs attributes from the hwmon driver, leaving
    the fan input as the only supported attribute.

[1] https://lore.kernel.org/linux-hwmon/20231220234415.5219-1-ivor@iwanders.net/T/
[2] https://lore.kernel.org/linux-hwmon/20231228003444.5580-1-ivor@iwanders.net/T/
[3] https://lore.kernel.org/linux-hwmon/20240113183306.9566-1-ivor@iwanders.net/T/
[4] https://lore.kernel.org/linux-hwmon/20240130230654.4218-1-ivor@iwanders.net/T/

Ivor Wanders (2):
  hwmon: add fan speed monitoring driver for Surface devices
  platform/surface: aggregator_registry: add entry for fan speed

 Documentation/hwmon/index.rst                 |  1 +
 Documentation/hwmon/surface_fan.rst           | 25 +++++
 MAINTAINERS                                   |  8 ++
 drivers/hwmon/Kconfig                         | 13 +++
 drivers/hwmon/Makefile                        |  1 +
 drivers/hwmon/surface_fan.c                   | 91 +++++++++++++++++++
 .../surface/surface_aggregator_registry.c     |  7 ++
 7 files changed, 146 insertions(+)
 create mode 100644 Documentation/hwmon/surface_fan.rst
 create mode 100644 drivers/hwmon/surface_fan.c

-- 
2.17.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v5 1/2] hwmon: add fan speed monitoring driver for Surface devices
  2024-01-31  0:58 [PATCH v5 0/2] Surface fan monitoring driver Ivor Wanders
@ 2024-01-31  0:58 ` Ivor Wanders
  2024-01-31 13:21   ` Guenter Roeck
  2024-01-31  0:58 ` [PATCH v5 2/2] platform/surface: aggregator_registry: add entry for fan speed Ivor Wanders
  1 sibling, 1 reply; 9+ messages in thread
From: Ivor Wanders @ 2024-01-31  0:58 UTC (permalink / raw)
  To: Jean Delvare, Guenter Roeck, Jonathan Corbet, Maximilian Luz,
	Ivor Wanders, Hans de Goede, Mark Gross
  Cc: linux-hwmon, linux-doc, linux-kernel, platform-driver-x86

Adds a driver that provides read only access to the fan speed for Microsoft
Surface Pro devices. The fan speed is always regulated by the EC and cannot
be influenced directly.

Signed-off-by: Ivor Wanders <ivor@iwanders.net>
Link: https://github.com/linux-surface/kernel/pull/144
Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com>
Reviewed-by: Armin Wolf <W_Armin@gmx.de>
---
Changes in v5:
  - No changes in this patch.
Changes in v4:
  - Return 0 from surface_fan_hwmon_read instead of ret.
  - Use PTR_ERR_OR_ZERO in probe instead of if statement.
Changes in v3:
  - Removed type and attr checks in read and is_visible.
  - Removed assigning sdev to ssam_device drvdata.
  - Propagate return from __ssam_fan_rpm_get.
  - Renamed hwmon chip name from 'fan' to 'surface_fan'.
  - Removed unnecessary platform_device header.
Changes in v2:
  - Removed all sysfs attributes except fan1_input. Simplified code
    and updated documentation accordingly.
---
 Documentation/hwmon/index.rst       |  1 +
 Documentation/hwmon/surface_fan.rst | 25 ++++++++
 MAINTAINERS                         |  8 +++
 drivers/hwmon/Kconfig               | 13 +++++
 drivers/hwmon/Makefile              |  1 +
 drivers/hwmon/surface_fan.c         | 91 +++++++++++++++++++++++++++++
 6 files changed, 139 insertions(+)
 create mode 100644 Documentation/hwmon/surface_fan.rst
 create mode 100644 drivers/hwmon/surface_fan.c

diff --git a/Documentation/hwmon/index.rst b/Documentation/hwmon/index.rst
index c7ed1f73a..58be92e94 100644
--- a/Documentation/hwmon/index.rst
+++ b/Documentation/hwmon/index.rst
@@ -208,6 +208,7 @@ Hardware Monitoring Kernel Drivers
    smsc47m1
    sparx5-temp
    stpddc60
+   surface_fan
    sy7636a-hwmon
    tc654
    tc74
diff --git a/Documentation/hwmon/surface_fan.rst b/Documentation/hwmon/surface_fan.rst
new file mode 100644
index 000000000..07942574c
--- /dev/null
+++ b/Documentation/hwmon/surface_fan.rst
@@ -0,0 +1,25 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+Kernel driver surface_fan
+=========================
+
+Supported Devices:
+
+  * Microsoft Surface Pro 9
+
+Author: Ivor Wanders <ivor@iwanders.net>
+
+Description
+-----------
+
+This provides monitoring of the fan found in some Microsoft Surface Pro devices,
+like the Surface Pro 9. The fan is always controlled by the onboard controller.
+
+Sysfs interface
+---------------
+
+======================= ======= =========================================
+Name                    Perm    Description
+======================= ======= =========================================
+``fan1_input``          RO      Current fan speed in RPM.
+======================= ======= =========================================
diff --git a/MAINTAINERS b/MAINTAINERS
index c4828ab15..2c5c4d7e5 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -14560,6 +14560,14 @@ F:	Documentation/driver-api/surface_aggregator/clients/dtx.rst
 F:	drivers/platform/surface/surface_dtx.c
 F:	include/uapi/linux/surface_aggregator/dtx.h
 
+MICROSOFT SURFACE SENSOR FAN DRIVER
+M:	Maximilian Luz <luzmaximilian@gmail.com>
+M:	Ivor Wanders <ivor@iwanders.net>
+L:	linux-hwmon@vger.kernel.org
+S:	Maintained
+F:	Documentation/hwmon/surface_fan.rst
+F:	drivers/hwmon/surface_fan.c
+
 MICROSOFT SURFACE GPE LID SUPPORT DRIVER
 M:	Maximilian Luz <luzmaximilian@gmail.com>
 L:	platform-driver-x86@vger.kernel.org
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index a608264da..e762f6138 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -1994,6 +1994,19 @@ config SENSORS_SFCTEMP
 	  This driver can also be built as a module.  If so, the module
 	  will be called sfctemp.
 
+config SENSORS_SURFACE_FAN
+	tristate "Surface Fan Driver"
+	depends on SURFACE_AGGREGATOR
+	help
+	  Driver that provides monitoring of the fan on Surface Pro devices that
+	  have a fan, like the Surface Pro 9.
+
+	  This makes the fan's current speed accessible through the hwmon
+	  system. It does not provide control over the fan, the firmware is
+	  responsible for that, this driver merely provides monitoring.
+
+	  Select M or Y here, if you want to be able to read the fan's speed.
+
 config SENSORS_ADC128D818
 	tristate "Texas Instruments ADC128D818"
 	depends on I2C
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index 47be39af5..30cc90f40 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -201,6 +201,7 @@ obj-$(CONFIG_SENSORS_SMSC47M1)	+= smsc47m1.o
 obj-$(CONFIG_SENSORS_SMSC47M192)+= smsc47m192.o
 obj-$(CONFIG_SENSORS_SPARX5)	+= sparx5-temp.o
 obj-$(CONFIG_SENSORS_STTS751)	+= stts751.o
+obj-$(CONFIG_SENSORS_SURFACE_FAN)+= surface_fan.o
 obj-$(CONFIG_SENSORS_SY7636A)	+= sy7636a-hwmon.o
 obj-$(CONFIG_SENSORS_AMC6821)	+= amc6821.o
 obj-$(CONFIG_SENSORS_TC74)	+= tc74.o
diff --git a/drivers/hwmon/surface_fan.c b/drivers/hwmon/surface_fan.c
new file mode 100644
index 000000000..31cd5da9e
--- /dev/null
+++ b/drivers/hwmon/surface_fan.c
@@ -0,0 +1,91 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Surface Fan driver for Surface System Aggregator Module. It provides access
+ * to the fan's rpm through the hwmon system.
+ *
+ * Copyright (C) 2023 Ivor Wanders <ivor@iwanders.net>
+ */
+
+#include <linux/hwmon.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/surface_aggregator/device.h>
+#include <linux/types.h>
+
+// SSAM
+SSAM_DEFINE_SYNC_REQUEST_CL_R(__ssam_fan_rpm_get, __le16, {
+	.target_category = SSAM_SSH_TC_FAN,
+	.command_id      = 0x01,
+});
+
+// hwmon
+umode_t surface_fan_hwmon_is_visible(const void *drvdata,
+				     enum hwmon_sensor_types type, u32 attr,
+				     int channel)
+{
+	return 0444;
+}
+
+static int surface_fan_hwmon_read(struct device *dev,
+				  enum hwmon_sensor_types type, u32 attr,
+				  int channel, long *val)
+{
+	struct ssam_device *sdev = dev_get_drvdata(dev);
+	int ret;
+	__le16 value;
+
+	ret = __ssam_fan_rpm_get(sdev, &value);
+	if (ret)
+		return ret;
+
+	*val = le16_to_cpu(value);
+
+	return 0;
+}
+
+static const struct hwmon_channel_info *const surface_fan_info[] = {
+	HWMON_CHANNEL_INFO(fan, HWMON_F_INPUT),
+	NULL
+};
+
+static const struct hwmon_ops surface_fan_hwmon_ops = {
+	.is_visible = surface_fan_hwmon_is_visible,
+	.read = surface_fan_hwmon_read,
+};
+
+static const struct hwmon_chip_info surface_fan_chip_info = {
+	.ops = &surface_fan_hwmon_ops,
+	.info = surface_fan_info,
+};
+
+static int surface_fan_probe(struct ssam_device *sdev)
+{
+	struct device *hdev;
+
+	hdev = devm_hwmon_device_register_with_info(&sdev->dev,
+						    "surface_fan", sdev,
+						    &surface_fan_chip_info,
+						    NULL);
+
+	return PTR_ERR_OR_ZERO(hdev);
+}
+
+static const struct ssam_device_id ssam_fan_match[] = {
+	{ SSAM_SDEV(FAN, SAM, 0x01, 0x01) },
+	{},
+};
+MODULE_DEVICE_TABLE(ssam, ssam_fan_match);
+
+static struct ssam_device_driver surface_fan = {
+	.probe = surface_fan_probe,
+	.match_table = ssam_fan_match,
+	.driver = {
+		.name = "surface_fan",
+		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
+	},
+};
+module_ssam_device_driver(surface_fan);
+
+MODULE_AUTHOR("Ivor Wanders <ivor@iwanders.net>");
+MODULE_DESCRIPTION("Fan Driver for Surface System Aggregator Module");
+MODULE_LICENSE("GPL");
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v5 2/2] platform/surface: aggregator_registry: add entry for fan speed
  2024-01-31  0:58 [PATCH v5 0/2] Surface fan monitoring driver Ivor Wanders
  2024-01-31  0:58 ` [PATCH v5 1/2] hwmon: add fan speed monitoring driver for Surface devices Ivor Wanders
@ 2024-01-31  0:58 ` Ivor Wanders
  2024-01-31 13:24   ` Guenter Roeck
  1 sibling, 1 reply; 9+ messages in thread
From: Ivor Wanders @ 2024-01-31  0:58 UTC (permalink / raw)
  To: Jean Delvare, Guenter Roeck, Jonathan Corbet, Maximilian Luz,
	Ivor Wanders, Hans de Goede, Mark Gross
  Cc: linux-hwmon, linux-doc, linux-kernel, platform-driver-x86

Add an entry for the fan speed function.
Add this new entry to the Surface Pro 9 group.

Signed-off-by: Ivor Wanders <ivor@iwanders.net>
Link: https://github.com/linux-surface/kernel/pull/144
Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com>
---
Changes in v5:
  - No changes in this patch.
Changes in v4:
  - No changes in this patch.
Changes in v3:
  - No changes in this patch.
Changes in v2:
  - No changes in this patch.
---
 drivers/platform/surface/surface_aggregator_registry.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/platform/surface/surface_aggregator_registry.c b/drivers/platform/surface/surface_aggregator_registry.c
index aeb3feae4..035d6b410 100644
--- a/drivers/platform/surface/surface_aggregator_registry.c
+++ b/drivers/platform/surface/surface_aggregator_registry.c
@@ -74,6 +74,12 @@ static const struct software_node ssam_node_tmp_pprof = {
 	.parent = &ssam_node_root,
 };
 
+/* Fan speed function. */
+static const struct software_node ssam_node_fan_speed = {
+	.name = "ssam:01:05:01:01:01",
+	.parent = &ssam_node_root,
+};
+
 /* Tablet-mode switch via KIP subsystem. */
 static const struct software_node ssam_node_kip_tablet_switch = {
 	.name = "ssam:01:0e:01:00:01",
@@ -305,6 +311,7 @@ static const struct software_node *ssam_node_group_sp9[] = {
 	&ssam_node_bat_ac,
 	&ssam_node_bat_main,
 	&ssam_node_tmp_pprof,
+	&ssam_node_fan_speed,
 	&ssam_node_pos_tablet_switch,
 	&ssam_node_hid_kip_keyboard,
 	&ssam_node_hid_kip_penstash,
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v5 1/2] hwmon: add fan speed monitoring driver for Surface devices
  2024-01-31  0:58 ` [PATCH v5 1/2] hwmon: add fan speed monitoring driver for Surface devices Ivor Wanders
@ 2024-01-31 13:21   ` Guenter Roeck
  0 siblings, 0 replies; 9+ messages in thread
From: Guenter Roeck @ 2024-01-31 13:21 UTC (permalink / raw)
  To: Ivor Wanders
  Cc: Jean Delvare, Jonathan Corbet, Maximilian Luz, Hans de Goede,
	Mark Gross, linux-hwmon, linux-doc, linux-kernel,
	platform-driver-x86

On Tue, Jan 30, 2024 at 07:58:55PM -0500, Ivor Wanders wrote:
> Adds a driver that provides read only access to the fan speed for Microsoft
> Surface Pro devices. The fan speed is always regulated by the EC and cannot
> be influenced directly.
> 
> Signed-off-by: Ivor Wanders <ivor@iwanders.net>
> Link: https://github.com/linux-surface/kernel/pull/144
> Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com>
> Reviewed-by: Armin Wolf <W_Armin@gmx.de>

Applied.

Thanks,
Guenter

> ---
> Changes in v5:
>   - No changes in this patch.
> Changes in v4:
>   - Return 0 from surface_fan_hwmon_read instead of ret.
>   - Use PTR_ERR_OR_ZERO in probe instead of if statement.
> Changes in v3:
>   - Removed type and attr checks in read and is_visible.
>   - Removed assigning sdev to ssam_device drvdata.
>   - Propagate return from __ssam_fan_rpm_get.
>   - Renamed hwmon chip name from 'fan' to 'surface_fan'.
>   - Removed unnecessary platform_device header.
> Changes in v2:
>   - Removed all sysfs attributes except fan1_input. Simplified code
>     and updated documentation accordingly.
> ---
>  Documentation/hwmon/index.rst       |  1 +
>  Documentation/hwmon/surface_fan.rst | 25 ++++++++
>  MAINTAINERS                         |  8 +++
>  drivers/hwmon/Kconfig               | 13 +++++
>  drivers/hwmon/Makefile              |  1 +
>  drivers/hwmon/surface_fan.c         | 91 +++++++++++++++++++++++++++++
>  6 files changed, 139 insertions(+)
>  create mode 100644 Documentation/hwmon/surface_fan.rst
>  create mode 100644 drivers/hwmon/surface_fan.c
> 
> diff --git a/Documentation/hwmon/index.rst b/Documentation/hwmon/index.rst
> index c7ed1f73a..58be92e94 100644
> --- a/Documentation/hwmon/index.rst
> +++ b/Documentation/hwmon/index.rst
> @@ -208,6 +208,7 @@ Hardware Monitoring Kernel Drivers
>     smsc47m1
>     sparx5-temp
>     stpddc60
> +   surface_fan
>     sy7636a-hwmon
>     tc654
>     tc74
> diff --git a/Documentation/hwmon/surface_fan.rst b/Documentation/hwmon/surface_fan.rst
> new file mode 100644
> index 000000000..07942574c
> --- /dev/null
> +++ b/Documentation/hwmon/surface_fan.rst
> @@ -0,0 +1,25 @@
> +.. SPDX-License-Identifier: GPL-2.0-or-later
> +
> +Kernel driver surface_fan
> +=========================
> +
> +Supported Devices:
> +
> +  * Microsoft Surface Pro 9
> +
> +Author: Ivor Wanders <ivor@iwanders.net>
> +
> +Description
> +-----------
> +
> +This provides monitoring of the fan found in some Microsoft Surface Pro devices,
> +like the Surface Pro 9. The fan is always controlled by the onboard controller.
> +
> +Sysfs interface
> +---------------
> +
> +======================= ======= =========================================
> +Name                    Perm    Description
> +======================= ======= =========================================
> +``fan1_input``          RO      Current fan speed in RPM.
> +======================= ======= =========================================
> diff --git a/MAINTAINERS b/MAINTAINERS
> index c4828ab15..2c5c4d7e5 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -14560,6 +14560,14 @@ F:	Documentation/driver-api/surface_aggregator/clients/dtx.rst
>  F:	drivers/platform/surface/surface_dtx.c
>  F:	include/uapi/linux/surface_aggregator/dtx.h
>  
> +MICROSOFT SURFACE SENSOR FAN DRIVER
> +M:	Maximilian Luz <luzmaximilian@gmail.com>
> +M:	Ivor Wanders <ivor@iwanders.net>
> +L:	linux-hwmon@vger.kernel.org
> +S:	Maintained
> +F:	Documentation/hwmon/surface_fan.rst
> +F:	drivers/hwmon/surface_fan.c
> +
>  MICROSOFT SURFACE GPE LID SUPPORT DRIVER
>  M:	Maximilian Luz <luzmaximilian@gmail.com>
>  L:	platform-driver-x86@vger.kernel.org
> diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
> index a608264da..e762f6138 100644
> --- a/drivers/hwmon/Kconfig
> +++ b/drivers/hwmon/Kconfig
> @@ -1994,6 +1994,19 @@ config SENSORS_SFCTEMP
>  	  This driver can also be built as a module.  If so, the module
>  	  will be called sfctemp.
>  
> +config SENSORS_SURFACE_FAN
> +	tristate "Surface Fan Driver"
> +	depends on SURFACE_AGGREGATOR
> +	help
> +	  Driver that provides monitoring of the fan on Surface Pro devices that
> +	  have a fan, like the Surface Pro 9.
> +
> +	  This makes the fan's current speed accessible through the hwmon
> +	  system. It does not provide control over the fan, the firmware is
> +	  responsible for that, this driver merely provides monitoring.
> +
> +	  Select M or Y here, if you want to be able to read the fan's speed.
> +
>  config SENSORS_ADC128D818
>  	tristate "Texas Instruments ADC128D818"
>  	depends on I2C
> diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
> index 47be39af5..30cc90f40 100644
> --- a/drivers/hwmon/Makefile
> +++ b/drivers/hwmon/Makefile
> @@ -201,6 +201,7 @@ obj-$(CONFIG_SENSORS_SMSC47M1)	+= smsc47m1.o
>  obj-$(CONFIG_SENSORS_SMSC47M192)+= smsc47m192.o
>  obj-$(CONFIG_SENSORS_SPARX5)	+= sparx5-temp.o
>  obj-$(CONFIG_SENSORS_STTS751)	+= stts751.o
> +obj-$(CONFIG_SENSORS_SURFACE_FAN)+= surface_fan.o
>  obj-$(CONFIG_SENSORS_SY7636A)	+= sy7636a-hwmon.o
>  obj-$(CONFIG_SENSORS_AMC6821)	+= amc6821.o
>  obj-$(CONFIG_SENSORS_TC74)	+= tc74.o
> diff --git a/drivers/hwmon/surface_fan.c b/drivers/hwmon/surface_fan.c
> new file mode 100644
> index 000000000..31cd5da9e
> --- /dev/null
> +++ b/drivers/hwmon/surface_fan.c
> @@ -0,0 +1,91 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Surface Fan driver for Surface System Aggregator Module. It provides access
> + * to the fan's rpm through the hwmon system.
> + *
> + * Copyright (C) 2023 Ivor Wanders <ivor@iwanders.net>
> + */
> +
> +#include <linux/hwmon.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/surface_aggregator/device.h>
> +#include <linux/types.h>
> +
> +// SSAM
> +SSAM_DEFINE_SYNC_REQUEST_CL_R(__ssam_fan_rpm_get, __le16, {
> +	.target_category = SSAM_SSH_TC_FAN,
> +	.command_id      = 0x01,
> +});
> +
> +// hwmon
> +umode_t surface_fan_hwmon_is_visible(const void *drvdata,
> +				     enum hwmon_sensor_types type, u32 attr,
> +				     int channel)
> +{
> +	return 0444;
> +}
> +
> +static int surface_fan_hwmon_read(struct device *dev,
> +				  enum hwmon_sensor_types type, u32 attr,
> +				  int channel, long *val)
> +{
> +	struct ssam_device *sdev = dev_get_drvdata(dev);
> +	int ret;
> +	__le16 value;
> +
> +	ret = __ssam_fan_rpm_get(sdev, &value);
> +	if (ret)
> +		return ret;
> +
> +	*val = le16_to_cpu(value);
> +
> +	return 0;
> +}
> +
> +static const struct hwmon_channel_info *const surface_fan_info[] = {
> +	HWMON_CHANNEL_INFO(fan, HWMON_F_INPUT),
> +	NULL
> +};
> +
> +static const struct hwmon_ops surface_fan_hwmon_ops = {
> +	.is_visible = surface_fan_hwmon_is_visible,
> +	.read = surface_fan_hwmon_read,
> +};
> +
> +static const struct hwmon_chip_info surface_fan_chip_info = {
> +	.ops = &surface_fan_hwmon_ops,
> +	.info = surface_fan_info,
> +};
> +
> +static int surface_fan_probe(struct ssam_device *sdev)
> +{
> +	struct device *hdev;
> +
> +	hdev = devm_hwmon_device_register_with_info(&sdev->dev,
> +						    "surface_fan", sdev,
> +						    &surface_fan_chip_info,
> +						    NULL);
> +
> +	return PTR_ERR_OR_ZERO(hdev);
> +}
> +
> +static const struct ssam_device_id ssam_fan_match[] = {
> +	{ SSAM_SDEV(FAN, SAM, 0x01, 0x01) },
> +	{},
> +};
> +MODULE_DEVICE_TABLE(ssam, ssam_fan_match);
> +
> +static struct ssam_device_driver surface_fan = {
> +	.probe = surface_fan_probe,
> +	.match_table = ssam_fan_match,
> +	.driver = {
> +		.name = "surface_fan",
> +		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
> +	},
> +};
> +module_ssam_device_driver(surface_fan);
> +
> +MODULE_AUTHOR("Ivor Wanders <ivor@iwanders.net>");
> +MODULE_DESCRIPTION("Fan Driver for Surface System Aggregator Module");
> +MODULE_LICENSE("GPL");

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v5 2/2] platform/surface: aggregator_registry: add entry for fan speed
  2024-01-31  0:58 ` [PATCH v5 2/2] platform/surface: aggregator_registry: add entry for fan speed Ivor Wanders
@ 2024-01-31 13:24   ` Guenter Roeck
  2024-01-31 17:58     ` Maximilian Luz
  0 siblings, 1 reply; 9+ messages in thread
From: Guenter Roeck @ 2024-01-31 13:24 UTC (permalink / raw)
  To: Ivor Wanders
  Cc: Jean Delvare, Jonathan Corbet, Maximilian Luz, Hans de Goede,
	Mark Gross, linux-hwmon, linux-doc, linux-kernel,
	platform-driver-x86

On Tue, Jan 30, 2024 at 07:58:56PM -0500, Ivor Wanders wrote:
> Add an entry for the fan speed function.
> Add this new entry to the Surface Pro 9 group.
> 
> Signed-off-by: Ivor Wanders <ivor@iwanders.net>
> Link: https://github.com/linux-surface/kernel/pull/144
> Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com>

I wasn't sure if the Reviewed-by: tag means that I should apply the patch
through the hwmon subsystem. If so, please let me know. For now I'll
assume that it will be applied through a platform tree.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v5 2/2] platform/surface: aggregator_registry: add entry for fan speed
  2024-01-31 13:24   ` Guenter Roeck
@ 2024-01-31 17:58     ` Maximilian Luz
  2024-01-31 22:21       ` Ivor Wanders
  2024-02-01  8:25       ` Ilpo Järvinen
  0 siblings, 2 replies; 9+ messages in thread
From: Maximilian Luz @ 2024-01-31 17:58 UTC (permalink / raw)
  To: Guenter Roeck, Ivor Wanders, Ilpo Järvinen, Hans de Goede
  Cc: Jean Delvare, Jonathan Corbet, Mark Gross, linux-hwmon,
	linux-doc, linux-kernel, platform-driver-x86

Am 1/31/2024 um 2:24 PM schrieb Guenter Roeck:
> On Tue, Jan 30, 2024 at 07:58:56PM -0500, Ivor Wanders wrote:
>> Add an entry for the fan speed function.
>> Add this new entry to the Surface Pro 9 group.
>>
>> Signed-off-by: Ivor Wanders <ivor@iwanders.net>
>> Link: https://github.com/linux-surface/kernel/pull/144
>> Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com>
> 
> I wasn't sure if the Reviewed-by: tag means that I should apply the patch
> through the hwmon subsystem. If so, please let me know. For now I'll
> assume that it will be applied through a platform tree.

I think it would make more sense for it to go through pdx86 (as usual
for platform/surface). That would avoid any potential merge conflicts
if we get more changes to the surface_aggregator_registry later on.

Hans, Ilpo, could you please take this?

Also I just noticed that Ilpo wasn't CCd, I assume because of an older
MAINTAINERS list. Ivor, please add him for any next submissions to
platform/surface.

Best regards,
Max

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v5 2/2] platform/surface: aggregator_registry: add entry for fan speed
  2024-01-31 17:58     ` Maximilian Luz
@ 2024-01-31 22:21       ` Ivor Wanders
  2024-02-01  8:25       ` Ilpo Järvinen
  1 sibling, 0 replies; 9+ messages in thread
From: Ivor Wanders @ 2024-01-31 22:21 UTC (permalink / raw)
  To: luzmaximilian
  Cc: corbet, hdegoede, ilpo.jarvinen, ivor, jdelvare, linux-doc,
	linux-hwmon, linux-kernel, linux, markgross, platform-driver-x86

> I assume because of an older MAINTAINERS list. Ivor, please add him for
> any next submissions to platform/surface.

Yes, mea culpa. Guenter also ran into trouble applying the v4 version of
the patch yesterday. I'm sorry I didn't base this off the correct branch
everyone, will be sure to do so in the future!

~Ivor

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v5 2/2] platform/surface: aggregator_registry: add entry for fan speed
  2024-01-31 17:58     ` Maximilian Luz
  2024-01-31 22:21       ` Ivor Wanders
@ 2024-02-01  8:25       ` Ilpo Järvinen
  2024-02-06 10:17         ` Ilpo Järvinen
  1 sibling, 1 reply; 9+ messages in thread
From: Ilpo Järvinen @ 2024-02-01  8:25 UTC (permalink / raw)
  To: Maximilian Luz
  Cc: Guenter Roeck, Ivor Wanders, Hans de Goede, Jean Delvare,
	Jonathan Corbet, Mark Gross, linux-hwmon, linux-doc, LKML,
	platform-driver-x86

On Wed, 31 Jan 2024, Maximilian Luz wrote:

> Am 1/31/2024 um 2:24 PM schrieb Guenter Roeck:
> > On Tue, Jan 30, 2024 at 07:58:56PM -0500, Ivor Wanders wrote:
> > > Add an entry for the fan speed function.
> > > Add this new entry to the Surface Pro 9 group.
> > > 
> > > Signed-off-by: Ivor Wanders <ivor@iwanders.net>
> > > Link: https://github.com/linux-surface/kernel/pull/144
> > > Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com>
> > 
> > I wasn't sure if the Reviewed-by: tag means that I should apply the patch
> > through the hwmon subsystem. If so, please let me know. For now I'll
> > assume that it will be applied through a platform tree.
> 
> I think it would make more sense for it to go through pdx86 (as usual
> for platform/surface). That would avoid any potential merge conflicts
> if we get more changes to the surface_aggregator_registry later on.
> 
> Hans, Ilpo, could you please take this?
> 
> Also I just noticed that Ilpo wasn't CCd, I assume because of an older
> MAINTAINERS list. Ivor, please add him for any next submissions to
> platform/surface.

Okay, thanks for letting me know (I assumed the opposite). I'll take it 
through pdx86.

-- 
 i.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v5 2/2] platform/surface: aggregator_registry: add entry for fan speed
  2024-02-01  8:25       ` Ilpo Järvinen
@ 2024-02-06 10:17         ` Ilpo Järvinen
  0 siblings, 0 replies; 9+ messages in thread
From: Ilpo Järvinen @ 2024-02-06 10:17 UTC (permalink / raw)
  To: Maximilian Luz, Ivor Wanders
  Cc: Guenter Roeck, Hans de Goede, Jean Delvare, Jonathan Corbet,
	Mark Gross, linux-hwmon, linux-doc, LKML, platform-driver-x86

[-- Attachment #1: Type: text/plain, Size: 1347 bytes --]

On Thu, 1 Feb 2024, Ilpo Järvinen wrote:

> On Wed, 31 Jan 2024, Maximilian Luz wrote:
> 
> > Am 1/31/2024 um 2:24 PM schrieb Guenter Roeck:
> > > On Tue, Jan 30, 2024 at 07:58:56PM -0500, Ivor Wanders wrote:
> > > > Add an entry for the fan speed function.
> > > > Add this new entry to the Surface Pro 9 group.
> > > > 
> > > > Signed-off-by: Ivor Wanders <ivor@iwanders.net>
> > > > Link: https://github.com/linux-surface/kernel/pull/144
> > > > Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com>
> > > 
> > > I wasn't sure if the Reviewed-by: tag means that I should apply the patch
> > > through the hwmon subsystem. If so, please let me know. For now I'll
> > > assume that it will be applied through a platform tree.
> > 
> > I think it would make more sense for it to go through pdx86 (as usual
> > for platform/surface). That would avoid any potential merge conflicts
> > if we get more changes to the surface_aggregator_registry later on.
> > 
> > Hans, Ilpo, could you please take this?
> > 
> > Also I just noticed that Ilpo wasn't CCd, I assume because of an older
> > MAINTAINERS list. Ivor, please add him for any next submissions to
> > platform/surface.
> 
> Okay, thanks for letting me know (I assumed the opposite). I'll take it 
> through pdx86.

Patch 2/2 applied to review-ilpo.

-- 
 i.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-02-06 10:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-31  0:58 [PATCH v5 0/2] Surface fan monitoring driver Ivor Wanders
2024-01-31  0:58 ` [PATCH v5 1/2] hwmon: add fan speed monitoring driver for Surface devices Ivor Wanders
2024-01-31 13:21   ` Guenter Roeck
2024-01-31  0:58 ` [PATCH v5 2/2] platform/surface: aggregator_registry: add entry for fan speed Ivor Wanders
2024-01-31 13:24   ` Guenter Roeck
2024-01-31 17:58     ` Maximilian Luz
2024-01-31 22:21       ` Ivor Wanders
2024-02-01  8:25       ` Ilpo Järvinen
2024-02-06 10:17         ` Ilpo Järvinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).