[FAQ] TDA4VM: How to ensure that dependent module drivers are probed before depending driver

Part Number: TDA4VM

In Linux how to ensure that all the dependent drivers are probed before depending driver is probed such
that the driver probe does not error out due to the dependent devices being absent.

Ex: Custom TDA4 Board with PPS signal connected from GPS device to GPIO0_125. How to ensure that GPIO driver gets probed and PPS driver
probe succeeds.

  • Hi,

    You can use EPROBE_DEFER return so that you can end up probing again when you have GPIO probed.
    Typically this is how most of the dependencies are taken care. So when the gpio request not successful in depending
    driver You should return EPROBE_DEFER from your driver probe. The linux framework will automatically
    try to probe again at a later point of time.

    Ex: File: "drivers/gpio/gpio-adnp.c"
    Function: adnp_i2c_probe

    client->irq = irq_of_parse_and_map(np, 0);
    if (!client->irq)
    return -EPROBE_DEFER;

    Similarly when your gpio_request fails in your driver probe you can return EPROBE_DEFER.

    This ensures that Linux kernel probes the depending driver again after the dependent driver is probed &
    ensures depending driver probes successfully.

    Best Regards,