sound/soc/codecs/ak4458.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/ak4458.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/ak4458.c- Extension
.c- Size
- 22716 bytes
- Lines
- 818
- 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/delay.hlinux/gpio/consumer.hlinux/i2c.hlinux/module.hlinux/of.hlinux/pm_runtime.hlinux/regulator/consumer.hlinux/reset.hlinux/slab.hsound/initval.hsound/pcm_params.hsound/soc.hsound/soc-dapm.hsound/tlv.hak4458.h
Detected Declarations
struct ak4458_drvdatastruct ak4458_privenum ak4458_typefunction get_digfilfunction set_digfilfunction ak4458_get_tdm_modefunction ak4458_rstn_controlfunction ak4458_hw_paramsfunction ak4458_set_dai_fmtfunction ak4458_set_dai_mutefunction ak4458_set_tdm_slotfunction ak4458_startupfunction ak4458_resetfunction ak4458_runtime_suspendfunction ak4458_runtime_resumefunction ak4458_i2c_probefunction ak4458_i2c_remove
Annotated Snippet
struct ak4458_drvdata {
struct snd_soc_dai_driver *dai_drv;
const struct snd_soc_component_driver *comp_drv;
enum ak4458_type type;
};
/* AK4458 Codec Private Data */
struct ak4458_priv {
struct regulator_bulk_data supplies[AK4458_NUM_SUPPLIES];
const struct ak4458_drvdata *drvdata;
struct device *dev;
struct regmap *regmap;
struct reset_control *reset;
struct gpio_desc *mute_gpiod;
int digfil; /* SSLOW, SD, SLOW bits */
int fs; /* sampling rate */
int fmt;
int slots;
int slot_width;
u32 dsd_path; /* For ak4497 */
};
static const struct reg_default ak4458_reg_defaults[] = {
{ 0x00, 0x0C }, /* 0x00 AK4458_00_CONTROL1 */
{ 0x01, 0x22 }, /* 0x01 AK4458_01_CONTROL2 */
{ 0x02, 0x00 }, /* 0x02 AK4458_02_CONTROL3 */
{ 0x03, 0xFF }, /* 0x03 AK4458_03_LCHATT */
{ 0x04, 0xFF }, /* 0x04 AK4458_04_RCHATT */
{ 0x05, 0x00 }, /* 0x05 AK4458_05_CONTROL4 */
{ 0x06, 0x00 }, /* 0x06 AK4458_06_DSD1 */
{ 0x07, 0x03 }, /* 0x07 AK4458_07_CONTROL5 */
{ 0x08, 0x00 }, /* 0x08 AK4458_08_SOUND_CONTROL */
{ 0x09, 0x00 }, /* 0x09 AK4458_09_DSD2 */
{ 0x0A, 0x0D }, /* 0x0A AK4458_0A_CONTROL6 */
{ 0x0B, 0x0C }, /* 0x0B AK4458_0B_CONTROL7 */
{ 0x0C, 0x00 }, /* 0x0C AK4458_0C_CONTROL8 */
{ 0x0D, 0x00 }, /* 0x0D AK4458_0D_CONTROL9 */
{ 0x0E, 0x50 }, /* 0x0E AK4458_0E_CONTROL10 */
{ 0x0F, 0xFF }, /* 0x0F AK4458_0F_L2CHATT */
{ 0x10, 0xFF }, /* 0x10 AK4458_10_R2CHATT */
{ 0x11, 0xFF }, /* 0x11 AK4458_11_L3CHATT */
{ 0x12, 0xFF }, /* 0x12 AK4458_12_R3CHATT */
{ 0x13, 0xFF }, /* 0x13 AK4458_13_L4CHATT */
{ 0x14, 0xFF }, /* 0x14 AK4458_14_R4CHATT */
};
/*
* Volume control:
* from -127 to 0 dB in 0.5 dB steps (mute instead of -127.5 dB)
*/
static DECLARE_TLV_DB_SCALE(dac_tlv, -12750, 50, 1);
/*
* DEM1 bit DEM0 bit Mode
* 0 0 44.1kHz
* 0 1 OFF (default)
* 1 0 48kHz
* 1 1 32kHz
*/
static const char * const ak4458_dem_select_texts[] = {
"44.1kHz", "OFF", "48kHz", "32kHz"
};
/*
* SSLOW, SD, SLOW bits Digital Filter Setting
* 0, 0, 0 : Sharp Roll-Off Filter
* 0, 0, 1 : Slow Roll-Off Filter
* 0, 1, 0 : Short delay Sharp Roll-Off Filter
* 0, 1, 1 : Short delay Slow Roll-Off Filter
* 1, *, * : Super Slow Roll-Off Filter
*/
static const char * const ak4458_digfil_select_texts[] = {
"Sharp Roll-Off Filter",
"Slow Roll-Off Filter",
"Short delay Sharp Roll-Off Filter",
"Short delay Slow Roll-Off Filter",
"Super Slow Roll-Off Filter"
};
/*
* DZFB: Inverting Enable of DZF
* 0: DZF goes H at Zero Detection
* 1: DZF goes L at Zero Detection
*/
static const char * const ak4458_dzfb_select_texts[] = {"H", "L"};
/*
* SC1-0 bits: Sound Mode Setting
* 0 0 : Sound Mode 0
* 0 1 : Sound Mode 1
Annotation
- Immediate include surface: `linux/delay.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/module.h`, `linux/of.h`, `linux/pm_runtime.h`, `linux/regulator/consumer.h`, `linux/reset.h`.
- Detected declarations: `struct ak4458_drvdata`, `struct ak4458_priv`, `enum ak4458_type`, `function get_digfil`, `function set_digfil`, `function ak4458_get_tdm_mode`, `function ak4458_rstn_control`, `function ak4458_hw_params`, `function ak4458_set_dai_fmt`, `function ak4458_set_dai_mute`.
- 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.