iio: light: ltr501: Add of_device_id table
authorNikita Travkin <nikita@trvn.ru>
Wed, 6 Oct 2021 16:30:58 +0000 (21:30 +0500)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Wed, 20 Oct 2021 13:43:51 +0000 (14:43 +0100)
Add of_device_id table so the driver can be used on DT platforms without
relying on i2c_device_id fallback. (So DT schema validation is possible)

Signed-off-by: Nikita Travkin <nikita@trvn.ru>
Link: https://lore.kernel.org/r/20211006163058.145842-4-nikita@trvn.ru
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/light/ltr501.c

index 57851c8ef1c6a6dea483580c41e07794d926d907..7e51aaac0bf86db63dd1717b816bfd3b3f6a3b12 100644 (file)
@@ -1609,9 +1609,18 @@ static const struct i2c_device_id ltr501_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, ltr501_id);
 
+static const struct of_device_id ltr501_of_match[] = {
+       { .compatible = "liteon,ltr501", },
+       { .compatible = "liteon,ltr559", },
+       { .compatible = "liteon,ltr301", },
+       {}
+};
+MODULE_DEVICE_TABLE(of, ltr501_of_match);
+
 static struct i2c_driver ltr501_driver = {
        .driver = {
                .name   = LTR501_DRV_NAME,
+               .of_match_table = ltr501_of_match,
                .pm     = &ltr501_pm_ops,
                .acpi_match_table = ACPI_PTR(ltr_acpi_match),
        },