Message ID | 1397471802-27216-3-git-send-email-ben.dooks@codethink.co.uk (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Hello. On 14-04-2014 14:36, Ben Dooks wrote: > 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 <ben.dooks@codethink.co.uk> > --- > drivers/media/i2c/adv7180.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c > index 215afa0..687d97b 100644 > --- a/drivers/media/i2c/adv7180.c > +++ b/drivers/media/i2c/adv7180.c [...] > @@ -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. > +static const struct of_device_id adv7180_of_id[] = { > + { .compatible = "adi,adv7180", }, > + { }, > +}; > + > +MODULE_DEVICE_TABLE(of, adv7180_of_id) > +#endif WBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hello. On 04/14/2014 02:36 PM, Ben Dooks wrote: > 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 <ben.dooks@codethink.co.uk> 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 -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 05/09/2014 03:23 AM, Sergei Shtylyov wrote: >> 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 <ben.dooks@codethink.co.uk> > 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. 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 -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Fri, May 9, 2014 at 1:47 AM, Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> wrote: > On 05/09/2014 03:23 AM, Sergei Shtylyov wrote: > >>> 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" >>> device. > >>> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> > >> 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. > > 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 -- geert@linux-m68k.org 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 -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hello. On 05/09/2014 11:01 AM, Geert Uytterhoeven wrote: >>>> 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. >>>> device. >>>> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> >>> 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. >> 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... > Gr{oetje,eeting}s, > Geert WBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hello. On 04/14/2014 02:36 PM, Ben Dooks wrote: > 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 <ben.dooks@codethink.co.uk> > --- > drivers/media/i2c/adv7180.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c > index 215afa0..687d97b 100644 > --- a/drivers/media/i2c/adv7180.c > +++ b/drivers/media/i2c/adv7180.c [...] > @@ -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), Duh, this doesn't even compile: the field is called 'of_match_table' actually. WBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c index 215afa0..687d97b 100644 --- a/drivers/media/i2c/adv7180.c +++ b/drivers/media/i2c/adv7180.c @@ -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,
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 <ben.dooks@codethink.co.uk> --- drivers/media/i2c/adv7180.c | 11 +++++++++++ 1 file changed, 11 insertions(+)