OF support for Surface System Aggregator Module
Subsystems (7)
v3 cover OF support for Surface System Aggregator Module
Wire up OF support for SSAM drivers, to use with Surface Laptop 7 and other Qualcomm-based devices.
Patch 3 references compatible strings introduced in [1]
[1] https://lore.kernel.org/linux-arm-msm/[email protected]/T/#u
---
Changes in v3:
- Drop unnecessary nullchecks
- Add MODULE_ALIAS in the platform hub driver
- Fix MODULE_DEVICE_TABLE after rename
- Prolong the '----' comment to 80 lines
- Change the current-speed bindings description to ": true", in preparation for krzk's serial device bindings reorganization
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- Fix kerneldoc
- Drop the drivers/acpi change (oops)
- Style fixes
- Don't assign int to acpi_status
- Don't scan the bus twice in SAM core probe
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Konrad Dybcio (3):
dt-bindings: serial: Allow embedded-controller as child node
dt-bindings: platform: Add Surface System Aggregator Module platform/surface: Add OF support
.../bindings/platform/microsoft,surface-sam.yaml | 47 +++++++++++++ .../devicetree/bindings/serial/serial.yaml | 2 +- drivers/platform/surface/aggregator/bus.c | 2 + drivers/platform/surface/aggregator/controller.c | 67 ++++++++++++++---- drivers/platform/surface/aggregator/core.c | 82 +++++++++++++++++----- drivers/platform/surface/surface3_power.c | 1 + drivers/platform/surface/surface_acpi_notify.c | 1 + .../platform/surface/surface_aggregator_registry.c | 47 +++++++++++-- 8 files changed, 210 insertions(+), 39 deletions(-)
---
base-commit: 1e391b34f6aa043c7afa40a2103163a0ef06d179
change-id: 20240809-topic-sam-5de2f0ec9370
Best regards,
Signature · 1 line
Konrad Dybcio <[email protected]>
PATCH v3 1/3 dt-bindings: serial: Allow embedded-controller as child node
From: Konrad Dybcio <[email protected]>
There exist some embedded controllers (like Microsoft SAM found on Surface devices or Apple Oscar found on old iPhones) that connect to the host device via serial.
Allow that class of devices to exist under serial interface controller nodes.
--- Documentation/devicetree/bindings/serial/serial.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/serial/serial.yaml +1 -1
@@ -88,7 +88,7 @@ properties: TX FIFO threshold configuration (in bytes). patternProperties: - "^(bluetooth|bluetooth-gnss|gnss|gps|mcu|onewire)$": + "^(bluetooth|bluetooth-gnss|embedded-controller|gnss|gps|mcu|onewire)$": if: type: object then:
Signature · 1 line
2.46.0
PATCH v3 2/3 dt-bindings: platform: Add Surface System Aggregator Module
In reply to Konrad DybcioFrom: Konrad Dybcio <[email protected]>
Add bindings for the Surface System Aggregator Module (SAM/SSAM), the Microsoft Surface-standard Embedded Controller, used on both x86- and Qualcomm-based devices.
It provides a plethora of functions, depending on what's wired up to it. That includes but is not limited to: fan control, keyboard/touchpad support, thermal sensors, power control, special buttons, tablet mode.
--- .../bindings/platform/microsoft,surface-sam.yaml | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+)
Documentation/devicetree/bindings/platform/microsoft,surface-sam.yaml new file +47 -0
@@ -0,0 +1,47 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/platform/microsoft,surface-sam.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Surface System Aggregator Module (SAM, SSAM) + +maintainers: + - Konrad Dybcio <[email protected]> + +description: | + Surface devices use a standardized embedded controller to let the + operating system interface with various hardware functions. The + specific functionalities are modeled as subdevices and matched on + five levels: domain, category, target, instance and function. + +properties: + compatible: + const: microsoft,surface-sam + + interrupts: + maxItems: 1 + + current-speed: true + +required: + - compatible + - interrupts + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + uart { + embedded-controller { + compatible = "microsoft,surface-sam"; + + interrupts-extended = <&tlmm 91 IRQ_TYPE_EDGE_RISING>; + + pinctrl-0 = <&ssam_state>; + pinctrl-names = "default"; + + current-speed = <4000000>; + }; + };
Signature · 1 line
2.46.0
Re: [PATCH v3 2/3] dt-bindings: platform: Add Surface System Aggregator Module
Quoted 6 lines · Konrad Dybcio
From: Konrad Dybcio <[email protected]>
Add bindings for the Surface System Aggregator Module (SAM/SSAM), the Microsoft Surface-standard Embedded Controller, used on both x86- and Qualcomm-based devices.
Quoted 6 lines
It provides a plethora of functions, depending on what's wired up to it. That includes but is not limited to: fan control, keyboard/touchpad support, thermal sensors, power control, special buttons, tablet mode.
Signed-off-by Konrad Dybcio <[email protected]>---
Best regards,
Krzysztof
PATCH v3 3/3 platform/surface: Add OF support
In reply to Konrad DybcioFrom: Konrad Dybcio <[email protected]>
Add basic support for registering the aggregator module on Device Tree- based platforms. These include at least three generations of Qualcomm Snapdragon-based Surface devices:
- SC8180X / SQ1 / SQ2: Pro X,
- SC8280XP / SQ3: Devkit 2023, Pro 9
- X Elite: Laptop 7 / Pro11
Thankfully, the aggregators on these seem to be configured in an identical way, which allows for using these settings as defaults and no DT properties need to be introduced (until that changes, anyway).
Based on the work done by Maximilian Luz, largely rewritten.
--- drivers/platform/surface/aggregator/bus.c | 2 + drivers/platform/surface/aggregator/controller.c | 67 ++++++++++++++---- drivers/platform/surface/aggregator/core.c | 82 +++++++++++++++++----- drivers/platform/surface/surface3_power.c | 1 + drivers/platform/surface/surface_acpi_notify.c | 1 + .../platform/surface/surface_aggregator_registry.c | 47 +++++++++++-- 6 files changed, 162 insertions(+), 38 deletions(-)
drivers/platform/surface/aggregator/bus.c +2 -0
@@ -6,6 +6,7 @@*/ #include <linux/device.h> +#include <linux/of.h> #include <linux/property.h> #include <linux/slab.h>
@@ -441,6 +442,7 @@ static int ssam_add_client_device(struct device *parent, struct ssam_controller sdev->dev.parent = parent; sdev->dev.fwnode =fwnode_handle_get (node); + sdev->dev.of_node =to_of_node (node); status =ssam_device_add (sdev);if (status)
drivers/platform/surface/aggregator/controller.c +53 -14
96 lines not on this page · raw message
drivers/platform/surface/aggregator/core.c +63 -19
142 lines not on this page · raw message
drivers/platform/surface/surface3_power.c +1 -0
@@ -479,6 +479,7 @@ static int mshw0011_install_space_handler(struct i2c_client *client) }acpi_dev_clear_dependencies (adev); +return 0 ; }
drivers/platform/surface/surface_acpi_notify.c +1 -0
@@ -816,6 +816,7 @@ static int san_probe(struct platform_device *pdev) goto err_install_dev;acpi_dev_clear_dependencies (san); +return 0 ; err_install_dev:
drivers/platform/surface/surface_aggregator_registry.c +42 -5
91 lines not on this page · raw message
Signature · 1 line
2.46.0
Re: [PATCH v3 3/3] platform/surface: Add OF support
Quoted 10 lines · Konrad Dybcio
From: Konrad Dybcio <[email protected]>
Add basic support for registering the aggregator module on Device Tree- based platforms. These include at least three generations of Qualcomm Snapdragon-based Surface devices:
- SC8180X / SQ1 / SQ2: Pro X,
- SC8280XP / SQ3: Devkit 2023, Pro 9
- X Elite: Laptop 7 / Pro11
Quoted 8 lines
Thankfully, the aggregators on these seem to be configured in an identical way, which allows for using these settings as defaults and no DT properties need to be introduced (until that changes, anyway).
Based on the work done by Maximilian Luz, largely rewritten.
Signed-off-by Konrad Dybcio <[email protected]>---
Looks good to me and works without issues on my Surface Pro X.
Thanks again for picking this up!
Re: [PATCH v3 3/3] platform/surface: Add OF support
In reply to Konrad DybcioWed, Aug 14, 2024 at 12:27:27PM +0200, Konrad Dybcio kirjoitti:
Quoted 15 lines
From: Konrad Dybcio <[email protected]>
Add basic support for registering the aggregator module on Device Tree- based platforms. These include at least three generations of Qualcomm Snapdragon-based Surface devices:
- SC8180X / SQ1 / SQ2: Pro X,
- SC8280XP / SQ3: Devkit 2023, Pro 9
- X Elite: Laptop 7 / Pro11Thankfully, the aggregators on these seem to be configured in an identical way, which allows for using these settings as defaults and no DT properties need to be introduced (until that changes, anyway).
Based on the work done by Maximilian Luz, largely rewritten.
...
drivers/platform/surface/aggregator/bus.c static int ssam_add_client_device(struct device *parent, struct ssam_controller · line 445
Quoted 2 lines
drivers/platform/surface/aggregator/bus.c +1
-0sdev->dev.fwnode =fwnode_handle_get (node); + sdev->dev.of_node =to_of_node (node);
Please, use device_set_node() instead of those two.
...
drivers/platform/surface/aggregator/controller.c int ssam_controller_caps_load_from_acpi(acpi_handle handle, · line 1176
Quoted 4 lines
drivers/platform/surface/aggregator/controller.c +3
-0+static int ssam_controller_caps_load (struct device *dev,struct ssam_controller_caps *caps) +{ +acpi_handle handle =ACPI_HANDLE (dev);
It's a bit non-standard way to check if we run on DT or ACPI. The others (most of them?) do something like this:
struct fwnode_handle *fwnode = dev_fwnode(...); if (is_of_node(fwnode)) return X; if (is_acpi_node(fwnode)) // also more precise _device or _data variant return Y; return ERROR;
drivers/platform/surface/aggregator/controller.c int ssam_controller_caps_load_from_acpi(acpi_handle handle, · line 1186
Quoted 9 lines
drivers/platform/surface/aggregator/controller.c +9
-0+/* Set defaults. */ + caps->ssh_power_profile =U32_MAX ; + caps->screen_on_sleep_idle_timeout =U32_MAX ; + caps->screen_off_sleep_idle_timeout =U32_MAX ; + caps->d3_closes_handle = false; + caps->ssh_buffer_size =U32_MAX ; + +if (handle) +return ssam_controller_caps_load_from_acpi (handle, caps);
Yeah, I see that you use handle here, that's why it's up to you how to proceed with that.
drivers/platform/surface/aggregator/controller.c int ssam_controller_caps_load_from_acpi(acpi_handle handle, · line 1188
Quoted 2 lines
drivers/platform/surface/aggregator/controller.c +2
-0+else +return ssam_controller_caps_load_from_of (dev, caps);
But just note that we have 4 options for fwnode type here and this covers 3 and I don't know if you ever have an ACPI data node or software node and what you want to do with that.
Quoted 1 line
+}
...
drivers/platform/surface/aggregator/controller.c int ssam_irq_setup(struct ssam_controller *ctrl) · line 2761
Quoted 12 lines
drivers/platform/surface/aggregator/controller.c +6
-5gpiod =gpiod_get (dev,"ssam_wakeup-int" ,GPIOD_ASIS ); -if (IS_ERR (gpiod)) -return PTR_ERR (gpiod); - - irq =gpiod_to_irq (gpiod); -gpiod_put (gpiod); +if (IS_ERR (gpiod)) { + irq =fwnode_irq_get (dev_fwnode (dev),0 ); + }else { + irq =gpiod_to_irq (gpiod); +gpiod_put (gpiod); + }
Can't you try fwnode_irq_get_byname() followed by fwnode_irq_get()? And why do you need unnamed variant to begin with? As far as I understand it's pure DT and names are there, no?
...
Quoted 4 lines
#include <
linux/kernel.h>
#include <linux/kref.h>
#include <linux/module.h>
+#include <linux/of.h>
I do not see how you use this. You probably missed mod_devicetable.h.
Quoted 4 lines
+#include <
linux/platform_device.h>
#include <linux/pm.h>
#include <linux/serdev.h>
#include <linux/sysfs.h>
...
Quoted 6 lines
drivers/platform/surface/aggregator/core.c +6
-0+/* +* When using DT, we have to register the platform hub driver manually, +* as it can't be matched based on top-level board compatible (like it +* does the ACPI case). +*/ +if (!ssh) {
drivers/platform/surface/aggregator/core.c static int ssam_serial_hub_probe(struct serdev_device *serdev)
Quoted 10 lines
drivers/platform/surface/aggregator/core.c +9
-0+struct platform_device *ph_pdev = +platform_device_register_simple ("surface_aggregator_platform_hub" , +0 ,NULL ,0 ); +if (IS_ERR (ph_pdev)) +return dev_err_probe (dev,PTR_ERR (ph_pdev), +"Failed to register the platform hub driver\n" ); + } + +if (ssh)
Simply 'else' ? And making condition positive?
...
drivers/platform/surface/aggregator/core.c static void ssam_serial_hub_remove(struct serdev_device *serdev) · line 822
Quoted 4 lines
drivers/platform/surface/aggregator/core.c +1
-1-static const struct acpi_device_id ssam_serial_hub_match[] = { +static const struct acpi_device_id ssam_serial_hub_acpi_match[] = { {"MSHW0084" ,0 }, { },
At some point, please drop that 0 part above and the comma in the terminator entry.
drivers/platform/surface/aggregator/core.c static void ssam_serial_hub_remove(struct serdev_device *serdev) · line 824
Quoted 3 lines
};
drivers/platform/surface/aggregator/core.c +1
-1-MODULE_DEVICE_TABLE (acpi, ssam_serial_hub_match); +MODULE_DEVICE_TABLE (acpi, ssam_serial_hub_acpi_match);
Do you really need this renaming?
...
drivers/platform/surface/aggregator/core.c static void ssam_serial_hub_remove(struct serdev_device *serdev) · line 828
Quoted 3 lines
drivers/platform/surface/aggregator/core.c +3
-0+#ifdef CONFIG_OF +static const struct of_device_id ssam_serial_hub_of_match[] = { + { .compatible = "microsoft,surface-sam", },
No inner comma.
Review
Quoted 1 line
(quoted diff) +1
-0+ { },
No comma for the terminator.
drivers/platform/surface/aggregator/core.c static void ssam_serial_hub_remove(struct serdev_device *serdev) · line 839
Quoted 11 lines
drivers/platform/surface/aggregator/core.c +4
-1+}; +MODULE_DEVICE_TABLE (of, ssam_serial_hub_of_match); +#endif static struct serdev_device_driver ssam_serial_hub = { .probe = ssam_serial_hub_probe, .remove = ssam_serial_hub_remove, .driver = { .name ="surface_serial_hub" , - .acpi_match_table = ssam_serial_hub_match, + .acpi_match_table =ACPI_PTR (ssam_serial_hub_acpi_match),
No, please do not use ACPI_PTR(), it's more harmful than helpful.
drivers/platform/surface/aggregator/core.c static void ssam_serial_hub_remove(struct serdev_device *serdev) · line 840
Quoted 1 line
drivers/platform/surface/aggregator/core.c +1
-0+ .of_match_table = of_match_ptr(ssam_serial_hub_of_match),
There is ongoing task to drop of_match_ptr(), so for ACPI_PTR().
Quoted 3 lines
drivers/platform/surface/aggregator/core.c +0
-0.pm = &ssam_serial_hub_pm_ops, .shutdown = ssam_serial_hub_shutdown, .probe_type = PROBE_PREFER_ASYNCHRONOUS,
...
drivers/platform/surface/surface3_power.c static int mshw0011_install_space_handler(struct i2c_client *client) · line 484
Quoted 9 lines
drivers/platform/surface/surface3_power.c +1
-0@@ -479,6 +479,7 @@ static int mshw0011_install_space_handler(struct i2c_client *client) }acpi_dev_clear_dependencies (adev); +return 0 ; }
Stray change.
...
drivers/platform/surface/surface3_power.c static int mshw0011_install_space_handler(struct i2c_client *client)
Quoted 10 lines
drivers/platform/surface/surface3_power.c +10
-0+/* Devices for Surface Laptop 7. */ +static const struct software_node *ssam_node_group_sl7[] = { + &ssam_node_root, + &ssam_node_bat_ac, + &ssam_node_bat_main, + &ssam_node_tmp_perf_profile_with_fan, + &ssam_node_fan_speed, + &ssam_node_hid_sam_keyboard, +/* TODO: evaluate thermal sensors devices when we get a driver for that */ +NULL ,
At some point please drop commas at the terminator entries. This will make code more robust against quite unlikely but potential rebase-like mistakes (when a new entry is added behind the terminator).
Quoted 1 line
+};
...
drivers/platform/surface/surface3_power.c static const struct acpi_device_id ssam_platform_hub_match[] = { · line 416
Quoted 11 lines
drivers/platform/surface/surface3_power.c +2
-2-static const struct acpi_device_id ssam_platform_hub_match[] = { +static const struct acpi_device_id ssam_platform_hub_acpi_match[] = {/* Surface Pro 4, 5, and 6 (OMBR < 0x10) */ {"MSHW0081" , (unsigned long )ssam_node_group_gen5 },@@ -400,18 +413,41 @@ static const struct acpi_device_id ssam_platform_hub_match[] = { { }, }; -MODULE_DEVICE_TABLE (acpi, ssam_platform_hub_match); +MODULE_DEVICE_TABLE (acpi, ssam_platform_hub_acpi_match);
If renaming is needed, it can be done in a separate patch.
drivers/platform/surface/surface3_power.c static const struct acpi_device_id ssam_platform_hub_match[] = { · line 424
Quoted 8 lines
drivers/platform/surface/surface3_power.c +8
-0+#ifdef CONFIG_OF +static const struct of_device_id ssam_platform_hub_of_match[] = { +/* Surface Laptop 7 */ + { .compatible ="microsoft,romulus13" , (void *)ssam_node_group_sl7 }, + { .compatible ="microsoft,romulus15" , (void *)ssam_node_group_sl7 }, + { }, +}; +#endif
As per above.
...
drivers/platform/surface/surface3_power.c static const struct acpi_device_id ssam_platform_hub_match[] = { · line 434
Quoted 10 lines
drivers/platform/surface/surface3_power.c +2
-0static int ssam_platform_hub_probe (struct platform_device *pdev) {const struct software_node **nodes; +const struct of_device_id *match; +struct device_node *fdt_root;struct ssam_controller *ctrl;struct fwnode_handle *root;int status; nodes = (const struct software_node **)acpi_device_get_match_data (&pdev->dev);
Hmm... Why this doesn't use simple device_get_match_data()?
drivers/platform/surface/surface3_power.c static const struct acpi_device_id ssam_platform_hub_match[] = { · line 445
Quoted 13 lines
drivers/platform/surface/surface3_power.c +11
-2-if (!nodes) -return -ENODEV ; +if (!nodes) { + fdt_root =of_find_node_by_path ("/" ); +if (!fdt_root) +return -ENODEV ; + + match =of_match_node (ssam_platform_hub_of_match, fdt_root); +of_node_put (fdt_root); +if (!match) +return -ENODEV ; + + nodes = (const struct software_node **)match->data;
This is quite strange! Where are they being defined?
Quoted 3 lines
drivers/platform/surface/surface3_power.c +3
-0+if (!nodes) +return -ENODEV ; + }
...
Quoted 1 line
+MODULE_ALIAS("platform:surface_aggregator_platform_hub");
Can it be platfrom device ID table instead? But do you really need it?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v3 3/3] platform/surface: Add OF support
Hi Andy,
Thank you for the review.
Note this has already been merged though.
Still there are some good suggestions here for a follow-up cleanup patch.
Regards,
Hans
Quoted 270 lines · Andy Shevchenko
Wed, Aug 14, 2024 at 12:27:27PM +0200, Konrad Dybcio kirjoitti:
Quoted 15 lines
From: Konrad Dybcio <[email protected]>
Add basic support for registering the aggregator module on Device Tree- based platforms. These include at least three generations of Qualcomm Snapdragon-based Surface devices:
- SC8180X / SQ1 / SQ2: Pro X,
- SC8280XP / SQ3: Devkit 2023, Pro 9
- X Elite: Laptop 7 / Pro11Thankfully, the aggregators on these seem to be configured in an identical way, which allows for using these settings as defaults and no DT properties need to be introduced (until that changes, anyway).
Based on the work done by Maximilian Luz, largely rewritten.
...
drivers/platform/surface/aggregator/bus.c static int ssam_add_client_device(struct device *parent, struct ssam_controller · line 445
Quoted 2 lines
drivers/platform/surface/aggregator/bus.c +1
-0sdev->dev.fwnode =fwnode_handle_get (node); + sdev->dev.of_node =to_of_node (node);Please, use
device_set_node()instead of those two....
drivers/platform/surface/aggregator/controller.c int ssam_controller_caps_load_from_acpi(acpi_handle handle, · line 1176
Quoted 4 lines
drivers/platform/surface/aggregator/controller.c +3
-0+static int ssam_controller_caps_load (struct device *dev,struct ssam_controller_caps *caps) +{ +acpi_handle handle =ACPI_HANDLE (dev);It's a bit non-standard way to check if we run on DT or ACPI. The others (most of them?) do something like this:
struct fwnode_handle *fwnode = dev_fwnode(...); if (is_of_node(fwnode)) return X; if (is_acpi_node(fwnode)) // also more precise _device or _data variant return Y; return ERROR;drivers/platform/surface/aggregator/controller.c int ssam_controller_caps_load_from_acpi(acpi_handle handle, · line 1186
Quoted 9 lines
drivers/platform/surface/aggregator/controller.c +9
-0+/* Set defaults. */ + caps->ssh_power_profile =U32_MAX ; + caps->screen_on_sleep_idle_timeout =U32_MAX ; + caps->screen_off_sleep_idle_timeout =U32_MAX ; + caps->d3_closes_handle = false; + caps->ssh_buffer_size =U32_MAX ; + +if (handle) +return ssam_controller_caps_load_from_acpi (handle, caps);Yeah, I see that you use handle here, that's why it's up to you how to proceed with that.
drivers/platform/surface/aggregator/controller.c int ssam_controller_caps_load_from_acpi(acpi_handle handle, · line 1188
Quoted 2 lines
drivers/platform/surface/aggregator/controller.c +2
-0+else +return ssam_controller_caps_load_from_of (dev, caps);But just note that we have 4 options for fwnode type here and this covers 3 and I don't know if you ever have an ACPI data node or software node and what you want to do with that.
Quoted 1 line
+}
...
drivers/platform/surface/aggregator/controller.c int ssam_irq_setup(struct ssam_controller *ctrl) · line 2761
Quoted 12 lines
drivers/platform/surface/aggregator/controller.c +6
-5gpiod =gpiod_get (dev,"ssam_wakeup-int" ,GPIOD_ASIS ); -if (IS_ERR (gpiod)) -return PTR_ERR (gpiod); - - irq =gpiod_to_irq (gpiod); -gpiod_put (gpiod); +if (IS_ERR (gpiod)) { + irq =fwnode_irq_get (dev_fwnode (dev),0 ); + }else { + irq =gpiod_to_irq (gpiod); +gpiod_put (gpiod); + }Can't you try
fwnode_irq_get_byname()followed byfwnode_irq_get()? And why do you need unnamed variant to begin with? As far as I understand it's pure DT and names are there, no?...
Quoted 4 lines
#include <
linux/kernel.h>
#include <linux/kref.h>
#include <linux/module.h>
+#include <linux/of.h>I do not see how you use this. You probably missed
mod_devicetable.h.Quoted 4 lines
+#include <
linux/platform_device.h>
#include <linux/pm.h>
#include <linux/serdev.h>
#include <linux/sysfs.h>...
Quoted 6 lines
drivers/platform/surface/aggregator/core.c +6
-0+/* +* When using DT, we have to register the platform hub driver manually, +* as it can't be matched based on top-level board compatible (like it +* does the ACPI case). +*/ +if (!ssh) {drivers/platform/surface/aggregator/core.c static int ssam_serial_hub_probe(struct serdev_device *serdev)
Quoted 10 lines
drivers/platform/surface/aggregator/core.c +9
-0+struct platform_device *ph_pdev = +platform_device_register_simple ("surface_aggregator_platform_hub" , +0 ,NULL ,0 ); +if (IS_ERR (ph_pdev)) +return dev_err_probe (dev,PTR_ERR (ph_pdev), +"Failed to register the platform hub driver\n" ); + } + +if (ssh)Simply 'else' ? And making condition positive?
...
drivers/platform/surface/aggregator/core.c static void ssam_serial_hub_remove(struct serdev_device *serdev) · line 822
Quoted 4 lines
drivers/platform/surface/aggregator/core.c +1
-1-static const struct acpi_device_id ssam_serial_hub_match[] = { +static const struct acpi_device_id ssam_serial_hub_acpi_match[] = { {"MSHW0084" ,0 }, { },At some point, please drop that 0 part above and the comma in the terminator entry.
drivers/platform/surface/aggregator/core.c static void ssam_serial_hub_remove(struct serdev_device *serdev) · line 824
Quoted 3 lines
};
drivers/platform/surface/aggregator/core.c +1
-1-MODULE_DEVICE_TABLE (acpi, ssam_serial_hub_match); +MODULE_DEVICE_TABLE (acpi, ssam_serial_hub_acpi_match);Do you really need this renaming?
...
drivers/platform/surface/aggregator/core.c static void ssam_serial_hub_remove(struct serdev_device *serdev) · line 828
Quoted 3 lines
drivers/platform/surface/aggregator/core.c +3
-0+#ifdef CONFIG_OF +static const struct of_device_id ssam_serial_hub_of_match[] = { + { .compatible = "microsoft,surface-sam", },No inner comma.
Review
Quoted 1 line
(quoted diff) +1
-0+ { },No comma for the terminator.
drivers/platform/surface/aggregator/core.c static void ssam_serial_hub_remove(struct serdev_device *serdev) · line 839
Quoted 11 lines
drivers/platform/surface/aggregator/core.c +4
-1+}; +MODULE_DEVICE_TABLE (of, ssam_serial_hub_of_match); +#endif static struct serdev_device_driver ssam_serial_hub = { .probe = ssam_serial_hub_probe, .remove = ssam_serial_hub_remove, .driver = { .name ="surface_serial_hub" , - .acpi_match_table = ssam_serial_hub_match, + .acpi_match_table =ACPI_PTR (ssam_serial_hub_acpi_match),No, please do not use
ACPI_PTR(), it's more harmful than helpful.drivers/platform/surface/aggregator/core.c static void ssam_serial_hub_remove(struct serdev_device *serdev) · line 840
Quoted 1 line
drivers/platform/surface/aggregator/core.c +1
-0+ .of_match_table = of_match_ptr(ssam_serial_hub_of_match),There is ongoing task to drop
of_match_ptr(), so forACPI_PTR().Quoted 3 lines
drivers/platform/surface/aggregator/core.c +0
-0.pm = &ssam_serial_hub_pm_ops, .shutdown = ssam_serial_hub_shutdown, .probe_type = PROBE_PREFER_ASYNCHRONOUS,...
drivers/platform/surface/surface3_power.c static int mshw0011_install_space_handler(struct i2c_client *client) · line 484
Quoted 9 lines
drivers/platform/surface/surface3_power.c +1
-0@@ -479,6 +479,7 @@ static int mshw0011_install_space_handler(struct i2c_client *client) }acpi_dev_clear_dependencies (adev); +return 0 ; }Stray change.
...
drivers/platform/surface/surface3_power.c static int mshw0011_install_space_handler(struct i2c_client *client)
Quoted 10 lines
drivers/platform/surface/surface3_power.c +10
-0+/* Devices for Surface Laptop 7. */ +static const struct software_node *ssam_node_group_sl7[] = { + &ssam_node_root, + &ssam_node_bat_ac, + &ssam_node_bat_main, + &ssam_node_tmp_perf_profile_with_fan, + &ssam_node_fan_speed, + &ssam_node_hid_sam_keyboard, +/* TODO: evaluate thermal sensors devices when we get a driver for that */ +NULL ,At some point please drop commas at the terminator entries. This will make code more robust against quite unlikely but potential rebase-like mistakes (when a new entry is added behind the terminator).
Quoted 1 line
+};
...
drivers/platform/surface/surface3_power.c static const struct acpi_device_id ssam_platform_hub_match[] = { · line 416
Quoted 11 lines
drivers/platform/surface/surface3_power.c +2
-2-static const struct acpi_device_id ssam_platform_hub_match[] = { +static const struct acpi_device_id ssam_platform_hub_acpi_match[] = {/* Surface Pro 4, 5, and 6 (OMBR < 0x10) */ {"MSHW0081" , (unsigned long )ssam_node_group_gen5 },@@ -400,18 +413,41 @@ static const struct acpi_device_id ssam_platform_hub_match[] = { { }, }; -MODULE_DEVICE_TABLE (acpi, ssam_platform_hub_match); +MODULE_DEVICE_TABLE (acpi, ssam_platform_hub_acpi_match);If renaming is needed, it can be done in a separate patch.
drivers/platform/surface/surface3_power.c static const struct acpi_device_id ssam_platform_hub_match[] = { · line 424
Quoted 8 lines
drivers/platform/surface/surface3_power.c +8
-0+#ifdef CONFIG_OF +static const struct of_device_id ssam_platform_hub_of_match[] = { +/* Surface Laptop 7 */ + { .compatible ="microsoft,romulus13" , (void *)ssam_node_group_sl7 }, + { .compatible ="microsoft,romulus15" , (void *)ssam_node_group_sl7 }, + { }, +}; +#endif As per above.
...
drivers/platform/surface/surface3_power.c static const struct acpi_device_id ssam_platform_hub_match[] = { · line 434
Quoted 10 lines
drivers/platform/surface/surface3_power.c +2
-0static int ssam_platform_hub_probe (struct platform_device *pdev) {const struct software_node **nodes; +const struct of_device_id *match; +struct device_node *fdt_root;struct ssam_controller *ctrl;struct fwnode_handle *root;int status; nodes = (const struct software_node **)acpi_device_get_match_data (&pdev->dev);Hmm... Why this doesn't use simple
device_get_match_data()?drivers/platform/surface/surface3_power.c static const struct acpi_device_id ssam_platform_hub_match[] = { · line 445
Quoted 13 lines
drivers/platform/surface/surface3_power.c +11
-2-if (!nodes) -return -ENODEV ; +if (!nodes) { + fdt_root =of_find_node_by_path ("/" ); +if (!fdt_root) +return -ENODEV ; + + match =of_match_node (ssam_platform_hub_of_match, fdt_root); +of_node_put (fdt_root); +if (!match) +return -ENODEV ; + + nodes = (const struct software_node **)match->data;This is quite strange! Where are they being defined?
Quoted 3 lines
drivers/platform/surface/surface3_power.c +3
-0+if (!nodes) +return -ENODEV ; + }...
Quoted 1 line
+MODULE_ALIAS("platform:surface_aggregator_platform_hub");
Can it be platfrom device ID table instead? But do you really need it?
Re: [PATCH v3 3/3] platform/surface: Add OF support
Quoted 8 lines · Hans de Goede
Hi Andy,
Thank you for the review.
Note this has already been merged though.
Still there are some good suggestions here for a follow-up cleanup patch.
Andy, Hans
Is it fine if I submit a fat "address review comments" patch, or should I split it up per issue?
Konrad
Re: [PATCH v3 3/3] platform/surface: Add OF support
Hi,
Quoted 7 lines · Konrad Dybcio
Quoted 6 lines · Hans de Goede
Hi Andy,
Thank you for the review.
Note this has already been merged though.
Quoted 7 lines
Quoted 2 lines
Still there are some good suggestions here for a follow-up cleanup patch.
Andy, Hans
Is it fine if I submit a fat "address review comments" patch, or should I split it up per issue?
I would say use your best judgement / something in the middle.
IOW start with a fat "address review comments" patch and if specific parts turn out to be somewhat involved do 1 patch with smaller clean-ups and split out the involved parts in a separate patch.
Thanks & Regards,
Hans
Maximilian Luz
maintainerRe: [PATCH v3 3/3] platform/surface: Add OF support
In reply to Andy ShevchenkoHi,
I thought I should provide some context:
Am 26/08/2024 um 22:54 schrieb Andy Shevchenko:
Quoted 2 lines
Wed, Aug 14, 2024 at 12:27:27PM +0200, Konrad Dybcio kirjoitti:
Quoted 1 line
From: Konrad Dybcio <[email protected]>
[...]
Quoted 13 lines
Quoted 13 lines
drivers/platform/surface/aggregator/core.c +13
-0+/* +* When using DT, we have to register the platform hub driver manually, +* as it can't be matched based on top-level board compatible (like it +* does the ACPI case). +*/ +if (!ssh) { +struct platform_device *ph_pdev = +platform_device_register_simple ("surface_aggregator_platform_hub" , +0 ,NULL ,0 ); +if (IS_ERR (ph_pdev)) +return dev_err_probe (dev,PTR_ERR (ph_pdev), +"Failed to register the platform hub driver\n" ); + }
[...]
Quoted 13 lines
drivers/platform/surface/surface_aggregator_registry.c static const struct acpi_device_id ssam_platform_hub_match[] = { · line 436
Quoted 10 lines
static int ssam_platform_hub_probe(struct platform_device *pdev) { const struct software_node **nodes;drivers/platform/surface/surface_aggregator_registry.c +2
-0+const struct of_device_id *match; +struct device_node *fdt_root;struct ssam_controller *ctrl;struct fwnode_handle *root;int status; nodes = (const struct software_node **)acpi_device_get_match_data (&pdev->dev);Hmm... Why this doesn't use simple
device_get_match_data()?
Quoted 15 lines
drivers/platform/surface/surface_aggregator_registry.c static const struct acpi_device_id ssam_platform_hub_match[] = { · line 447
Quoted 13 lines
drivers/platform/surface/surface_aggregator_registry.c +11
-2-if (!nodes) -return -ENODEV ; +if (!nodes) { + fdt_root =of_find_node_by_path ("/" ); +if (!fdt_root) +return -ENODEV ; + + match =of_match_node (ssam_platform_hub_of_match, fdt_root); +of_node_put (fdt_root); +if (!match) +return -ENODEV ; + + nodes = (const struct software_node **)match->data;This is quite strange! Where are they being defined?
Essentially, this whole module is a giant workaround because there doesn't seem to be a way to auto-discover which functions or subdevices the EC actually supports. So this module builds a registry of software nodes and matches against a Surface-model-specific ACPI ID (in ACPI mode). Based on that ID, we retrieve the tree of software nodes that define the EC subdevices and register them using a (virtual) platform hub device.
The snippet way above registers the platform hub device for DT, because there we don't have an equivalent ACPI device that we can use. The code here retrieves the respective nodes.
Quoted 10 lines
Quoted 3 lines
drivers/platform/surface/surface_aggregator_registry.c +3
-0+if (!nodes) +return -ENODEV ; + }...
Quoted 1 line
+MODULE_ALIAS("platform:surface_aggregator_platform_hub");
Can it be platfrom device ID table instead? But do you really need it?
I think the explanation above already kind of answers this, but the module is named differently than the driver (so that they reflect the specific nature of each, registry vs hub device). And the platform hub device added in the snippet I left above is named after the driver. So for the registry module to load when the platform hub driver is requested, it is needed.
Regards,
Max
Re: [PATCH v3 3/3] platform/surface: Add OF support
Quoted 1 line · Maximilian Luz
I thought I should provide some context:
Thank you, my reply below.
Quoted 3 lines
Am 26/08/2024 um 22:54 schrieb Andy Shevchenko:
Quoted 2 lines
Wed, Aug 14, 2024 at 12:27:27PM +0200, Konrad Dybcio kirjoitti:
Quoted 1 line
From: Konrad Dybcio <[email protected]>
[...]
Quoted 28 lines
Quoted 4 lines
Quoted 1 line
nodes = (const struct software_node **)acpi_device_get_match_data(&pdev->dev);Hmm... Why this doesn't use simple
device_get_match_data()?Quoted 15 lines
drivers/platform/surface/surface_aggregator_registry.c static const struct acpi_device_id ssam_platform_hub_match[] = { · line 447
Quoted 13 lines
drivers/platform/surface/surface_aggregator_registry.c +11
-2-if (!nodes) -return -ENODEV ; +if (!nodes) { + fdt_root =of_find_node_by_path ("/" ); +if (!fdt_root) +return -ENODEV ; + + match =of_match_node (ssam_platform_hub_of_match, fdt_root); +of_node_put (fdt_root); +if (!match) +return -ENODEV ; + + nodes = (const struct software_node **)match->data;This is quite strange! Where are they being defined?
Essentially, this whole module is a giant workaround because there doesn't seem to be a way to auto-discover which functions or subdevices the EC actually supports. So this module builds a registry of software nodes and matches against a Surface-model-specific ACPI ID (in ACPI mode). Based on that ID, we retrieve the tree of software nodes that define the EC subdevices and register them using a (virtual) platform hub device.
Quoted 3 lines
The snippet way above registers the platform hub device for DT, because there we don't have an equivalent ACPI device that we can use. The code here retrieves the respective nodes.
Yes, and software nodes for DT are quite strange things! Why can't you simply fix the DT to begin with?
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/platform/surface/surface_aggregator_registry.c +3
-0+if (!nodes) +return -ENODEV ; + }
...
Quoted 11 lines
Quoted 4 lines
Quoted 1 line
+MODULE_ALIAS("platform:surface_aggregator_platform_hub");
Can it be platfrom device ID table instead? But do you really need it?
I think the explanation above already kind of answers this, but the module is named differently than the driver (so that they reflect the specific nature of each, registry vs hub device). And the platform hub device added in the snippet I left above is named after the driver. So for the registry module to load when the platform hub driver is requested, it is needed.
So, I believe it warrants a platform device ID table to make it explicit.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Maximilian Luz
maintainerRe: [PATCH v3 3/3] platform/surface: Add OF support
Quoted 40 lines · Andy Shevchenko
Quoted 1 line · Maximilian Luz
I thought I should provide some context:
Thank you, my reply below.
Quoted 3 lines
Am 26/08/2024 um 22:54 schrieb Andy Shevchenko:
Quoted 2 lines
Wed, Aug 14, 2024 at 12:27:27PM +0200, Konrad Dybcio kirjoitti:
Quoted 1 line
From: Konrad Dybcio <[email protected]>
[...]
Quoted 28 lines
Quoted 4 lines
Quoted 1 line
nodes = (const struct software_node **)acpi_device_get_match_data(&pdev->dev);Hmm... Why this doesn't use simple
device_get_match_data()?Quoted 15 lines
drivers/platform/surface/surface_aggregator_registry.c static const struct acpi_device_id ssam_platform_hub_match[] = { · line 447
Quoted 13 lines
drivers/platform/surface/surface_aggregator_registry.c +11
-2-if (!nodes) -return -ENODEV ; +if (!nodes) { + fdt_root =of_find_node_by_path ("/" ); +if (!fdt_root) +return -ENODEV ; + + match =of_match_node (ssam_platform_hub_of_match, fdt_root); +of_node_put (fdt_root); +if (!match) +return -ENODEV ; + + nodes = (const struct software_node **)match->data;This is quite strange! Where are they being defined?
Essentially, this whole module is a giant workaround because there doesn't seem to be a way to auto-discover which functions or subdevices the EC actually supports. So this module builds a registry of software nodes and matches against a Surface-model-specific ACPI ID (in ACPI mode). Based on that ID, we retrieve the tree of software nodes that define the EC subdevices and register them using a (virtual) platform hub device.
Quoted 6 lines
Quoted 3 lines
The snippet way above registers the platform hub device for DT, because there we don't have an equivalent ACPI device that we can use. The code here retrieves the respective nodes.
Yes, and software nodes for DT are quite strange things! Why can't you simply fix the DT to begin with?
For the ARM/DT variants we could do that. But we still have to deal with the x86/ACPI ones here. So for me it makes more sense to have it unified and just deal with everything in this module.
Also, if we consider that at some point we might get ACPI PEP support (I know, far fetched right now): With that, ACPI on ARM might be feasible and then we'd have to manage the same thing in two places...
And lastly, the EC subdevices are quite contained and I don't see them interacting with any other components in the DT, so it's more of a stylistic choice where to put them.
Quoted 11 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/platform/surface/surface_aggregator_registry.c +3
-0+if (!nodes) +return -ENODEV ; + }...
Quoted 5 lines
Quoted 4 lines
Quoted 1 line
+MODULE_ALIAS("platform:surface_aggregator_platform_hub");
Can it be platfrom device ID table instead? But do you really need it?
Quoted 8 lines
Quoted 6 lines
I think the explanation above already kind of answers this, but the module is named differently than the driver (so that they reflect the specific nature of each, registry vs hub device). And the platform hub device added in the snippet I left above is named after the driver. So for the registry module to load when the platform hub driver is requested, it is needed.
So, I believe it warrants a platform device ID table to make it explicit.
Yes, that makes sense. (I was not arguing against that, just wanted to explain why we need the match at all.)
Best regards,
Max
Re: [PATCH v3 3/3] platform/surface: Add OF support
Quoted 2 lines · Maximilian Luz
Quoted 1 line · Andy Shevchenko
On Wed, Aug 28, 2024 at 12:10 PM Maximilian Luz <[email protected]> wrote:
...
Quoted 5 lines
Quoted 2 lines
Yes, and software nodes for DT are quite strange things! Why can't you simply fix the DT to begin with?
For the ARM/DT variants we could do that. But we still have to deal with the x86/ACPI ones here.
So, then fix it there! Currently it's an abuse of software nodes inside the Linux kernel.
Quoted 2 lines
So for me it makes more sense to have it unified
and just deal with everything in this module.
I understand the desire, but DT is DT and ACPI is ACPI, they are different despite having some common APIs in the Linux kernel. Moreover, DT has a validation tools and everything, making that being a software nodes has at least these disadvantages:
- no official schema that must be supported and users are known of
- no validation done
- bloating of the Linux kernel binary and hence memory footprint
Quoted 3 lines
Also, if we consider that at some point we might get ACPI PEP support (I know, far fetched right now): With that, ACPI on ARM might be feasible and then we'd have to manage the same thing in two places...
This (PEP) is something I have no knowledge about. But I think it's still orthogonal to the software nodes usage.
Quoted 3 lines
And lastly, the EC subdevices are quite contained and I don't see them interacting with any other components in the DT, so it's more of a stylistic choice where to put them.
They are still part of hardware and DT describes hardware.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v3 3/3] platform/surface: Add OF support
Quoted 18 lines · Andy Shevchenko
Quoted 2 lines · Maximilian Luz
Quoted 1 line · Andy Shevchenko
On Wed, Aug 28, 2024 at 12:10 PM Maximilian Luz <[email protected]> wrote:
...
Quoted 5 lines
Quoted 2 lines
Yes, and software nodes for DT are quite strange things! Why can't you simply fix the DT to begin with?
For the ARM/DT variants we could do that. But we still have to deal with the x86/ACPI ones here.
So, then fix it there! Currently it's an abuse of software nodes inside the Linux kernel.
Quoted 2 lines
So for me it makes more sense to have it unified
and just deal with everything in this module.
Quoted 7 lines
I understand the desire, but DT is DT and ACPI is ACPI, they are different despite having some common APIs in the Linux kernel. Moreover, DT has a validation tools and everything, making that being a software nodes has at least these disadvantages:
- no official schema that must be supported and users are known of
- no validation done
- bloating of the Linux kernel binary and hence memory footprint
Arguably the last point isn't very strong.. DT also has to store some strings and pointers to represent devices
Quoted 7 lines
Quoted 4 lines
Also, if we consider that at some point we might get ACPI PEP support (I know, far fetched right now): With that, ACPI on ARM might be feasible and then we'd have to manage the same thing in two places...
This (PEP) is something I have no knowledge about. But I think it's still orthogonal to the software nodes usage.
The PEP (Power Engine Plugin) unfortunately is the reason we can't have ACPI-based boot on WoA platforms.. This two-or-three-digit megabyte Windows driver hardcodes almost everything related to the on-SoC power management (buses, clocks, etc.) and only uses the bare minimum ACPI it needs to connect devices to a bus or get notifications on standard events..
Quoted 6 lines
Quoted 4 lines
And lastly, the EC subdevices are quite contained and I don't see them interacting with any other components in the DT, so it's more of a stylistic choice where to put them.
They are still part of hardware and DT describes hardware.
Unfortunately the "Surface Aggregator Module" is just a firmware exposed on some range of MCUs running MSFT's code..
Given how.. peculiarly the "bus" that it hosts """devices""" on is constructed (5-level-deep hierarchy without it making much sense beyond maaaybe the first two), it's not really easy to describe in DT in a way that would be both true to the bigger picture and make enough sense to convince the DT maintainers, I don't think
Konrad
Hi,
Quoted 8 lines · Konrad Dybcio
Wire up OF support for SSAM drivers, to use with Surface Laptop 7 and other Qualcomm-based devices.
Patch 3 references compatible strings introduced in [1]
[1] https://lore.kernel.org/linux-arm-msm/[email protected]/T/#u
Signed-off-by Konrad Dybcio <[email protected]>
Thank you for your patch-series, I've applied the series to my review-hans branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans
I did notice the following compiler warning when test building:
drivers/platform/surface/surface_aggregator_registry.c:278:36: warning: ‘ssam_node_group_sl7’ defined but not used [-Wunused-variable]
278 | static const struct software_node *ssam_node_group_sl7[] = {
| ^~~~~~~~~~~~~~~~~~~One way to fix this would be add #ifdef CONFIG_OF around the definition of ssam_node_group_sl7, but then future devicetree based surface devices would need more #ifdef-s so instead I've solved it by squashing in this fix:
drivers/platform/surface/surface_aggregator_registry.c +1 -3
@@ -415,14 +415,12 @@ static const struct acpi_device_id ssam_platform_hub_acpi_match[] = { };MODULE_DEVICE_TABLE (acpi, ssam_platform_hub_acpi_match); -#ifdef CONFIG_OF -static const struct of_device_id ssam_platform_hub_of_match[] = { +static const struct of_device_id ssam_platform_hub_of_match[]__maybe_unused = {/* Surface Laptop 7 */ { .compatible ="microsoft,romulus13" , (void *)ssam_node_group_sl7 }, { .compatible ="microsoft,romulus15" , (void *)ssam_node_group_sl7 }, { }, }; -#endif static int ssam_platform_hub_probe (struct platform_device *pdev) {
Once I've run some tests on this branch the patches there will be added to the platform-drivers-x86/for-next branch and eventually will be included in the pdx86 pull-request to Linus for the next merge-window.
Regards,
Hans
Quoted 38 lines
---
Changes in v3:
- Drop unnecessary nullchecks
- AddMODULE_ALIASin the platform hub driver
- FixMODULE_DEVICE_TABLEafter rename
- Prolong the '----' comment to 80 lines
- Change the current-speed bindings description to ": true", in preparation for krzk's serial device bindings reorganization
- Link to v2: https://lore.kernel.org/r/[email protected]Changes in v2:
- Fix kerneldoc
- Drop thedrivers/acpichange (oops)
- Style fixes
- Don't assign int toacpi_status
- Don't scan the bus twice in SAM core probe
- Link to v1: https://lore.kernel.org/r/[email protected]---
Konrad Dybcio (3):
dt-bindings: serial: Allow embedded-controller as child node
dt-bindings: platform: Add Surface System Aggregator Module platform/surface: Add OF support.../bindings/platform/microsoft,surface-sam.yaml | 47 +++++++++++++ .../devicetree/bindings/serial/serial.yaml | 2 +- drivers/platform/surface/aggregator/bus.c | 2 + drivers/platform/surface/aggregator/controller.c | 67 ++++++++++++++---- drivers/platform/surface/aggregator/core.c | 82 +++++++++++++++++----- drivers/platform/surface/surface3_power.c | 1 + drivers/platform/surface/surface_acpi_notify.c | 1 + .../platform/surface/surface_aggregator_registry.c | 47 +++++++++++-- 8 files changed, 210 insertions(+), 39 deletions(-)---
base-commit:1e391b34f6aa043c7afa40a2103163a0ef06d179
change-id: 20240809-topic-sam-5de2f0ec9370Best regards,
Quoted 47 lines · Hans de Goede
Hi,
Quoted 8 lines · Konrad Dybcio
Wire up OF support for SSAM drivers, to use with Surface Laptop 7 and other Qualcomm-based devices.
Patch 3 references compatible strings introduced in [1]
[1] https://lore.kernel.org/linux-arm-msm/[email protected]/T/#u
Signed-off-by Konrad Dybcio <[email protected]>Thank you for your patch-series, I've applied the series to my review-hans branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hansI did notice the following compiler warning when test building:
drivers/platform/surface/surface_aggregator_registry.c:278:36: warning: ‘ssam_node_group_sl7’ defined but not used [-Wunused-variable]278 | static const struct software_node *ssam_node_group_sl7[] = { | ^~~~~~~~~~~~~~~~~~~One way to fix this would be add #ifdef
CONFIG_OFaround the definition ofssam_node_group_sl7, but then future devicetree based surface devices would need more #ifdef-s so instead I've solved it by squashing in this fix:drivers/platform/surface/surface_aggregator_registry.c +1
-3@@ -415,14 +415,12 @@ static const struct acpi_device_id ssam_platform_hub_acpi_match[] = { };MODULE_DEVICE_TABLE (acpi, ssam_platform_hub_acpi_match); -#ifdef CONFIG_OF -static const struct of_device_id ssam_platform_hub_of_match[] = { +static const struct of_device_id ssam_platform_hub_of_match[]__maybe_unused = {/* Surface Laptop 7 */ { .compatible ="microsoft,romulus13" , (void *)ssam_node_group_sl7 }, { .compatible ="microsoft,romulus15" , (void *)ssam_node_group_sl7 }, { }, }; -#endif static int ssam_platform_hub_probe (struct platform_device *pdev) {
Quoted 4 lines
Once I've run some tests on this branch the patches there will be added to the platform-drivers-x86/for-next branch and eventually will be included in the pdx86 pull-request to Linus for the next merge-window.
Thanks for pointing this out. Your fix seems to be the best solution I can think of, so I'm all for it
Konrad
Maximilian Luz
maintainerQuoted 47 lines · Hans de Goede
Hi,
Quoted 8 lines · Konrad Dybcio
Wire up OF support for SSAM drivers, to use with Surface Laptop 7 and other Qualcomm-based devices.
Patch 3 references compatible strings introduced in [1]
[1] https://lore.kernel.org/linux-arm-msm/[email protected]/T/#u
Signed-off-by Konrad Dybcio <[email protected]>Thank you for your patch-series, I've applied the series to my review-hans branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hansI did notice the following compiler warning when test building:
drivers/platform/surface/surface_aggregator_registry.c:278:36: warning: ‘ssam_node_group_sl7’ defined but not used [-Wunused-variable]278 | static const struct software_node *ssam_node_group_sl7[] = { | ^~~~~~~~~~~~~~~~~~~One way to fix this would be add #ifdef
CONFIG_OFaround the definition ofssam_node_group_sl7, but then future devicetree based surface devices would need more #ifdef-s so instead I've solved it by squashing in this fix:drivers/platform/surface/surface_aggregator_registry.c +1
-3@@ -415,14 +415,12 @@ static const struct acpi_device_id ssam_platform_hub_acpi_match[] = { };MODULE_DEVICE_TABLE (acpi, ssam_platform_hub_acpi_match); -#ifdef CONFIG_OF -static const struct of_device_id ssam_platform_hub_of_match[] = { +static const struct of_device_id ssam_platform_hub_of_match[]__maybe_unused = {/* Surface Laptop 7 */ { .compatible ="microsoft,romulus13" , (void *)ssam_node_group_sl7 }, { .compatible ="microsoft,romulus15" , (void *)ssam_node_group_sl7 }, { }, }; -#endif static int ssam_platform_hub_probe (struct platform_device *pdev) {
Quoted 4 lines
Once I've run some tests on this branch the patches there will be added to the platform-drivers-x86/for-next branch and eventually will be included in the pdx86 pull-request to Linus for the next merge-window.
I agree with Konrad, this looks like the best way to address this. Thanks!
Best regards,
Max
Wed, Aug 14, 2024 at 12:27:24PM +0200, Konrad Dybcio kirjoitti:
Quoted 6 lines
Wire up OF support for SSAM drivers, to use with Surface Laptop 7 and other Qualcomm-based devices.
Patch 3 references compatible strings introduced in [1]
[1] https://lore.kernel.org/linux-arm-msm/[email protected]/T/#u
Please, Cc to me the v4.
Signature · 2 lines
With Best Regards, Andy Shevchenko