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

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

File Facts

System
Linux kernel
Corpus path
sound/soc/intel/boards/bdw-rt5650.c
Extension
.c
Size
9235 bytes
Lines
336
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_rt5650_priv {
	struct gpio_desc *gpio_hp_en;
	struct snd_soc_component *component;
};

static const struct snd_soc_dapm_widget bdw_rt5650_widgets[] = {
	SND_SOC_DAPM_HP("Headphone", NULL),
	SND_SOC_DAPM_SPK("Speaker", NULL),
	SND_SOC_DAPM_MIC("Headset Mic", NULL),
	SND_SOC_DAPM_MIC("DMIC Pair1", NULL),
	SND_SOC_DAPM_MIC("DMIC Pair2", NULL),
};

static const struct snd_soc_dapm_route bdw_rt5650_map[] = {
	/* Speakers */
	{"Speaker", NULL, "SPOL"},
	{"Speaker", NULL, "SPOR"},

	/* Headset jack connectors */
	{"Headphone", NULL, "HPOL"},
	{"Headphone", NULL, "HPOR"},
	{"IN1P", NULL, "Headset Mic"},
	{"IN1N", NULL, "Headset Mic"},

	/* Digital MICs
	 * DMIC Pair1 are the two DMICs connected on the DMICN1 connector.
	 * DMIC Pair2 are the two DMICs connected on the DMICN2 connector.
	 * Facing the camera, DMIC Pair1 are on the left side, DMIC Pair2
	 * are on the right side.
	 */
	{"DMIC L1", NULL, "DMIC Pair1"},
	{"DMIC R1", NULL, "DMIC Pair1"},
	{"DMIC L2", NULL, "DMIC Pair2"},
	{"DMIC R2", NULL, "DMIC Pair2"},

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

static const struct snd_kcontrol_new bdw_rt5650_controls[] = {
	SOC_DAPM_PIN_SWITCH("Speaker"),
	SOC_DAPM_PIN_SWITCH("Headphone"),
	SOC_DAPM_PIN_SWITCH("Headset Mic"),
	SOC_DAPM_PIN_SWITCH("DMIC Pair1"),
	SOC_DAPM_PIN_SWITCH("DMIC Pair2"),
};


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 int broadwell_ssp0_fixup(struct snd_soc_pcm_runtime *rtd,
			struct snd_pcm_hw_params *params)
{
	struct snd_interval *rate = hw_param_interval(params,
						      SNDRV_PCM_HW_PARAM_RATE);
	struct snd_interval *chan = hw_param_interval(params,
						      SNDRV_PCM_HW_PARAM_CHANNELS);

	/* The ADSP will convert the FE rate to 48k, max 4-channels */
	rate->min = rate->max = 48000;
	chan->min = 2;
	chan->max = 4;

	/* set SSP0 to 24 bit */
	snd_mask_set_format(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT),
			    SNDRV_PCM_FORMAT_S24_LE);

	return 0;
}

static int bdw_rt5650_hw_params(struct snd_pcm_substream *substream,
	struct snd_pcm_hw_params *params)
{
	struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
	struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0);
	int ret;

	/* Workaround: set codec PLL to 19.2MHz that PLL source is

Annotation

Implementation Notes