adv7180: add of match table
Subsystems (3)
PATCH v3 2/7 adv7180: add of match table
Add a proper of match id for use when the device is being bound via device tree, to avoid having to use the i2c old-style binding of the device.
--- drivers/media/i2c/adv7180.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/media/i2c/adv7180.c +11 -0
@@ -25,6 +25,7 @@#include <linux/interrupt.h> #include <linux/i2c.h> #include <linux/slab.h> +#include <linux/of.h> #include <media/v4l2-ioctl.h> #include <linux/videodev2.h> #include <media/v4l2-device.h>
@@ -695,11 +696,21 @@ static SIMPLE_DEV_PM_OPS(adv7180_pm_ops, adv7180_suspend, adv7180_resume);MODULE_DEVICE_TABLE (i2c, adv7180_id); +#ifdef CONFIG_OF +static const struct of_device_id adv7180_of_id[] = { + { .compatible ="adi,adv7180" , }, + { }, +}; + +MODULE_DEVICE_TABLE(of, adv7180_of_id) +#endif +static struct i2c_driver adv7180_driver = { .driver = { .owner =THIS_MODULE , .name =KBUILD_MODNAME , .pm =ADV7180_PM_OPS , + .of_match =of_match_ptr (adv7180_of_id), }, .probe = adv7180_probe, .remove = adv7180_remove,
Signature · 1 line
1.9.1
Hello.
Quoted 13 lines · Ben Dooks
Add a proper of match id for use when the device is being bound via device tree, to avoid having to use the i2c old-style binding of the device.
Signed-off-by Ben Dooks <[email protected]>--- drivers/media/i2c/adv7180.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/media/i2c/adv7180.c +0
-0
[...]
drivers/media/i2c/adv7180.c static SIMPLE_DEV_PM_OPS(adv7180_pm_ops, adv7180_suspend, adv7180_resume); · line 699
Quoted 5 lines
drivers/media/i2c/adv7180.c +1
-0@@ -695,11 +696,21 @@ static SIMPLE_DEV_PM_OPS(adv7180_pm_ops, adv7180_suspend, adv7180_resume);MODULE_DEVICE_TABLE (i2c, adv7180_id); +#ifdef CONFIG_OF
Don't think it's worth using #ifdef.
drivers/media/i2c/adv7180.c static SIMPLE_DEV_PM_OPS(adv7180_pm_ops, adv7180_suspend, adv7180_resume); · line 706
Quoted 7 lines
drivers/media/i2c/adv7180.c +7
-0+static const struct of_device_id adv7180_of_id[] = { + { .compatible ="adi,adv7180" , }, + { }, +}; + +MODULE_DEVICE_TABLE(of, adv7180_of_id) +#endif
WBR, Sergei
Hello.
Quoted 5 lines · Ben Dooks
Add a proper of match id for use when the device is being bound via device tree, to avoid having to use the i2c old-style binding of the device.
Signed-off-by Ben Dooks <[email protected]>
From looking at of_i2c_register_devices() in drivers/i2c/i2c-core.c, I got
an impression we don't need this patch. This function builds the I2C device name by calling of_modalias_node() which just strips the vendor prefix (if any) from the "compatible" prop.
WBR, Sergei
Quoted 10 lines · Sergei Shtylyov
Quoted 5 lines
Add a proper of match id for use when the device is being bound via device tree, to avoid having to use the i2c old-style binding of the device.
Signed-off-by Ben Dooks <[email protected]>From looking at
of_i2c_register_devices()indrivers/i2c/i2c-core.c, I got
an impression we don't need this patch. This function builds the I2C device name by callingof_modalias_node()which just strips the vendor prefix (if any) from the "compatible" prop.
Yeah, I was able to get the ADV7180 device from DT probed without this
patch. So, no, we don't need the patch.
WBR, Sergei
Quoted 4 lines · Sergei Shtylyov
Quoted 2 lines · Sergei Shtylyov
Quoted 2 lines
Add a proper of match id for use when the device is being bound via device tree, to avoid having to use the i2c old-style binding of the
"to avoid having to use the i2c old-style binding"
Quoted 11 lines
Quoted 10 lines
Quoted 3 lines
device.
Signed-off-by Ben Dooks <[email protected]>From looking at
of_i2c_register_devices()indrivers/i2c/i2c-core.c, I
got
an impression we don't need this patch. This function builds the I2C device
name by callingof_modalias_node()which just strips the vendor prefix (if any) from the "compatible" prop.
Quoted 2 lines
Yeah, I was able to get the ADV7180 device from DT probed without this
patch. So, no, we don't need the patch.
So it works without, but it's better to use the full name.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Hello.
Quoted 4 lines · Geert Uytterhoeven
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Add a proper of match id for use when the device is being bound via device tree, to avoid having to use the i2c old-style binding of the
"to avoid having to use the i2c old-style binding"
Ah, I'd probably missed these words.
Quoted 11 lines
Quoted 10 lines
Quoted 10 lines
Quoted 3 lines
device.
Signed-off-by Ben Dooks <[email protected]>From looking at
of_i2c_register_devices()indrivers/i2c/i2c-core.c, I
got
an impression we don't need this patch. This function builds the I2C device
name by callingof_modalias_node()which just strips the vendor prefix (if any) from the "compatible" prop.
Quoted 4 lines
Quoted 2 lines
Yeah, I was able to get the ADV7180 device from DT probed without this
patch. So, no, we don't need the patch.So it works without, but it's better to use the full name.
OK, I'll see how it binds to the driver with this patch applied...
Quoted 2 lines
Gr{oetje,eeting}s,
Geert
WBR, Sergei
Hello.
Quoted 13 lines · Ben Dooks
Add a proper of match id for use when the device is being bound via device tree, to avoid having to use the i2c old-style binding of the device.
Signed-off-by Ben Dooks <[email protected]>--- drivers/media/i2c/adv7180.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/media/i2c/adv7180.c +0
-0
[...]
Quoted 9 lines
drivers/media/i2c/adv7180.c +5
-0@@ -695,11 +696,21 @@ static SIMPLE_DEV_PM_OPS(adv7180_pm_ops, adv7180_suspend, adv7180_resume);MODULE_DEVICE_TABLE (i2c, adv7180_id); +#ifdef CONFIG_OF +static const struct of_device_id adv7180_of_id[] = { + { .compatible ="adi,adv7180" , }, + { }, +};
drivers/media/i2c/adv7180.c static SIMPLE_DEV_PM_OPS(adv7180_pm_ops, adv7180_suspend, adv7180_resume); · line 713
Quoted 10 lines
drivers/media/i2c/adv7180.c +5
-0+ +MODULE_DEVICE_TABLE(of, adv7180_of_id) +#endif +static struct i2c_driver adv7180_driver = { .driver = { .owner =THIS_MODULE , .name =KBUILD_MODNAME , .pm =ADV7180_PM_OPS , + .of_match =of_match_ptr (adv7180_of_id),
Duh, this doesn't even compile: the field is called 'of_match_table' actually.
WBR, Sergei