sound/soc/intel/boards/bdw-rt5677.c

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

File Facts

System
Linux kernel
Corpus path
sound/soc/intel/boards/bdw-rt5677.c
Extension
.c
Size
12957 bytes
Lines
461
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

struct bdw_rt5677_priv {
	struct gpio_desc *gpio_hp_en;
	struct snd_soc_component *component;
};

static int bdw_rt5677_event_hp(struct snd_soc_dapm_widget *w,
			struct snd_kcontrol *k, int event)
{
	struct snd_soc_card *card = snd_soc_dapm_to_card(w->dapm);
	struct bdw_rt5677_priv *bdw_rt5677 = snd_soc_card_get_drvdata(card);

	if (SND_SOC_DAPM_EVENT_ON(event))
		msleep(70);

	gpiod_set_value_cansleep(bdw_rt5677->gpio_hp_en,
		SND_SOC_DAPM_EVENT_ON(event));

	return 0;
}

static const struct snd_soc_dapm_widget bdw_rt5677_widgets[] = {
	SND_SOC_DAPM_HP("Headphone", bdw_rt5677_event_hp),
	SND_SOC_DAPM_SPK("Speaker", NULL),
	SND_SOC_DAPM_MIC("Headset Mic", NULL),
	SND_SOC_DAPM_MIC("Local DMICs", NULL),
	SND_SOC_DAPM_MIC("Remote DMICs", NULL),
};

static const struct snd_soc_dapm_route bdw_rt5677_map[] = {
	/* Speakers */
	{"Speaker", NULL, "PDM1L"},
	{"Speaker", NULL, "PDM1R"},

	/* Headset jack connectors */
	{"Headphone", NULL, "LOUT1"},
	{"Headphone", NULL, "LOUT2"},
	{"IN1P", NULL, "Headset Mic"},
	{"IN1N", NULL, "Headset Mic"},

	/* Digital MICs
	 * Local DMICs: the two DMICs on the mainboard
	 * Remote DMICs: the two DMICs on the camera module
	 */
	{"DMIC L1", NULL, "Remote DMICs"},
	{"DMIC R1", NULL, "Remote DMICs"},
	{"DMIC L2", NULL, "Local DMICs"},
	{"DMIC R2", NULL, "Local DMICs"},

	/* CODEC BE connections */
	{"SSP0 CODEC IN", NULL, "AIF1 Capture"},
	{"AIF1 Playback", NULL, "SSP0 CODEC OUT"},
	{"DSP Capture", NULL, "DSP Buffer"},

	/* DSP Clock Connections */
	{ "DSP Buffer", NULL, "SSP0 CODEC IN" },
	{ "SSP0 CODEC IN", NULL, "DSPTX" },
};

static const struct snd_kcontrol_new bdw_rt5677_controls[] = {
	SOC_DAPM_PIN_SWITCH("Speaker"),
	SOC_DAPM_PIN_SWITCH("Headphone"),
	SOC_DAPM_PIN_SWITCH("Headset Mic"),
	SOC_DAPM_PIN_SWITCH("Local DMICs"),
	SOC_DAPM_PIN_SWITCH("Remote DMICs"),
};


static struct snd_soc_jack headphone_jack;
static struct snd_soc_jack mic_jack;

static struct snd_soc_jack_pin headphone_jack_pin = {
	.pin	= "Headphone",
	.mask	= SND_JACK_HEADPHONE,
};

static struct snd_soc_jack_pin mic_jack_pin = {
	.pin	= "Headset Mic",
	.mask	= SND_JACK_MICROPHONE,
};

static struct snd_soc_jack_gpio headphone_jack_gpio = {
	.name			= "plug-det",
	.report			= SND_JACK_HEADPHONE,
	.debounce_time		= 200,
};

static struct snd_soc_jack_gpio mic_jack_gpio = {
	.name			= "mic-present",
	.report			= SND_JACK_MICROPHONE,
	.debounce_time		= 200,

Annotation

Implementation Notes