Skip to content
Permalink
Browse files
platform/chrome: cros_kbd_led_backlight: support OF match
Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
  • Loading branch information
Tzung-Bi Shih authored and intel-lab-lkp committed Feb 14, 2022
1 parent 2bdfb7c commit 8f5fc05563b71136a2ab6f2cb5a068a152267965
Showing 1 changed file with 15 additions and 2 deletions.
@@ -10,6 +10,7 @@
#include <linux/kernel.h>
#include <linux/leds.h>
#include <linux/module.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/slab.h>

@@ -128,8 +129,11 @@ static int keyboard_led_probe(struct platform_device *pdev)
int error;

drvdata = acpi_device_get_match_data(&pdev->dev);
if (!drvdata)
return -EINVAL;
if (!drvdata) {
drvdata = of_device_get_match_data(&pdev->dev);
if (!drvdata)
return -EINVAL;
}

if (drvdata->init) {
error = drvdata->init(pdev);
@@ -161,10 +165,19 @@ static const struct acpi_device_id keyboard_led_acpi_match[] = {
};
MODULE_DEVICE_TABLE(acpi, keyboard_led_acpi_match);

static const struct of_device_id keyboard_led_of_match[] = {
{
.compatible = "google,cros-kbd-led-backlight",
},
{}
};
MODULE_DEVICE_TABLE(of, keyboard_led_of_match);

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,
};

0 comments on commit 8f5fc05

Please sign in to comment.