Post Go back to editing

ADRV9002 Kernel Module Support

Category: Choose a category
Product Number: ADRV9002BBCZ
Software Version: 2021_R1

We're using the Petalinux build of the 2021_R1 branch, and we're about to switch away from our ZCU102 and transceiver devkits to actual hardware.
With the way that the device clock needs to be configured on our board, it would be very beneficial to be able to load the ADRV9002 driver after boot as a kernel module.
In looking at the kernel config, it appears that the driver can only be built into the kernel and has no module support.

Is there a specific reason why the ADRV9001/9002 driver doesn't support being built as a module?
And if being built/loaded as a module should work, any idea the difficulty in converting the code to make this happen?

Thanks,
~Seth

Parents
  • HI,

    Yeah, in our linux tree we just compile everything built in as we want all the drivers enabled and to be compiled (so that we catch up possible compile time issues when moving to newer kernels). However, you should be able to compile adrv9002 as a module by changing the configuration.

    Not that "Build all Analog Devices Kernel Drivers" is disabled and the IIO drivers is now changed to "M". With this, you can go and change ADRV9001 to compile as a module.

    - Nuno Sá

  • Ahhh gotcha!
    It was the disabling of 'Build All Analog Devices Kernel Drivers' that i was missing-
    didnt realize this acted like a switch for the build options below it. In retrospect, I should have realized this.
    Appreciate the help!

    Thanks,
    ~Seth

  • Yeah, but this actually made me work on this:

    https://github.com/analogdevicesinc/linux/pull/2022

    Now, it's easier to disable, turn things into modules...

    - Nuno Sá

  • So i'm just getting around to testing this out:
    After changing the above configuration like you've recommended:


    and verifying this updated kernel config is getting picked up, when i boot my system i was hoping to see the adrv9002 driver in the /lib/modules/ directory (or somewhere on the file system). 

    Any idea if there are additional steps needed for this to work? (I'm using petalinux 2019.1)
    The adrv9002 driver definitely is not being loaded at boot now- i'm guessing because its presumably being built as a module that's not being included, or potentially not being built at all with this change.

    Thanks,
    ~Seth

  • Just to add a bit more information:
    once i save this configuration and then re-run menuconfig, it appears that menuconfig is confused by this configuration and de-selects entries that i previously selected:


    Ive tried making them all modules as well, and changing the IIO drivers to modules.
    This ends up with failures when trying to compile the kernel modules during the petalinux build.

    ~Seth

  • Hi,

    So i'm just getting around to testing this out:
    After changing the above configuration like you've recommended:

    How are you changing your config? You should be using 'petalinux-config -c kernel'...

    once i save this configuration and then re-run menuconfig, it appears that menuconfig is confused by this configuration and de-selects entries that i previously selected:

    Well, you do have 'CONFIG_KERNEL_ALL_ADI_DRIVERS not set' and this might be the problem... If you do it on the defcondig file, then none of the drivers below CONFIG_KERNEL_ALL_ADI_DRIVERS will be enabled:

    https://github.com/analogdevicesinc/linux/blob/master/Kconfig.adi#L28

    And I can see SPI in there which means adrv9002 is most likely not being build (as it depends on spi)...

    The adrv9002 driver definitely is not being loaded at boot now

    Not sure if you can make auto-loading work out of the box... You can play with KERNEL_MODULE_AUTOLOAD to see if it works but I think the driver needs a missing table for auto-load to work...

    Ive tried making them all modules as well, and changing the IIO drivers to modules.
    This ends up with failures when trying to compile the kernel modules during the petalinux build.

    Yeah, might be a problem as I suspect not all drivers are playing well when build as modules...

    - Nuno Sá

  • Also did a quick test... On the master branch, I can see the module being populated on the image:

    - Nuno Sá

Reply Children
No Data