sound/soc/intel/boards/sof_ssp_amp.c

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

File Facts

System
Linux kernel
Corpus path
sound/soc/intel/boards/sof_ssp_amp.c
Extension
.c
Size
6303 bytes
Lines
246
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

// SPDX-License-Identifier: GPL-2.0-only
//
// Copyright(c) 2022 Intel Corporation

/*
 * sof_ssp_amp.c - ASoc Machine driver for Intel platforms
 * with RT1308/CS35L41 codec.
 */

#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/dmi.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <sound/core.h>
#include <sound/jack.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/sof.h>
#include "sof_board_helpers.h"
#include "sof_realtek_common.h"
#include "sof_cirrus_common.h"

/* Driver-specific board quirks: from bit 0 to 7 */
#define SOF_HDMI_PLAYBACK_PRESENT		BIT(0)

/* Default: SSP2  */
static unsigned long sof_ssp_amp_quirk = SOF_SSP_PORT_AMP(2);

static const struct dmi_system_id chromebook_platforms[] = {
	{
		.ident = "Google Chromebooks",
		.matches = {
			DMI_MATCH(DMI_SYS_VENDOR, "Google"),
		}
	},
	{},
};

static int sof_card_late_probe(struct snd_soc_card *card)
{
	return sof_intel_board_card_late_probe(card);
}

static struct snd_soc_card sof_ssp_amp_card = {
	.name         = "ssp_amp",
	.owner        = THIS_MODULE,
	.fully_routed = true,
	.late_probe = sof_card_late_probe,
};

/* BE ID defined in sof-tgl-rt1308-hdmi-ssp.m4 */
#define HDMI_IN_BE_ID		0
#define SPK_BE_ID		2
#define DMIC01_BE_ID		3
#define INTEL_HDMI_BE_ID	5
/* extra BE links to support no-hdmi-in boards */
#define DMIC16K_BE_ID		4
#define BT_OFFLOAD_BE_ID	8

#define SSP_AMP_LINK_ORDER	SOF_LINK_ORDER(SOF_LINK_HDMI_IN, \
					SOF_LINK_AMP,            \
					SOF_LINK_DMIC01,         \
					SOF_LINK_DMIC16K,        \
					SOF_LINK_IDISP_HDMI,     \
					SOF_LINK_BT_OFFLOAD,     \
					SOF_LINK_NONE)

#define SSP_AMP_LINK_IDS	SOF_LINK_ORDER(HDMI_IN_BE_ID, \
					SPK_BE_ID,            \
					DMIC01_BE_ID,         \
					DMIC16K_BE_ID,        \
					INTEL_HDMI_BE_ID,     \
					BT_OFFLOAD_BE_ID,     \
					0)

static int
sof_card_dai_links_create(struct device *dev, struct snd_soc_card *card,
			  struct sof_card_private *ctx)
{
	int ret;

	ret = sof_intel_board_set_dai_link(dev, card, ctx);
	if (ret)
		return ret;

	if (ctx->amp_type == CODEC_NONE)
		return 0;

	if (!ctx->amp_link) {

Annotation

Implementation Notes