sound/soc/codecs/es9356.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/es9356.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/es9356.c- Extension
.c- Size
- 34865 bytes
- Lines
- 1143
- 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/device.hlinux/mod_devicetable.hlinux/module.hlinux/soundwire/sdw.hlinux/soundwire/sdw_type.hlinux/soundwire/sdw_registers.hsound/core.hsound/pcm.hsound/pcm_params.hlinux/pm_runtime.hsound/sdw.hsound/soc.hsound/soc-dapm.hsound/tlv.hsound/sdca_function.hsound/sdca_regmap.hlinux/interrupt.hlinux/irq.hsound/jack.hsound/sdca_asoc.hes9356.h
Detected Declarations
struct es9356_sdw_privfunction es9356_sdw_component_probefunction es9356_set_jack_detectfunction es9356_sdw_set_sdw_streamfunction es9356_sdw_shutdownfunction es9356_sdca_buttonfunction es9356_sdca_button_detectfunction es9356_sdca_headset_detectfunction es9356_interrupt_handlerfunction es9356_button_detect_handlerfunction es9356_pde_transition_delayfunction es9356_power_statefunction es9356_sdw_pcm_hw_paramsfunction es9356_sdw_pcm_hw_freefunction es9356_sdca_mbq_sizefunction es9356_sdca_volatile_registerfunction es9356_register_initfunction es9356_sdca_io_initfunction es9356_sdw_update_statusfunction es9356_sdw_read_propfunction es9356_sdw_interrupt_callbackfunction es9356_sdca_initfunction es9356_sdw_probefunction es9356_sdw_removefunction es9356_sdca_dev_suspendfunction es9356_sdca_dev_system_suspendfunction es9356_sdca_dev_resume
Annotated Snippet
struct es9356_sdw_priv {
struct sdw_slave *slave;
struct device *dev;
struct regmap *regmap;
struct snd_soc_component *component;
struct snd_soc_jack *hs_jack;
/* lock for irq*/
struct mutex disable_irq_lock;
/* lock for pde*/
struct mutex pde_lock;
bool hw_init;
bool first_hw_init;
int jack_type;
bool disable_irq;
struct delayed_work interrupt_handle_work;
struct delayed_work button_detect_work;
unsigned int sdca_status;
};
static int es9356_sdw_component_probe(struct snd_soc_component *component)
{
struct es9356_sdw_priv *es9356 = snd_soc_component_get_drvdata(component);
es9356->component = component;
return 0;
}
static const DECLARE_TLV_DB_SCALE(out_vol_tlv, -9600, 12, 0);
static const DECLARE_TLV_DB_SCALE(amic_gain_tlv, 0, 3, 0);
static const DECLARE_TLV_DB_SCALE(dmic_gain_tlv, 0, 6, 0);
static const struct snd_kcontrol_new es9356_sdca_controls[] = {
SDCA_SINGLE_Q78_TLV("FU41 Left Playback Volume",
SDW_SDCA_CTL(FUNC_NUM_UAJ, ES9356_SDCA_ENT_FU41, ES9356_SDCA_CTL_FU_VOLUME, CH_L),
ES9356_VOLUME_MIN, ES9356_VOLUME_MAX, ES9356_VOLUME_STEP, out_vol_tlv),
SDCA_SINGLE_Q78_TLV("FU41 Right Playback Volume",
SDW_SDCA_CTL(FUNC_NUM_UAJ, ES9356_SDCA_ENT_FU41, ES9356_SDCA_CTL_FU_VOLUME, CH_R),
ES9356_VOLUME_MIN, ES9356_VOLUME_MAX, ES9356_VOLUME_STEP, out_vol_tlv),
SDCA_SINGLE_Q78_TLV("FU36 Left Capture Volume",
SDW_SDCA_CTL(FUNC_NUM_UAJ, ES9356_SDCA_ENT_FU36, ES9356_SDCA_CTL_FU_VOLUME, CH_L),
ES9356_VOLUME_MIN, ES9356_VOLUME_MAX, ES9356_VOLUME_STEP, out_vol_tlv),
SDCA_SINGLE_Q78_TLV("FU36 Right Capture Volume",
SDW_SDCA_CTL(FUNC_NUM_UAJ, ES9356_SDCA_ENT_FU36, ES9356_SDCA_CTL_FU_VOLUME, CH_R),
ES9356_VOLUME_MIN, ES9356_VOLUME_MAX, ES9356_VOLUME_STEP, out_vol_tlv),
SDCA_SINGLE_Q78_TLV("FU33 Capture Volume",
SDW_SDCA_CTL(FUNC_NUM_UAJ, ES9356_SDCA_ENT_FU33, ES9356_SDCA_CTL_FU_CH_GAIN, 0),
ES9356_GAIN_MIN, ES9356_AMIC_GAIN_MAX, ES9356_AMIC_GAIN_STEP, amic_gain_tlv),
SDCA_SINGLE_Q78_TLV("FU21 Left Playback Volume",
SDW_SDCA_CTL(FUNC_NUM_AMP, ES9356_SDCA_ENT_FU21, ES9356_SDCA_CTL_FU_VOLUME, CH_L),
ES9356_VOLUME_MIN, ES9356_VOLUME_MAX, ES9356_VOLUME_STEP, out_vol_tlv),
SDCA_SINGLE_Q78_TLV("FU21 Right Playback Volume",
SDW_SDCA_CTL(FUNC_NUM_AMP, ES9356_SDCA_ENT_FU21, ES9356_SDCA_CTL_FU_VOLUME, CH_R),
ES9356_VOLUME_MIN, ES9356_VOLUME_MAX, ES9356_VOLUME_STEP, out_vol_tlv),
SDCA_SINGLE_Q78_TLV("FU113 Left Capture Volume",
SDW_SDCA_CTL(FUNC_NUM_MIC, ES9356_SDCA_ENT_FU113, ES9356_SDCA_CTL_FU_VOLUME, CH_L),
ES9356_VOLUME_MIN, ES9356_VOLUME_MAX, ES9356_VOLUME_STEP, out_vol_tlv),
SDCA_SINGLE_Q78_TLV("FU113 Right Capture Volume",
SDW_SDCA_CTL(FUNC_NUM_MIC, ES9356_SDCA_ENT_FU113, ES9356_SDCA_CTL_FU_VOLUME, CH_R),
ES9356_VOLUME_MIN, ES9356_VOLUME_MAX, ES9356_VOLUME_STEP, out_vol_tlv),
SDCA_SINGLE_Q78_TLV("FU11 Capture Volume",
SDW_SDCA_CTL(FUNC_NUM_MIC, ES9356_SDCA_ENT_FU11, ES9356_SDCA_CTL_FU_CH_GAIN, 0),
ES9356_GAIN_MIN, ES9356_DMIC_GAIN_MAX, ES9356_DMIC_GAIN_STEP, dmic_gain_tlv),
};
static const char *const es9356_left_mux_txt[] = {
"Left",
"Right",
};
static const char *const es9356_right_mux_txt[] = {
"Right",
"Left",
};
static const struct soc_enum es9356_left_mux_enum =
SOC_ENUM_SINGLE(ES9356_DAC_SWAP, 1,
ARRAY_SIZE(es9356_left_mux_txt), es9356_left_mux_txt);
static const struct soc_enum es9356_right_mux_enum =
SOC_ENUM_SINGLE(ES9356_DAC_SWAP, 0,
ARRAY_SIZE(es9356_right_mux_txt), es9356_right_mux_txt);
static const struct snd_kcontrol_new es9356_left_mux_controls =
SOC_DAPM_ENUM("Channel MUX", es9356_left_mux_enum);
static const struct snd_kcontrol_new es9356_right_mux_controls =
SOC_DAPM_ENUM("Channel MUX", es9356_right_mux_enum);
Annotation
- Immediate include surface: `linux/device.h`, `linux/mod_devicetable.h`, `linux/module.h`, `linux/soundwire/sdw.h`, `linux/soundwire/sdw_type.h`, `linux/soundwire/sdw_registers.h`, `sound/core.h`, `sound/pcm.h`.
- Detected declarations: `struct es9356_sdw_priv`, `function es9356_sdw_component_probe`, `function es9356_set_jack_detect`, `function es9356_sdw_set_sdw_stream`, `function es9356_sdw_shutdown`, `function es9356_sdca_button`, `function es9356_sdca_button_detect`, `function es9356_sdca_headset_detect`, `function es9356_interrupt_handler`, `function es9356_button_detect_handler`.
- 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.