sof icon indicating copy to clipboard operation
sof copied to clipboard

Misc zephyr native drivers fixes

Open juimonen opened this issue 3 years ago • 5 comments

juimonen avatar Aug 11 '22 15:08 juimonen

Here's a more runtime version of dai_get_zephyr_driver:

#define GET_DEVICE_LIST(node) DEVICE_DT_GET(node),

const struct device * z_dev[] = {
        DT_FOREACH_STATUS_OKAY(intel_ssp_dai, GET_DEVICE_LIST)
        DT_FOREACH_STATUS_OKAY(intel_dmic, GET_DEVICE_LIST)
        DT_FOREACH_STATUS_OKAY(intel_alh_dai, GET_DEVICE_LIST)
};

const struct device *dai_get_zephyr_driver(uint32_t type, uint32_t index)
{
        int i;

        for (i = 0; i < ARRAY_SIZE(z_dev); i++) {
                const struct dai_config *cfg = dai_config_get(z_dev[i], DAI_DIR_BOTH);
                if ((cfg->type == type) && (cfg->dai_index == index))
                        return z_dev[i];       
        }                                      

        return NULL;
}

galak avatar Aug 11 '22 17:08 galak

Here's a more runtime version of dai_get_zephyr_driver:

#define GET_DEVICE_LIST(node) DEVICE_DT_GET(node),

const struct device * z_dev[] = {
        DT_FOREACH_STATUS_OKAY(intel_ssp_dai, GET_DEVICE_LIST)
        DT_FOREACH_STATUS_OKAY(intel_dmic, GET_DEVICE_LIST)
        DT_FOREACH_STATUS_OKAY(intel_alh_dai, GET_DEVICE_LIST)
};

const struct device *dai_get_zephyr_driver(uint32_t type, uint32_t index)
{
        int i;

        for (i = 0; i < ARRAY_SIZE(z_dev); i++) {
                const struct dai_config *cfg = dai_config_get(z_dev[i], DAI_DIR_BOTH);
                if ((cfg->type == type) && (cfg->dai_index == index))
                        return z_dev[i];       
        }                                      

        return NULL;
}

yeah thanks looks better! probably need to combine the array initialization with kconfig ifdefs... anyway will test this.

juimonen avatar Aug 12 '22 05:08 juimonen

so please hold with this one for a while, I got stuck with a regression in zephyr dai drivers: https://github.com/zephyrproject-rtos/zephyr/issues/49012, so can't post the new version without testing.

juimonen avatar Aug 12 '22 15:08 juimonen

new version: depends on https://github.com/zephyrproject-rtos/zephyr/pull/49072

juimonen avatar Aug 16 '22 08:08 juimonen

@juimonen pls ping when the Zephyr PR is merged and then we can merge this and update our west commit (after some validation).

lgirdwood avatar Aug 16 '22 14:08 lgirdwood

SOFCI TEST

lgirdwood avatar Aug 22 '22 10:08 lgirdwood

SOFCI TEST

lgirdwood avatar Aug 24 '22 12:08 lgirdwood

This is apparently causing new build failure #6192

marc-hb avatar Aug 26 '22 07:08 marc-hb