mxsfb_tda19988 patch for kernel 4.1.15

Discussion in 'UDOO NEO' started by Wadim Mueller, Sep 2, 2016.

  1. Wadim Mueller

    Wadim Mueller New Member

    Joined:
    Sep 2, 2016
    Messages:
    1
    Likes Received:
    0
    Hi guys,
    I currently try to get the udoo-neo-basic running with kernel 4.1.15 cloned from freescale. I just copied the tda19988 drivers from the udoo 3.14 repo and integrated them, but the screen remains black during the boot. So I just dig around in the driver and figured out that the problem is the initialization order of mxsfb.c and mxsfb_tda19988.c. We need that the tda19988 driver is initialized before the mxsfb driver so that the notfier call can be made by the fb subsystem when mxsfb is registered. Because both drivers are registered with the module_init() macro there is no guarantee about the order in which they are called because the function pointers land at the same linker input section and i believe that the linker does not specify a order in this case (but maybe i am wrong on this). So in my opinion it is a coincidence that the driver is working with the 3.14 kernel (maybe i am wrong on this too).
    Nevertheless here is a simple patch for fixing this problem by just moving the initialization of the tda19988 driver to the subsys initcalls. I think this should also be applied to kernel 3.14.

    best regards

    diff --git a/drivers/video/fbdev/mxsfb_tda19988.c b/drivers/video/fbdev/mxsfb_tda19988.c
    index 2bca2ee..b879ebc 100644
    --- a/drivers/video/fbdev/mxsfb_tda19988.c
    +++ b/drivers/video/fbdev/mxsfb_tda19988.c
    -module_i2c_driver(tda19988_driver);
    +
    +static __init int tda19988_init(void) {
    + return i2c_add_driver(&tda19988_driver);
    +}
    +
    +static void tda19988_exit(void) {
    + i2c_del_driver(&tda19988_driver);
    +}
    +
    +/* must be called before mxsfb is registered*/
    +subsys_initcall(tda19988_init);
    +module_exit(tda19988_exit);

    MODULE_AUTHOR("Jasbir Matharu");
    MODULE_DESCRIPTION("UDOO NEO TDA19988 HDMI driver");
     
  2. Andrea Rovai

    Andrea Rovai Well-Known Member

    Joined:
    Oct 27, 2014
    Messages:
    1,703
    Likes Received:
    240
    Hi there @Wadim Mueller, if you think it is a good change for the official kernel please make a pull request please.
     
  3. jas-mx

    jas-mx Active Member

    Joined:
    Dec 31, 2013
    Messages:
    407
    Likes Received:
    118
    If the file(s) are in the right directory then the code should work without this change.
     

Share This Page