sound/soc/codecs/es8323.c

Source file repositories/reference/linux-study-clean/sound/soc/codecs/es8323.c

File Facts

System
Linux kernel
Corpus path
sound/soc/codecs/es8323.c
Extension
.c
Size
25956 bytes
Lines
822
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 es8323_priv {
	unsigned int sysclk;
	struct clk *mclk;
	struct regmap *regmap;
	struct snd_pcm_hw_constraint_list *sysclk_constraints;
};

/* es8323 register cache */
static const struct reg_default es8323_reg_defaults[] = {
	{ ES8323_CONTROL1,     0x06 },
	{ ES8323_CONTROL2,     0x1c },
	{ ES8323_CHIPPOWER,    0xc3 },
	{ ES8323_ADCPOWER,     0xfc },
	{ ES8323_DACPOWER,     0xc0 },
	{ ES8323_CHIPLOPOW1,   0x00 },
	{ ES8323_CHIPLOPOW2,   0x00 },
	{ ES8323_ANAVOLMANAG,  0x7c },
	{ ES8323_MASTERMODE,   0x80 },
	{ ES8323_ADCCONTROL1,  0x00 },
	{ ES8323_ADCCONTROL2,  0x00 },
	{ ES8323_ADCCONTROL3,  0x06 },
	{ ES8323_ADCCONTROL4,  0x00 },
	{ ES8323_ADCCONTROL5,  0x06 },
	{ ES8323_ADCCONTROL6,  0x30 },
	{ ES8323_ADCCONTROL7,  0x30 },
	{ ES8323_LADC_VOL,     0xc0 },
	{ ES8323_RADC_VOL,     0xc0 },
	{ ES8323_ADCCONTROL10, 0x38 },
	{ ES8323_ADCCONTROL11, 0xb0 },
	{ ES8323_ADCCONTROL12, 0x32 },
	{ ES8323_ADCCONTROL13, 0x06 },
	{ ES8323_ADCCONTROL14, 0x00 },
	{ ES8323_DACCONTROL1,  0x00 },
	{ ES8323_DACCONTROL2,  0x06 },
	{ ES8323_DACCONTROL3,  0x30 },
	{ ES8323_LDAC_VOL,     0xc0 },
	{ ES8323_RDAC_VOL,     0xc0 },
	{ ES8323_DACCONTROL6,  0x08 },
	{ ES8323_DACCONTROL7,  0x06 },
	{ ES8323_DACCONTROL8,  0x1f },
	{ ES8323_DACCONTROL9,  0xf7 },
	{ ES8323_DACCONTROL10, 0xfd },
	{ ES8323_DACCONTROL11, 0xff },
	{ ES8323_DACCONTROL12, 0x1f },
	{ ES8323_DACCONTROL13, 0xf7 },
	{ ES8323_DACCONTROL14, 0xfd },
	{ ES8323_DACCONTROL15, 0xff },
	{ ES8323_DACCONTROL16, 0x00 },
	{ ES8323_DACCONTROL17, 0x38 },
	{ ES8323_DACCONTROL18, 0x38 },
	{ ES8323_DACCONTROL19, 0x38 },
	{ ES8323_DACCONTROL20, 0x38 },
	{ ES8323_DACCONTROL21, 0x38 },
	{ ES8323_DACCONTROL22, 0x38 },
	{ ES8323_DACCONTROL23, 0x00 },
	{ ES8323_LOUT1_VOL,    0x00 },
	{ ES8323_ROUT1_VOL,    0x00 },
};

static const char *const es8323_stereo_3d_texts[] = { "No 3D  ", "Level 1", "Level 2", "Level 3",
						      "Level 4", "Level 5", "Level 6", "Level 7" };
static SOC_ENUM_SINGLE_DECL(es8323_stereo_3d_enum, ES8323_DACCONTROL7, 2, es8323_stereo_3d_texts);

static const char *const es8323_alc_func_texts[] = { "Off", "Right", "Left", "Stereo" };
static SOC_ENUM_SINGLE_DECL(es8323_alc_function_enum,
			    ES8323_ADCCONTROL10, 6, es8323_alc_func_texts);

static const char *const es8323_ng_type_texts[] = { "Constant PGA Gain", "Mute ADC Output" };
static SOC_ENUM_SINGLE_DECL(es8323_alc_ng_type_enum, ES8323_ADCCONTROL14, 1, es8323_ng_type_texts);

static const char *const es8323_deemph_texts[] = { "None", "32Khz", "44.1Khz", "48Khz" };
static SOC_ENUM_SINGLE_DECL(es8323_playback_deemphasis_enum,
			    ES8323_DACCONTROL6, 6, es8323_deemph_texts);

static const char *const es8323_adcpol_texts[] = { "Normal", "L Invert",
						   "R Invert", "L + R Invert" };
static SOC_ENUM_SINGLE_DECL(es8323_capture_polarity_enum,
			    ES8323_ADCCONTROL6, 6, es8323_adcpol_texts);

static const DECLARE_TLV_DB_SCALE(es8323_adc_tlv, -9600, 50, 1);
static const DECLARE_TLV_DB_SCALE(es8323_dac_tlv, -9600, 50, 1);
static const DECLARE_TLV_DB_SCALE(es8323_out_tlv, -4500, 150, 0);
static const DECLARE_TLV_DB_SCALE(es8323_bypass_tlv, 0, 300, 0);
static const DECLARE_TLV_DB_SCALE(es8323_bypass_tlv2, -15, 300, 0);

static const struct snd_kcontrol_new es8323_snd_controls[] = {
	SOC_ENUM("3D Mode", es8323_stereo_3d_enum),
	SOC_ENUM("ALC Capture Function", es8323_alc_function_enum),
	SOC_ENUM("ALC Capture NG Type", es8323_alc_ng_type_enum),
	SOC_ENUM("Playback De-emphasis", es8323_playback_deemphasis_enum),

Annotation

Implementation Notes