summaryrefslogtreecommitdiff
path: root/drivers/platform/chrome
diff options
context:
space:
mode:
authorTzung-Bi Shih <tzungbi@kernel.org>2022-05-23 17:08:21 +0800
committerTzung-Bi Shih <tzungbi@kernel.org>2022-06-10 02:31:42 +0000
commitfd1e8054ff6985cfcbdf66a6de88cf1c47a14f46 (patch)
tree77adc310ff337d790d6c2316f4e8404adc41fad9 /drivers/platform/chrome
parent20f370efddb58c497588a51df889dc784055733f (diff)
downloadlwn-fd1e8054ff6985cfcbdf66a6de88cf1c47a14f46.tar.gz
lwn-fd1e8054ff6985cfcbdf66a6de88cf1c47a14f46.zip
platform/chrome: cros_kbd_led_backlight: support OF match
For letting device tree based machines to use the driver, support OF match. Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org> Reviewed-by: Matthias Kaehlcke <mka@chromium.org> Link: https://lore.kernel.org/r/20220523090822.3035189-5-tzungbi@kernel.org
Diffstat (limited to 'drivers/platform/chrome')
-rw-r--r--drivers/platform/chrome/cros_kbd_led_backlight.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/platform/chrome/cros_kbd_led_backlight.c b/drivers/platform/chrome/cros_kbd_led_backlight.c
index a86d664854ae..4bca880d7721 100644
--- a/drivers/platform/chrome/cros_kbd_led_backlight.c
+++ b/drivers/platform/chrome/cros_kbd_led_backlight.c
@@ -10,7 +10,9 @@
#include <linux/kernel.h>
#include <linux/leds.h>
#include <linux/module.h>
+#include <linux/of.h>
#include <linux/platform_device.h>
+#include <linux/property.h>
#include <linux/slab.h>
/**
@@ -116,7 +118,7 @@ static int keyboard_led_probe(struct platform_device *pdev)
const struct keyboard_led_drvdata *drvdata;
int error;
- drvdata = acpi_device_get_match_data(&pdev->dev);
+ drvdata = device_get_match_data(&pdev->dev);
if (!drvdata)
return -EINVAL;
@@ -152,10 +154,21 @@ static const struct acpi_device_id keyboard_led_acpi_match[] = {
MODULE_DEVICE_TABLE(acpi, keyboard_led_acpi_match);
#endif
+#ifdef CONFIG_OF
+static const struct of_device_id keyboard_led_of_match[] = {
+ {
+ .compatible = "google,cros-kbd-led-backlight",
+ },
+ {}
+};
+MODULE_DEVICE_TABLE(of, keyboard_led_of_match);
+#endif
+
static struct platform_driver keyboard_led_driver = {
.driver = {
.name = "chromeos-keyboard-leds",
.acpi_match_table = ACPI_PTR(keyboard_led_acpi_match),
+ .of_match_table = of_match_ptr(keyboard_led_of_match),
},
.probe = keyboard_led_probe,
};