Unverified Commit cb0ae6f2 authored by Bard Liao's avatar Bard Liao Committed by Mark Brown
Browse files

ASoC: sdw_utils: subtract the endpoint that is not present

When asoc_sdw_count_sdw_endpoints() count the num_ends, it doesn't skip
the unpresented endpoints. But, asoc_sdw_parse_sdw_endpoints() will skip
the unpresented endpoints either by quirk or the SDCA function doesn't
show up the endpoint. The endpoint number mismatches between count and
parse and the machine driver will show up a warning about it.

Fixes: 26ee34d2 ("ASoC: sdw_utils: Add codec_conf for every DAI")
Closes: https://github.com/thesofproject/linux/issues/5620


Signed-off-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: default avatarPéter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: default avatarVijendar Mukunda <Vijendar.Mukunda@amd.com>
Reviewed-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20251212121112.3313017-1-yung-chuan.liao@linux.intel.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 9f4d0899
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -1534,8 +1534,10 @@ int asoc_sdw_parse_sdw_endpoints(struct snd_soc_card *card,
					 * endpoint check is not necessary
					 */
					if (dai_info->quirk &&
					    !(dai_info->quirk_exclude ^ !!(dai_info->quirk & ctx->mc_quirk)))
					    !(dai_info->quirk_exclude ^ !!(dai_info->quirk & ctx->mc_quirk))) {
						(*num_devs)--;
						continue;
					}
				} else {
					/* Check SDCA codec endpoint if there is no matching quirk */
					ret = is_sdca_endpoint_present(dev, codec_info, adr_link, i, j);
@@ -1543,9 +1545,11 @@ int asoc_sdw_parse_sdw_endpoints(struct snd_soc_card *card,
						return ret;

					/* The endpoint is not present, skip */
					if (!ret)
					if (!ret) {
						(*num_devs)--;
						continue;
					}
				}

				dev_dbg(dev,
					"Add dev: %d, 0x%llx end: %d, dai: %d, %c/%c to %s: %d\n",