sound/soc/codecs/sma1307.c

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

File Facts

System
Linux kernel
Corpus path
sound/soc/codecs/sma1307.c
Extension
.c
Size
59107 bytes
Lines
2054
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 sma1307_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 sma1307_data {
	char *name;
	void (*init)(struct regmap *regmap);
};

struct sma1307_priv {
	bool check_fault_status;
	bool force_mute_status;
	bool sw_ot1_prot;
	char *name;
	enum sma1307_mode amp_mode;
	int binary_mode;
	int dapm_aif_in;
	int dapm_aif_out0;
	int dapm_aif_out1;
	int dapm_sdo_en;
	int dapm_sdo_setting;
	int num_of_pll_matches;
	int check_fault_period;
	struct delayed_work check_fault_work;
	struct device *dev;
	struct kobject *kobj;
	struct mutex default_lock;
	struct regmap *regmap;
	struct sma1307_setting_file set;
	const struct sma1307_pll_match *pll_matches;
	const struct sma1307_data *data;
	unsigned int cur_vol;
	unsigned int format;
	unsigned int frame_size;
	unsigned int init_vol;
	unsigned int last_bclk;
	unsigned int otp_trm2;
	unsigned int otp_trm3;
	unsigned int rev_num;
	unsigned int sys_clk_id;
	unsigned int tdm_slot0_rx;
	unsigned int tdm_slot1_rx;
	unsigned int tdm_slot0_tx;
	unsigned int tdm_slot1_tx;
	unsigned int tsdw_cnt;
};

static const struct sma1307_pll_match sma1307_pll_matches[] = {
	/* in_clk_name, out_clk_name, input_clk post_n, n, vco, p_cp */
	PLL_MATCH("1.411MHz", "24.554MHz",
		  1411200, 0x06, 0xD1, 0x88, 0x00),
	PLL_MATCH("1.536MHz", "24.576MHz",
		  1536000, 0x06, 0xC0, 0x88, 0x00),
	PLL_MATCH("2.822MHz", "24.554MHz",
		  2822400, 0x06, 0xD1, 0x88, 0x04),
	PLL_MATCH("3.072MHz", "24.576MHz",
		  3072000, 0x06, 0x60, 0x88, 0x00),
	PLL_MATCH("6.144MHz", "24.576MHz",
		  6144000, 0x06, 0x60, 0x88, 0x04),
	PLL_MATCH("12.288MHz", "24.576MHz",
		  12288000, 0x06, 0x60, 0x88, 0x08),
	PLL_MATCH("19.2MHz", "24.48MHz",
		  19200000, 0x06, 0x7B, 0x88, 0x0C),
	PLL_MATCH("24.576MHz", "24.576MHz",
		  24576000, 0x06, 0x60, 0x88, 0x0C),
};

static struct snd_soc_component *sma1307_amp_component;

static void sma1307_startup(struct snd_soc_component *);
static void sma1307_shutdown(struct snd_soc_component *);
static void sma1307_reset(struct snd_soc_component *);
static void sma1307_set_binary(struct snd_soc_component *);
static void sma1307_set_default(struct snd_soc_component *);

/* Initial register value - 6.0W SPK (8ohm load)  */
static const struct reg_default sma1307_reg_def[] = {
	{ 0x00, 0x80 },
	{ 0x01, 0x00 },
	{ 0x02, 0x52 },
	{ 0x03, 0x4C },
	{ 0x04, 0x47 },
	{ 0x05, 0x42 },
	{ 0x06, 0x40 },

Annotation

Implementation Notes