sound/i2c/other/ak4114.c
Source file repositories/reference/linux-study-clean/sound/i2c/other/ak4114.c
File Facts
- System
- Linux kernel
- Corpus path
sound/i2c/other/ak4114.c- Extension
.c- Size
- 18362 bytes
- Lines
- 614
- Domain
- Driver Families
- Bucket
- sound/i2c
- 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.
- 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/slab.hlinux/delay.hlinux/module.hsound/core.hsound/control.hsound/pcm.hsound/ak4114.hsound/asoundef.hsound/info.h
Detected Declarations
function reg_writefunction reg_readfunction snd_ak4114_freefunction snd_ak4114_dev_freefunction snd_ak4114_createfunction snd_ak4114_reg_writefunction ak4114_init_regsfunction snd_ak4114_reinitfunction external_ratefunction snd_ak4114_in_error_infofunction snd_ak4114_in_error_getfunction snd_ak4114_in_bit_getfunction snd_ak4114_rate_infofunction snd_ak4114_rate_getfunction snd_ak4114_spdif_infofunction snd_ak4114_spdif_getfunction snd_ak4114_spdif_playback_getfunction snd_ak4114_spdif_playback_putfunction snd_ak4114_spdif_mask_infofunction snd_ak4114_spdif_mask_getfunction snd_ak4114_spdif_pinfofunction snd_ak4114_spdif_pgetfunction snd_ak4114_spdif_qinfofunction snd_ak4114_spdif_qgetfunction snd_ak4114_proc_regs_readfunction snd_ak4114_proc_initfunction snd_ak4114_buildfunction ak4114_notifyfunction snd_ak4114_external_ratefunction snd_ak4114_check_rate_and_errorsfunction ak4114_statsfunction snd_ak4114_suspendfunction snd_ak4114_resumeexport snd_ak4114_createexport snd_ak4114_reg_writeexport snd_ak4114_reinitexport snd_ak4114_buildexport snd_ak4114_external_rateexport snd_ak4114_check_rate_and_errorsexport snd_ak4114_suspendexport snd_ak4114_resume
Annotated Snippet
if (strstr(kctl->id.name, "Playback")) {
if (ply_substream == NULL) {
snd_ctl_free_one(kctl);
ak4114->kctls[idx] = NULL;
continue;
}
kctl->id.device = ply_substream->pcm->device;
kctl->id.subdevice = ply_substream->number;
} else {
kctl->id.device = cap_substream->pcm->device;
kctl->id.subdevice = cap_substream->number;
}
err = snd_ctl_add(ak4114->card, kctl);
if (err < 0)
return err;
ak4114->kctls[idx] = kctl;
}
snd_ak4114_proc_init(ak4114);
/* trigger workq */
schedule_delayed_work(&ak4114->work, HZ / 10);
return 0;
}
EXPORT_SYMBOL(snd_ak4114_build);
/* notify kcontrols if any parameters are changed */
static void ak4114_notify(struct ak4114 *ak4114,
unsigned char rcs0, unsigned char rcs1,
unsigned char c0, unsigned char c1)
{
if (!ak4114->kctls[0])
return;
if (rcs0 & AK4114_PAR)
snd_ctl_notify(ak4114->card, SNDRV_CTL_EVENT_MASK_VALUE,
&ak4114->kctls[0]->id);
if (rcs0 & AK4114_V)
snd_ctl_notify(ak4114->card, SNDRV_CTL_EVENT_MASK_VALUE,
&ak4114->kctls[1]->id);
if (rcs1 & AK4114_CCRC)
snd_ctl_notify(ak4114->card, SNDRV_CTL_EVENT_MASK_VALUE,
&ak4114->kctls[2]->id);
if (rcs1 & AK4114_QCRC)
snd_ctl_notify(ak4114->card, SNDRV_CTL_EVENT_MASK_VALUE,
&ak4114->kctls[3]->id);
/* rate change */
if (c1 & 0xf0)
snd_ctl_notify(ak4114->card, SNDRV_CTL_EVENT_MASK_VALUE,
&ak4114->kctls[4]->id);
if ((c0 & AK4114_PEM) | (c0 & AK4114_CINT))
snd_ctl_notify(ak4114->card, SNDRV_CTL_EVENT_MASK_VALUE,
&ak4114->kctls[9]->id);
if (c0 & AK4114_QINT)
snd_ctl_notify(ak4114->card, SNDRV_CTL_EVENT_MASK_VALUE,
&ak4114->kctls[10]->id);
if (c0 & AK4114_AUDION)
snd_ctl_notify(ak4114->card, SNDRV_CTL_EVENT_MASK_VALUE,
&ak4114->kctls[11]->id);
if (c0 & AK4114_AUTO)
snd_ctl_notify(ak4114->card, SNDRV_CTL_EVENT_MASK_VALUE,
&ak4114->kctls[12]->id);
if (c0 & AK4114_DTSCD)
snd_ctl_notify(ak4114->card, SNDRV_CTL_EVENT_MASK_VALUE,
&ak4114->kctls[13]->id);
if (c0 & AK4114_UNLCK)
snd_ctl_notify(ak4114->card, SNDRV_CTL_EVENT_MASK_VALUE,
&ak4114->kctls[14]->id);
}
int snd_ak4114_external_rate(struct ak4114 *ak4114)
{
unsigned char rcs1;
rcs1 = reg_read(ak4114, AK4114_REG_RCS1);
return external_rate(rcs1);
}
EXPORT_SYMBOL(snd_ak4114_external_rate);
int snd_ak4114_check_rate_and_errors(struct ak4114 *ak4114, unsigned int flags)
{
struct snd_pcm_runtime *runtime = ak4114->capture_substream ? ak4114->capture_substream->runtime : NULL;
unsigned long _flags;
int res = 0;
unsigned char rcs0, rcs1;
unsigned char c0, c1;
rcs1 = reg_read(ak4114, AK4114_REG_RCS1);
if (flags & AK4114_CHECK_NO_STAT)
Annotation
- Immediate include surface: `linux/slab.h`, `linux/delay.h`, `linux/module.h`, `sound/core.h`, `sound/control.h`, `sound/pcm.h`, `sound/ak4114.h`, `sound/asoundef.h`.
- Detected declarations: `function reg_write`, `function reg_read`, `function snd_ak4114_free`, `function snd_ak4114_dev_free`, `function snd_ak4114_create`, `function snd_ak4114_reg_write`, `function ak4114_init_regs`, `function snd_ak4114_reinit`, `function external_rate`, `function snd_ak4114_in_error_info`.
- Atlas domain: Driver Families / sound/i2c.
- Implementation status: integration 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.