drivers: dai: alh: set rate and channels from config blob
This will use config blob to set rate and channels params Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
This commit is contained in:
parent
e7f32329ba
commit
c3659da65a
|
@ -35,16 +35,25 @@ static int dai_alh_set_config_tplg(struct dai_intel_alh *dp, const void *spec_co
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int dai_alh_set_config_blob(struct dai_intel_alh *dp, const void *spec_config)
|
||||
static int dai_alh_set_config_blob(struct dai_intel_alh *dp, const struct dai_config *cfg,
|
||||
const void *spec_config)
|
||||
{
|
||||
struct dai_intel_alh_pdata *alh = dai_get_drvdata(dp);
|
||||
const struct dai_intel_ipc4_alh_configuration_blob *blob = spec_config;
|
||||
const struct ipc4_alh_multi_gtw_cfg *alh_cfg = &blob->alh_cfg;
|
||||
|
||||
alh->params.channels = ALH_CHANNELS_DEFAULT;
|
||||
alh->params.rate = ALH_RATE_DEFAULT;
|
||||
/* the LSB 8bits are for stream id */
|
||||
alh->params.stream_id = alh_cfg->mapping[0].alh_id & 0xff;
|
||||
alh->params.rate = cfg->rate;
|
||||
|
||||
for (int i = 0; i < alh_cfg->count; i++) {
|
||||
/* the LSB 8bits are for stream id */
|
||||
int alh_id = alh_cfg->mapping[i].alh_id & 0xff;
|
||||
|
||||
if (IPC4_ALH_DAI_INDEX(alh_id) == dp->index) {
|
||||
alh->params.stream_id = alh_id;
|
||||
alh->params.channels = popcount(alh_cfg->mapping[i].channel_mask);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -103,7 +112,7 @@ static int dai_alh_config_set(const struct device *dev, const struct dai_config
|
|||
if (cfg->type == DAI_INTEL_ALH) {
|
||||
return dai_alh_set_config_tplg(dp, bespoke_cfg);
|
||||
} else {
|
||||
return dai_alh_set_config_blob(dp, bespoke_cfg);
|
||||
return dai_alh_set_config_blob(dp, cfg, bespoke_cfg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,12 @@
|
|||
#define IPC4_ALH_MAX_NUMBER_OF_GTW 16
|
||||
#define IPC4_ALH_DAI_INDEX_OFFSET 7
|
||||
|
||||
/* copier id = (group id << 4) + codec id + IPC4_ALH_DAI_INDEX_OFFSET
|
||||
* dai_index = (group id << 8) + codec id;
|
||||
*/
|
||||
#define IPC4_ALH_DAI_INDEX(x) ((((x) & 0xF0) << DAI_NUM_ALH_BI_DIR_LINKS_GROUP) + \
|
||||
(((x) & 0xF) - IPC4_ALH_DAI_INDEX_OFFSET))
|
||||
|
||||
#define ALH_GPDMA_BURST_LENGTH 4
|
||||
|
||||
#define ALH_SET_BITS(b_hi, b_lo, x) \
|
||||
|
|
Loading…
Reference in a new issue