sound/soc/intel/boards/sof_board_helpers.c

Source file repositories/reference/linux-study-clean/sound/soc/intel/boards/sof_board_helpers.c

File Facts

System
Linux kernel
Corpus path
sound/soc/intel/boards/sof_board_helpers.c
Extension
.c
Size
18561 bytes
Lines
786
Domain
Driver Families
Bucket
sound/soc
Inferred role
Driver Families: exported/initcall integration point
Status
integration implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (ctx->link_id_overwrite) {
			be_id = link_ids & SOF_LINK_IDS_MASK;
			link_ids >>= SOF_LINK_IDS_SHIFT;
		} else {
			/* use array index as link id */
			be_id = idx;
		}

		switch (link) {
		case SOF_LINK_CODEC:
			/* headphone codec */
			if (ctx->codec_type == CODEC_NONE)
				continue;

			ret = set_ssp_codec_link(dev, &links[idx], be_id,
						 ctx->codec_type, ctx->ssp_codec);
			if (ret) {
				dev_err(dev, "fail to set codec link, ret %d\n",
					ret);
				return ret;
			}

			ctx->codec_link = &links[idx];
			idx++;
			break;
		case SOF_LINK_DMIC01:
			/* dmic01 */
			if (ctx->dmic_be_num == 0)
				continue;

			/* at least we have dmic01 */
			ret = set_dmic_link(dev, &links[idx], be_id, SOF_DMIC_01);
			if (ret) {
				dev_err(dev, "fail to set dmic01 link, ret %d\n",
					ret);
				return ret;
			}

			idx++;
			break;
		case SOF_LINK_DMIC16K:
			/* dmic16k */
			if (ctx->dmic_be_num <= 1)
				continue;

			/* set up 2 BE links at most */
			ret = set_dmic_link(dev, &links[idx], be_id,
					    SOF_DMIC_16K);
			if (ret) {
				dev_err(dev, "fail to set dmic16k link, ret %d\n",
					ret);
				return ret;
			}

			idx++;
			break;
		case SOF_LINK_IDISP_HDMI:
			/* idisp HDMI */
			for (i = 1; i <= ctx->hdmi_num; i++) {
				ret = set_idisp_hdmi_link(dev, &links[idx],
							  be_id, i,
							  ctx->hdmi.idisp_codec);
				if (ret) {
					dev_err(dev, "fail to set hdmi link, ret %d\n",
						ret);
					return ret;
				}

				idx++;
				be_id++;
			}
			break;
		case SOF_LINK_AMP:
			/* speaker amp */
			if (ctx->amp_type == CODEC_NONE)
				continue;

			ret = set_ssp_amp_link(dev, &links[idx], be_id,
					       ctx->amp_type, ctx->ssp_amp);
			if (ret) {
				dev_err(dev, "fail to set amp link, ret %d\n",
					ret);
				return ret;
			}

			ctx->amp_link = &links[idx];
			idx++;
			break;
		case SOF_LINK_BT_OFFLOAD:
			/* BT audio offload */

Annotation

Implementation Notes