Commit fd1e8054 authored by Tzung-Bi Shih's avatar Tzung-Bi Shih
Browse files

platform/chrome: cros_kbd_led_backlight: support OF match



For letting device tree based machines to use the driver, support OF match.

Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarTzung-Bi Shih <tzungbi@kernel.org>
Reviewed-by: default avatarMatthias Kaehlcke <mka@chromium.org>
Link: https://lore.kernel.org/r/20220523090822.3035189-5-tzungbi@kernel.org
parent 20f370ef
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -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,
};