sound/soc/intel/boards/skl_hda_dsp_generic.c

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

File Facts

System
Linux kernel
Corpus path
sound/soc/intel/boards/skl_hda_dsp_generic.c
Extension
.c
Size
4628 bytes
Lines
179
Domain
Driver Families
Bucket
sound/soc
Inferred role
Driver Families: implementation source
Status
source 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 (hda_pvt) {
			/*
			 * all codecs are on the same bus, so it's sufficient
			 * to look up only the first one
			 */
			snd_hda_set_power_save(hda_pvt->codec->bus,
					       HDA_CODEC_AUTOSUSPEND_DELAY_MS);
			break;
		}
	}
}

#define IDISP_HDMI_BE_ID	1
#define HDA_BE_ID		4
#define DMIC01_BE_ID		6
#define DMIC16K_BE_ID		7
#define BT_OFFLOAD_BE_ID	8

#define HDA_LINK_ORDER	SOF_LINK_ORDER(SOF_LINK_IDISP_HDMI,  \
				       SOF_LINK_HDA,        \
				       SOF_LINK_DMIC01,     \
				       SOF_LINK_DMIC16K,    \
				       SOF_LINK_BT_OFFLOAD, \
				       SOF_LINK_NONE,       \
				       SOF_LINK_NONE)

#define HDA_LINK_IDS	SOF_LINK_ORDER(IDISP_HDMI_BE_ID,  \
				       HDA_BE_ID,        \
				       DMIC01_BE_ID,     \
				       DMIC16K_BE_ID,    \
				       BT_OFFLOAD_BE_ID, \
				       0,                \
				       0)

static unsigned long
skl_hda_get_board_quirk(struct snd_soc_acpi_mach_params *mach_params)
{
	unsigned long board_quirk = 0;
	int ssp_bt;

	if (hweight_long(mach_params->bt_link_mask) == 1) {
		ssp_bt = fls(mach_params->bt_link_mask) - 1;
		board_quirk |= SOF_SSP_PORT_BT_OFFLOAD(ssp_bt) |
				SOF_BT_OFFLOAD_PRESENT;
	}

	return board_quirk;
}

static int skl_hda_add_dai_link(struct snd_soc_card *card,
				struct snd_soc_dai_link *link)
{
	struct sof_card_private *ctx = snd_soc_card_get_drvdata(card);

	/* Ignore the HDMI PCM link if iDisp is not present */
	if (strstr(link->stream_name, "HDMI") && !ctx->hdmi.idisp_codec)
		link->ignore = true;

	return 0;
}

static int skl_hda_audio_probe(struct platform_device *pdev)
{
	struct snd_soc_acpi_mach *mach = pdev->dev.platform_data;
	struct sof_card_private *ctx;
	struct snd_soc_card *card;
	unsigned long board_quirk = skl_hda_get_board_quirk(&mach->mach_params);
	int ret;

	card = devm_kzalloc(&pdev->dev, sizeof(struct snd_soc_card), GFP_KERNEL);
	if (!card)
		return -ENOMEM;

	card->name = "hda-dsp";
	card->owner = THIS_MODULE;
	card->fully_routed = true;
	card->late_probe = skl_hda_card_late_probe;
	card->add_dai_link = skl_hda_add_dai_link;

	dev_dbg(&pdev->dev, "board_quirk = %lx\n", board_quirk);

	/* initialize ctx with board quirk */
	ctx = sof_intel_board_get_ctx(&pdev->dev, board_quirk);
	if (!ctx)
		return -ENOMEM;

	if (HDA_EXT_CODEC(mach->mach_params.codec_mask))
		ctx->hda_codec_present = true;

	if (mach->mach_params.codec_mask & IDISP_CODEC_MASK)

Annotation

Implementation Notes