sound/soc/codecs/sma1303.c

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

File Facts

System
Linux kernel
Corpus path
sound/soc/codecs/sma1303.c
Extension
.c
Size
47468 bytes
Lines
1812
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 sma1303_pll_match {
	char *input_clk_name;
	char *output_clk_name;
	unsigned int input_clk;
	unsigned int post_n;
	unsigned int n;
	unsigned int vco;
	unsigned int p_cp;
};

struct sma1303_priv {
	enum sma1303_type devtype;
	struct attribute_group *attr_grp;
	struct delayed_work check_fault_work;
	struct device *dev;
	struct kobject *kobj;
	struct regmap *regmap;
	struct sma1303_pll_match *pll_matches;
	bool amp_power_status;
	bool force_mute_status;
	int num_of_pll_matches;
	int retry_cnt;
	unsigned int amp_mode;
	unsigned int cur_vol;
	unsigned int format;
	unsigned int frame_size;
	unsigned int init_vol;
	unsigned int last_bclk;
	unsigned int last_ocp_val;
	unsigned int last_over_temp;
	unsigned int rev_num;
	unsigned int sys_clk_id;
	unsigned int tdm_slot_rx;
	unsigned int tdm_slot_tx;
	unsigned int tsdw_cnt;
	long check_fault_period;
	long check_fault_status;
};

static struct sma1303_pll_match sma1303_pll_matches[] = {
PLL_MATCH("1.411MHz",  "24.595MHz", 1411200,  0x07, 0xF4, 0x8B, 0x03),
PLL_MATCH("1.536MHz",  "24.576MHz", 1536000,  0x07, 0xE0, 0x8B, 0x03),
PLL_MATCH("3.072MHz",  "24.576MHz", 3072000,  0x07, 0x70, 0x8B, 0x03),
PLL_MATCH("6.144MHz",  "24.576MHz", 6144000,  0x07, 0x70, 0x8B, 0x07),
PLL_MATCH("12.288MHz", "24.576MHz", 12288000, 0x07, 0x70, 0x8B, 0x0B),
PLL_MATCH("19.2MHz",   "24.343MHz", 19200000, 0x07, 0x47, 0x8B, 0x0A),
PLL_MATCH("24.576MHz", "24.576MHz", 24576000, 0x07, 0x70, 0x8B, 0x0F),
};

static int sma1303_startup(struct snd_soc_component *);
static int sma1303_shutdown(struct snd_soc_component *);

static const struct reg_default sma1303_reg_def[] = {
	{ 0x00, 0x80 },
	{ 0x01, 0x00 },
	{ 0x02, 0x00 },
	{ 0x03, 0x11 },
	{ 0x04, 0x17 },
	{ 0x09, 0x00 },
	{ 0x0A, 0x31 },
	{ 0x0B, 0x98 },
	{ 0x0C, 0x84 },
	{ 0x0D, 0x07 },
	{ 0x0E, 0x3F },
	{ 0x10, 0x00 },
	{ 0x11, 0x00 },
	{ 0x12, 0x00 },
	{ 0x14, 0x5C },
	{ 0x15, 0x01 },
	{ 0x16, 0x0F },
	{ 0x17, 0x0F },
	{ 0x18, 0x0F },
	{ 0x19, 0x00 },
	{ 0x1A, 0x00 },
	{ 0x1B, 0x00 },
	{ 0x23, 0x19 },
	{ 0x24, 0x00 },
	{ 0x25, 0x00 },
	{ 0x26, 0x04 },
	{ 0x33, 0x00 },
	{ 0x36, 0x92 },
	{ 0x37, 0x27 },
	{ 0x3B, 0x5A },
	{ 0x3C, 0x20 },
	{ 0x3D, 0x00 },
	{ 0x3E, 0x03 },
	{ 0x3F, 0x0C },
	{ 0x8B, 0x07 },
	{ 0x8C, 0x70 },
	{ 0x8D, 0x8B },

Annotation

Implementation Notes