Skip to content

Conversation

@bardliao
Copy link
Collaborator

For some reason, we check if the DAI is registered before checking the endpoint is present. It will cause problem if the codec driver doesn't register the DAI of the unexist endpoint.

@bardliao
Copy link
Collaborator Author

@charleskeepax Can you remind me why we added the DAI registered check? I vaguely remember below code could return error in a few corner cases. But I can't remember which cases are they.

        sdw_dev = bus_find_device_by_name(&sdw_bus_type, NULL, sdw_codec_name);
        if (!sdw_dev) {
                dev_err(dev, "codec %s not found\n", sdw_codec_name);
                return -EINVAL;
        }

        slave = dev_to_sdw_dev(sdw_dev);
        if (!slave) {
                ret = -EINVAL;
                goto put_device;
        }

I tested on my ARL + cs42l43 device and blocked list the snd_soc_cs42l43 module and load it later and it seems work fine.

Checking for a registered DAI for non-existing endpoints causes the
following error. The driver will always return -EPROBE_DEFER if the
codec driver doesn't register the DAI of the unexist endpoint.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
@bardliao bardliao marked this pull request as ready for review December 30, 2025 06:22
@charleskeepax
Copy link

charleskeepax commented Jan 9, 2026

Apologies for the slow response this got a bit lost in the christmas rush. I think the discussion was here:

#5188 (comment)

I think the concern is if the codec probes between this code and when the card is created. That would allow the card to be created, but the endpoint detection here might have already decided the endpoint wasn't there.

@bardliao
Copy link
Collaborator Author

Apologies for the slow response this got a bit lost in the christmas rush. I think the discussion was here:

#5188 (comment)

I think the concern is if the codec probes between this code and when the card is created. That would allow the card to be created, but the endpoint detection here might have already decided the endpoint wasn't there.

Thanks @charleskeepax for the feedback. However, sdca_lookup_functions() is called in sdw_slave_add() which is not supposed to rely on the codec driver probe. Besides, sdw_slave_add() is called by sdw_acpi_find_one(). And we use the acpi data to decide which machine driver should be used. So I think in theory, we should already get the sdca functions here, right?

@charleskeepax
Copy link

But this line:

sdw_dev = bus_find_device_by_name(&sdw_bus_type, NULL, sdw_codec_name);

Rather unavoidably relies on the codec driver probing? I think maybe you could get away with returning probe defer if that fails, maybe?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants