},
};
-static inline int find_codec_info_part(unsigned int part_id)
+static inline int find_codec_info_part(u64 adr)
{
+ unsigned int part_id, sdw_version;
int i;
+ part_id = SDW_PART_ID(adr);
+ sdw_version = SDW_VERSION(adr);
for (i = 0; i < ARRAY_SIZE(codec_info_list); i++)
- if (part_id == codec_info_list[i].id)
- break;
+ /*
+ * A codec info is for all sdw version with the part id if
+ * version_id is not specified in the codec info.
+ */
+ if (part_id == codec_info_list[i].id &&
+ (!codec_info_list[i].version_id ||
+ sdw_version == codec_info_list[i].version_id))
+ return i;
- if (i == ARRAY_SIZE(codec_info_list))
- return -EINVAL;
+ return -EINVAL;
- return i;
}
static inline int find_codec_info_acpi(const u8 *acpi_id)
for (link = links; link->num_adr; link++) {
const struct snd_soc_acpi_endpoint *endpoint;
- int part_id, codec_index;
+ int codec_index;
int stream;
u64 adr;
adr = link->adr_d->adr;
- part_id = SDW_PART_ID(adr);
- codec_index = find_codec_info_part(part_id);
+ codec_index = find_codec_info_part(adr);
if (codec_index < 0)
return codec_index;
if (!codec[comp_index].name)
return -ENOMEM;
- codec_index = find_codec_info_part(part_id);
+ codec_index = find_codec_info_part(adr);
if (codec_index < 0)
return codec_index;
* same group.
*/
for (i = 0; i < link->num_adr; i++) {
- unsigned int part_id;
int codec_index;
- part_id = SDW_PART_ID(link->adr_d[i].adr);
- codec_index = find_codec_info_part(part_id);
+ codec_index = find_codec_info_part(link->adr_d[i].adr);
if (codec_index < 0)
return codec_index;
struct snd_soc_dai_link_component *codecs;
int cpu_dai_id[SDW_MAX_CPU_DAIS];
int cpu_dai_num, cpu_dai_index;
- unsigned int part_id, group_id;
+ unsigned int group_id;
int codec_idx = 0;
int i = 0, j = 0;
int codec_index;
}
/* find codec info to create BE DAI */
- part_id = SDW_PART_ID(link->adr_d[0].adr);
- codec_index = find_codec_info_part(part_id);
+ codec_index = find_codec_info_part(link->adr_d[0].adr);
if (codec_index < 0)
return codec_index;