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.
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/firmware.hlinux/i2c.hlinux/regmap.hsound/pcm_params.hsound/tlv.hsma1307.h
Detected Declarations
struct sma1307_pll_matchstruct sma1307_datastruct sma1307_privfunction sma1307_readable_registerfunction sma1307_writeable_registerfunction sma1307_volatile_registerfunction sma1307_force_mute_getfunction sma1307_force_mute_putfunction sma1307_tdm_slot_getfunction sma1307_tdm_slot_putfunction sma1307_sw_ot1_prot_getfunction sma1307_sw_ot1_prot_putfunction sma1307_check_fault_status_getfunction sma1307_check_fault_status_putfunction sma1307_check_fault_period_getfunction sma1307_check_fault_period_putfunction sma1307_reset_putfunction sma1307_binary_mode_putfunction sma1307_startupfunction sma1307_shutdownfunction sma1307_aif_in_eventfunction sma1307_sdo_setting_eventfunction sma1307_aif_out_eventfunction sma1307_sdo_eventfunction sma1307_power_eventfunction sma1307_dapm_aif_in_getfunction sma1307_dapm_aif_in_putfunction sma1307_dapm_sdo_setting_getfunction sma1307_dapm_sdo_setting_putfunction sma1307_dapm_aif_out_getfunction sma1307_dapm_aif_out_putfunction sma1307_dapm_sdo_enable_getfunction sma1307_dapm_sdo_enable_putfunction sma1307_setup_pllfunction sma1307_dai_hw_params_ampfunction sma1307_dai_set_sysclk_ampfunction sma1307_dai_set_fmt_ampfunction sma1307_dai_set_tdm_slotfunction sma1307_dai_mute_streamfunction sma1307_check_fault_workerfunction sma1307_setting_loadedfunction sma1307_resetfunction sma1307_set_binaryfunction sma1307_set_defaultfunction sma1307_probefunction sma1307aq_initfunction sma1307_i2c_probefunction sma1307_i2c_remove
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
- Immediate include surface: `linux/firmware.h`, `linux/i2c.h`, `linux/regmap.h`, `sound/pcm_params.h`, `sound/tlv.h`, `sma1307.h`.
- Detected declarations: `struct sma1307_pll_match`, `struct sma1307_data`, `struct sma1307_priv`, `function sma1307_readable_register`, `function sma1307_writeable_register`, `function sma1307_volatile_register`, `function sma1307_force_mute_get`, `function sma1307_force_mute_put`, `function sma1307_tdm_slot_get`, `function sma1307_tdm_slot_put`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.