sound/soc/codecs/ssm2602.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/ssm2602.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/ssm2602.c- Extension
.c- Size
- 19087 bytes
- Lines
- 695
- Domain
- Driver Families
- Bucket
- sound/soc
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/delay.hlinux/module.hlinux/regmap.hlinux/slab.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/tlv.hssm2602.h
Detected Declarations
struct ssm2602_privstruct ssm2602_coefffunction ssm2602_mic_switch_eventfunction ssm2602_get_coefffunction ssm2602_hw_paramsfunction ssm2602_startupfunction ssm2602_mutefunction ssm2602_set_dai_sysclkfunction ssm2602_set_dai_fmtfunction ssm2602_set_bias_levelfunction ssm2602_resumefunction ssm2602_component_probefunction ssm2604_component_probefunction ssm260x_component_probefunction ssm2602_register_volatilefunction ssm2602_probeexport ssm2602_regmap_configexport ssm2602_probe
Annotated Snippet
struct ssm2602_priv {
unsigned int sysclk;
const struct snd_pcm_hw_constraint_list *sysclk_constraints;
struct regmap *regmap;
enum ssm2602_type type;
unsigned int clk_out_pwr;
};
/*
* ssm2602 register cache
* We can't read the ssm2602 register space when we are
* using 2 wire for device control, so we cache them instead.
* There is no point in caching the reset register
*/
static const struct reg_default ssm2602_reg[SSM2602_CACHEREGNUM] = {
{ .reg = 0x00, .def = 0x0097 },
{ .reg = 0x01, .def = 0x0097 },
{ .reg = 0x02, .def = 0x0079 },
{ .reg = 0x03, .def = 0x0079 },
{ .reg = 0x04, .def = 0x000a },
{ .reg = 0x05, .def = 0x0008 },
{ .reg = 0x06, .def = 0x009f },
{ .reg = 0x07, .def = 0x000a },
{ .reg = 0x08, .def = 0x0000 },
{ .reg = 0x09, .def = 0x0000 }
};
/*
* ssm2602 register patch
* Workaround for playback distortions after power up: activates digital
* core, and then powers on output, DAC, and whole chip at the same time
*/
static const struct reg_sequence ssm2602_patch[] = {
{ SSM2602_ACTIVE, 0x01 },
{ SSM2602_PWR, 0x07 },
{ SSM2602_RESET, 0x00 },
};
/*Appending several "None"s just for OSS mixer use*/
static const char *ssm2602_input_select[] = {
"Line", "Mic",
};
static const char *ssm2602_deemph[] = {"None", "32Khz", "44.1Khz", "48Khz"};
static const struct soc_enum ssm2602_enum[] = {
SOC_ENUM_SINGLE(SSM2602_APANA, 2, ARRAY_SIZE(ssm2602_input_select),
ssm2602_input_select),
SOC_ENUM_SINGLE(SSM2602_APDIGI, 1, ARRAY_SIZE(ssm2602_deemph),
ssm2602_deemph),
};
static const DECLARE_TLV_DB_RANGE(ssm260x_outmix_tlv,
0, 47, TLV_DB_SCALE_ITEM(TLV_DB_GAIN_MUTE, 0, 0),
48, 127, TLV_DB_SCALE_ITEM(-7400, 100, 0)
);
static const DECLARE_TLV_DB_SCALE(ssm260x_inpga_tlv, -3450, 150, 0);
static const DECLARE_TLV_DB_SCALE(ssm260x_sidetone_tlv, -1500, 300, 0);
static const struct snd_kcontrol_new ssm260x_snd_controls[] = {
SOC_DOUBLE_R_TLV("Capture Volume", SSM2602_LINVOL, SSM2602_RINVOL, 0, 45, 0,
ssm260x_inpga_tlv),
SOC_DOUBLE_R("Capture Switch", SSM2602_LINVOL, SSM2602_RINVOL, 7, 1, 1),
SOC_SINGLE("ADC High Pass Filter Switch", SSM2602_APDIGI, 0, 1, 1),
SOC_SINGLE("Store DC Offset Switch", SSM2602_APDIGI, 4, 1, 0),
SOC_ENUM("Playback De-emphasis", ssm2602_enum[1]),
};
static const struct snd_kcontrol_new ssm2602_snd_controls[] = {
SOC_DOUBLE_R_TLV("Master Playback Volume", SSM2602_LOUT1V, SSM2602_ROUT1V,
0, 127, 0, ssm260x_outmix_tlv),
SOC_DOUBLE_R("Master Playback ZC Switch", SSM2602_LOUT1V, SSM2602_ROUT1V,
7, 1, 0),
SOC_SINGLE_TLV("Sidetone Playback Volume", SSM2602_APANA, 6, 3, 1,
ssm260x_sidetone_tlv),
SOC_SINGLE("Mic Boost (+20dB)", SSM2602_APANA, 0, 1, 0),
SOC_SINGLE("Mic Boost2 (+20dB)", SSM2602_APANA, 8, 1, 0),
};
/* Output Mixer */
static const struct snd_kcontrol_new ssm260x_output_mixer_controls[] = {
SOC_DAPM_SINGLE("Line Bypass Switch", SSM2602_APANA, 3, 1, 0),
Annotation
- Immediate include surface: `linux/delay.h`, `linux/module.h`, `linux/regmap.h`, `linux/slab.h`, `sound/pcm.h`, `sound/pcm_params.h`, `sound/soc.h`, `sound/tlv.h`.
- Detected declarations: `struct ssm2602_priv`, `struct ssm2602_coeff`, `function ssm2602_mic_switch_event`, `function ssm2602_get_coeff`, `function ssm2602_hw_params`, `function ssm2602_startup`, `function ssm2602_mute`, `function ssm2602_set_dai_sysclk`, `function ssm2602_set_dai_fmt`, `function ssm2602_set_bias_level`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: integration 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.