sound/soc/codecs/ab8500-codec.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/ab8500-codec.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/ab8500-codec.c- Extension
.c- Size
- 70740 bytes
- Lines
- 2278
- 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/kernel.hlinux/module.hlinux/device.hlinux/slab.hlinux/moduleparam.hlinux/init.hlinux/delay.hlinux/pm.hlinux/platform_device.hlinux/mutex.hlinux/mfd/abx500/ab8500.hlinux/mfd/abx500.hlinux/mfd/abx500/ab8500-sysctrl.hlinux/mfd/abx500/ab8500-codec.hlinux/regulator/consumer.hlinux/of.hsound/core.hsound/pcm.hsound/pcm_params.hsound/initval.hsound/soc.hsound/soc-dapm.hsound/tlv.hab8500-codec.h
Detected Declarations
struct ab8500_codec_drvdataenum sid_statefunction ab8500_codec_read_regfunction ab8500_codec_write_regfunction sid_status_control_getfunction sid_status_control_putfunction ab8500_audio_init_audioblockfunction ab8500_audio_setup_micsfunction ab8500_audio_set_ear_cmvfunction ab8500_audio_set_bit_delayfunction ab8500_codec_set_dai_clock_gatefunction ab8500_codec_set_dai_fmtfunction ab8500_codec_set_dai_tdm_slotfunction ab8500_codec_of_probefunction ab8500_codec_probefunction ab8500_codec_driver_probe
Annotated Snippet
struct ab8500_codec_drvdata {
struct regmap *regmap;
struct mutex ctrl_lock;
/* Sidetone */
enum sid_state sid_status;
};
static inline const char *amic_micbias_str(enum amic_micbias micbias)
{
switch (micbias) {
case AMIC_MICBIAS_VAMIC1:
return "VAMIC1";
case AMIC_MICBIAS_VAMIC2:
return "VAMIC2";
default:
return "Unknown";
}
}
static inline const char *amic_type_str(enum amic_type type)
{
switch (type) {
case AMIC_TYPE_DIFFERENTIAL:
return "DIFFERENTIAL";
case AMIC_TYPE_SINGLE_ENDED:
return "SINGLE ENDED";
default:
return "Unknown";
}
}
/*
* Read'n'write functions
*/
/* Read a register from the audio-bank of AB8500 */
static int ab8500_codec_read_reg(void *context, unsigned int reg,
unsigned int *value)
{
struct device *dev = context;
int status;
u8 value8;
status = abx500_get_register_interruptible(dev, AB8500_AUDIO,
reg, &value8);
*value = (unsigned int)value8;
return status;
}
/* Write to a register in the audio-bank of AB8500 */
static int ab8500_codec_write_reg(void *context, unsigned int reg,
unsigned int value)
{
struct device *dev = context;
return abx500_set_register_interruptible(dev, AB8500_AUDIO,
reg, value);
}
static const struct regmap_config ab8500_codec_regmap = {
.reg_read = ab8500_codec_read_reg,
.reg_write = ab8500_codec_write_reg,
};
/*
* Controls - DAPM
*/
/* Earpiece */
/* Earpiece source selector */
static const char * const enum_ear_lineout_source[] = {"Headset Left",
"Speaker Left"};
static SOC_ENUM_SINGLE_DECL(dapm_enum_ear_lineout_source, AB8500_DMICFILTCONF,
AB8500_DMICFILTCONF_DA3TOEAR, enum_ear_lineout_source);
static const struct snd_kcontrol_new dapm_ear_lineout_source =
SOC_DAPM_ENUM("Earpiece or LineOut Mono Source",
dapm_enum_ear_lineout_source);
/* LineOut */
/* LineOut source selector */
static const char * const enum_lineout_source[] = {"Mono Path", "Stereo Path"};
static SOC_ENUM_DOUBLE_DECL(dapm_enum_lineout_source, AB8500_ANACONF5,
AB8500_ANACONF5_HSLDACTOLOL,
AB8500_ANACONF5_HSRDACTOLOR, enum_lineout_source);
static const struct snd_kcontrol_new dapm_lineout_source[] = {
SOC_DAPM_ENUM("LineOut Source", dapm_enum_lineout_source),
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/device.h`, `linux/slab.h`, `linux/moduleparam.h`, `linux/init.h`, `linux/delay.h`, `linux/pm.h`.
- Detected declarations: `struct ab8500_codec_drvdata`, `enum sid_state`, `function ab8500_codec_read_reg`, `function ab8500_codec_write_reg`, `function sid_status_control_get`, `function sid_status_control_put`, `function ab8500_audio_init_audioblock`, `function ab8500_audio_setup_mics`, `function ab8500_audio_set_ear_cmv`, `function ab8500_audio_set_bit_delay`.
- 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.