sound/soc/rockchip/rockchip_max98090.c

Source file repositories/reference/linux-study-clean/sound/soc/rockchip/rockchip_max98090.c

File Facts

System
Linux kernel
Corpus path
sound/soc/rockchip/rockchip_max98090.c
Extension
.c
Size
12139 bytes
Lines
470
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
/*
 * Rockchip machine ASoC driver for boards using a MAX90809 CODEC.
 *
 * Copyright (c) 2014, ROCKCHIP CORPORATION.  All rights reserved.
 */

#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <sound/core.h>
#include <sound/jack.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>

#include "rockchip_i2s.h"
#include "../codecs/ts3a227e.h"

#define DRV_NAME "rockchip-snd-max98090"

static struct snd_soc_jack headset_jack;

/* Headset jack detection DAPM pins */
static struct snd_soc_jack_pin headset_jack_pins[] = {
	{
		.pin = "Headphone",
		.mask = SND_JACK_HEADPHONE,
	},
	{
		.pin = "Headset Mic",
		.mask = SND_JACK_MICROPHONE,
	},

};

#define RK_MAX98090_WIDGETS \
	SND_SOC_DAPM_HP("Headphone", NULL), \
	SND_SOC_DAPM_MIC("Headset Mic", NULL), \
	SND_SOC_DAPM_MIC("Int Mic", NULL), \
	SND_SOC_DAPM_SPK("Speaker", NULL)

#define RK_HDMI_WIDGETS \
	SND_SOC_DAPM_LINE("HDMI", NULL)

static const struct snd_soc_dapm_widget rk_max98090_dapm_widgets[] = {
	RK_MAX98090_WIDGETS,
};

static const struct snd_soc_dapm_widget rk_hdmi_dapm_widgets[] = {
	RK_HDMI_WIDGETS,
};

static const struct snd_soc_dapm_widget rk_max98090_hdmi_dapm_widgets[] = {
	RK_MAX98090_WIDGETS,
	RK_HDMI_WIDGETS,
};

#define RK_MAX98090_AUDIO_MAP \
	{"IN34", NULL, "Headset Mic"}, \
	{"Headset Mic", NULL, "MICBIAS"}, \
	{"DMICL", NULL, "Int Mic"}, \
	{"Headphone", NULL, "HPL"}, \
	{"Headphone", NULL, "HPR"}, \
	{"Speaker", NULL, "SPKL"}, \
	{"Speaker", NULL, "SPKR"}

#define RK_HDMI_AUDIO_MAP \
	{"HDMI", NULL, "TX"}

static const struct snd_soc_dapm_route rk_max98090_audio_map[] = {
	RK_MAX98090_AUDIO_MAP,
};

static const struct snd_soc_dapm_route rk_hdmi_audio_map[] = {
	RK_HDMI_AUDIO_MAP,
};

static const struct snd_soc_dapm_route rk_max98090_hdmi_audio_map[] = {
	RK_MAX98090_AUDIO_MAP,
	RK_HDMI_AUDIO_MAP,
};

#define RK_MAX98090_CONTROLS \
	SOC_DAPM_PIN_SWITCH("Headphone"), \
	SOC_DAPM_PIN_SWITCH("Headset Mic"), \
	SOC_DAPM_PIN_SWITCH("Int Mic"), \
	SOC_DAPM_PIN_SWITCH("Speaker")

Annotation

Implementation Notes