sound/soc/codecs/ak4613.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/ak4613.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/ak4613.c- Extension
.c- Size
- 23049 bytes
- Lines
- 923
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/clk.hlinux/delay.hlinux/i2c.hlinux/slab.hlinux/of.hlinux/of_graph.hlinux/module.hlinux/regmap.hsound/soc.hsound/pcm_params.hsound/tlv.h
Detected Declarations
struct ak4613_interfacestruct ak4613_privfunction ak4613_dai_shutdownfunction ak4613_hw_constraintsfunction ak4613_dai_startupfunction ak4613_dai_set_sysclkfunction ak4613_dai_set_fmtfunction ak4613_dai_hw_paramsfunction ak4613_set_bias_levelfunction ak4613_dummy_writefunction ak4613_dai_triggerfunction ak4613_suspendfunction ak4613_resumefunction ak4613_parse_offunction ak4613_i2c_probe
Annotated Snippet
struct ak4613_interface {
unsigned int width;
unsigned int fmt;
u8 dif;
};
struct ak4613_priv {
struct mutex lock;
struct snd_pcm_hw_constraint_list constraint_rates;
struct snd_pcm_hw_constraint_list constraint_channels;
struct work_struct dummy_write_work;
struct snd_soc_component *component;
unsigned int rate;
unsigned int sysclk;
unsigned int fmt;
unsigned int configs;
int cnt;
u8 ctrl1;
u8 oc;
u8 ic;
};
/*
* Playback Volume
*
* max : 0x00 : 0 dB
* ( 0.5 dB step )
* min : 0xFE : -127.0 dB
* mute: 0xFF
*/
static const DECLARE_TLV_DB_SCALE(out_tlv, -12750, 50, 1);
static const struct snd_kcontrol_new ak4613_snd_controls[] = {
SOC_DOUBLE_R_TLV("Digital Playback Volume1", LOUT1, ROUT1,
0, 0xFF, 1, out_tlv),
SOC_DOUBLE_R_TLV("Digital Playback Volume2", LOUT2, ROUT2,
0, 0xFF, 1, out_tlv),
SOC_DOUBLE_R_TLV("Digital Playback Volume3", LOUT3, ROUT3,
0, 0xFF, 1, out_tlv),
SOC_DOUBLE_R_TLV("Digital Playback Volume4", LOUT4, ROUT4,
0, 0xFF, 1, out_tlv),
SOC_DOUBLE_R_TLV("Digital Playback Volume5", LOUT5, ROUT5,
0, 0xFF, 1, out_tlv),
SOC_DOUBLE_R_TLV("Digital Playback Volume6", LOUT6, ROUT6,
0, 0xFF, 1, out_tlv),
};
static const struct reg_default ak4613_reg[] = {
{ 0x0, 0x0f }, { 0x1, 0x07 }, { 0x2, 0x3f }, { 0x3, 0x20 },
{ 0x4, 0x20 }, { 0x5, 0x55 }, { 0x6, 0x05 }, { 0x7, 0x07 },
{ 0x8, 0x0f }, { 0x9, 0x07 }, { 0xa, 0x3f }, { 0xb, 0x00 },
{ 0xc, 0x00 }, { 0xd, 0x00 }, { 0xe, 0x00 }, { 0xf, 0x00 },
{ 0x10, 0x00 }, { 0x11, 0x00 }, { 0x12, 0x00 }, { 0x13, 0x00 },
{ 0x14, 0x00 }, { 0x15, 0x00 }, { 0x16, 0x00 },
};
/*
* CTRL1 register
* see
* Table 11/12/13/14
*/
#define AUDIO_IFACE(_dif, _width, _fmt) \
{ \
.dif = _dif, \
.width = _width, \
.fmt = SND_SOC_DAIFMT_##_fmt,\
}
static const struct ak4613_interface ak4613_iface[] = {
/* It doesn't support asymmetric format */
AUDIO_IFACE(0x03, 24, LEFT_J),
AUDIO_IFACE(0x04, 24, I2S),
};
#define AK4613_CTRL1_TO_MODE(priv) ((priv)->ctrl1 >> 6) /* AK4613_CONFIG_MODE_x */
static const struct regmap_config ak4613_regmap_cfg = {
.reg_bits = 8,
.val_bits = 8,
.max_register = 0x16,
.reg_defaults = ak4613_reg,
.num_reg_defaults = ARRAY_SIZE(ak4613_reg),
.cache_type = REGCACHE_RBTREE,
};
static const struct of_device_id ak4613_of_match[] = {
{ .compatible = "asahi-kasei,ak4613", .data = &ak4613_regmap_cfg },
{},
};
MODULE_DEVICE_TABLE(of, ak4613_of_match);
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/i2c.h`, `linux/slab.h`, `linux/of.h`, `linux/of_graph.h`, `linux/module.h`, `linux/regmap.h`.
- Detected declarations: `struct ak4613_interface`, `struct ak4613_priv`, `function ak4613_dai_shutdown`, `function ak4613_hw_constraints`, `function ak4613_dai_startup`, `function ak4613_dai_set_sysclk`, `function ak4613_dai_set_fmt`, `function ak4613_dai_hw_params`, `function ak4613_set_bias_level`, `function ak4613_dummy_write`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.