|
20 | 20 | /* size of tplg ABI in bytes */
|
21 | 21 | #define SOF_IPC3_TPLG_ABI_SIZE 3
|
22 | 22 |
|
| 23 | +/* Base of SOF_DAI_INTEL_ALH, this should be aligned with SOC_SDW_INTEL_BIDIR_PDI_BASE */ |
| 24 | +#define INTEL_ALH_DAI_INDEX_BASE 2 |
| 25 | + |
23 | 26 | struct sof_widget_data {
|
24 | 27 | int ctrl_type;
|
25 | 28 | int ipc_cmd;
|
@@ -1509,6 +1512,17 @@ static int sof_ipc3_widget_setup_comp_dai(struct snd_sof_widget *swidget)
|
1509 | 1512 | if (ret < 0)
|
1510 | 1513 | goto free;
|
1511 | 1514 |
|
| 1515 | + /* Subtract the base to match the FW dai index. */ |
| 1516 | + if (comp_dai->type == SOF_DAI_INTEL_ALH) { |
| 1517 | + if (comp_dai->dai_index < INTEL_ALH_DAI_INDEX_BASE) { |
| 1518 | + dev_err(sdev->dev, |
| 1519 | + "Invalid ALH dai index %d, only Pin numbers >= %d can be used\n", |
| 1520 | + comp_dai->dai_index, INTEL_ALH_DAI_INDEX_BASE); |
| 1521 | + return -EINVAL; |
| 1522 | + } |
| 1523 | + comp_dai->dai_index -= INTEL_ALH_DAI_INDEX_BASE; |
| 1524 | + } |
| 1525 | + |
1512 | 1526 | dev_dbg(scomp->dev, "dai %s: type %d index %d\n",
|
1513 | 1527 | swidget->widget->name, comp_dai->type, comp_dai->dai_index);
|
1514 | 1528 | sof_dbg_comp_config(scomp, &comp_dai->config);
|
@@ -2076,8 +2090,16 @@ static int sof_ipc3_dai_config(struct snd_sof_dev *sdev, struct snd_sof_widget *
|
2076 | 2090 | case SOF_DAI_INTEL_ALH:
|
2077 | 2091 | if (data) {
|
2078 | 2092 | /* save the dai_index during hw_params and reuse it for hw_free */
|
2079 |
| - if (flags & SOF_DAI_CONFIG_FLAGS_HW_PARAMS) |
2080 |
| - config->dai_index = data->dai_index; |
| 2093 | + if (flags & SOF_DAI_CONFIG_FLAGS_HW_PARAMS) { |
| 2094 | + /* Subtract the base to match the FW dai index. */ |
| 2095 | + if (data->dai_index < INTEL_ALH_DAI_INDEX_BASE) { |
| 2096 | + dev_err(sdev->dev, |
| 2097 | + "Invalid ALH dai index %d, only Pin numbers >= %d can be used\n", |
| 2098 | + config->dai_index, INTEL_ALH_DAI_INDEX_BASE); |
| 2099 | + return -EINVAL; |
| 2100 | + } |
| 2101 | + config->dai_index = data->dai_index - INTEL_ALH_DAI_INDEX_BASE; |
| 2102 | + } |
2081 | 2103 | config->alh.stream_id = data->dai_data;
|
2082 | 2104 | }
|
2083 | 2105 | break;
|
|
0 commit comments