sound/soc/codecs/jz4770.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/jz4770.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/jz4770.c- Extension
.c- Size
- 25668 bytes
- Lines
- 908
- 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/clk.hlinux/delay.hlinux/iopoll.hlinux/module.hlinux/regmap.hlinux/time64.hsound/pcm_params.hsound/soc.hsound/soc-dai.hsound/soc-dapm.hsound/tlv.h
Detected Declarations
struct jz_codecfunction jz4770_codec_set_bias_levelfunction jz4770_codec_startupfunction jz4770_codec_shutdownfunction jz4770_codec_pcm_triggerfunction jz4770_codec_mute_streamfunction hpout_eventfunction adc_poweron_eventfunction jz4770_codec_codec_init_regsfunction jz4770_codec_codec_probefunction jz4770_codec_hw_paramsfunction jz4770_codec_volatilefunction jz4770_codec_readablefunction jz4770_codec_writeablefunction jz4770_codec_io_waitfunction jz4770_codec_reg_readfunction jz4770_codec_reg_writefunction jz4770_codec_probe
Annotated Snippet
struct jz_codec {
struct device *dev;
struct regmap *regmap;
void __iomem *base;
};
static int jz4770_codec_set_bias_level(struct snd_soc_component *codec,
enum snd_soc_bias_level level)
{
struct jz_codec *jz_codec = snd_soc_component_get_drvdata(codec);
struct regmap *regmap = jz_codec->regmap;
switch (level) {
case SND_SOC_BIAS_PREPARE:
/* Reset all interrupt flags. */
regmap_write(regmap, JZ4770_CODEC_REG_IFR, REG_IFR_ALL_MASK);
regmap_clear_bits(regmap, JZ4770_CODEC_REG_CR_VIC,
REG_CR_VIC_SB);
msleep(250);
regmap_clear_bits(regmap, JZ4770_CODEC_REG_CR_VIC,
REG_CR_VIC_SB_SLEEP);
msleep(400);
break;
case SND_SOC_BIAS_STANDBY:
regmap_set_bits(regmap, JZ4770_CODEC_REG_CR_VIC,
REG_CR_VIC_SB_SLEEP);
regmap_set_bits(regmap, JZ4770_CODEC_REG_CR_VIC,
REG_CR_VIC_SB);
fallthrough;
default:
break;
}
return 0;
}
static int jz4770_codec_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct snd_soc_component *codec = dai->component;
struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(codec);
/*
* SYSCLK output from the codec to the AIC is required to keep the
* DMA transfer going during playback when all audible outputs have
* been disabled.
*/
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
snd_soc_dapm_force_enable_pin(dapm, "SYSCLK");
return 0;
}
static void jz4770_codec_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct snd_soc_component *codec = dai->component;
struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(codec);
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
snd_soc_dapm_disable_pin(dapm, "SYSCLK");
}
static int jz4770_codec_pcm_trigger(struct snd_pcm_substream *substream,
int cmd, struct snd_soc_dai *dai)
{
struct snd_soc_component *codec = dai->component;
struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(codec);
int ret = 0;
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
snd_soc_dapm_force_bias_level(dapm, SND_SOC_BIAS_ON);
break;
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
/* do nothing */
break;
default:
ret = -EINVAL;
}
return ret;
}
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/iopoll.h`, `linux/module.h`, `linux/regmap.h`, `linux/time64.h`, `sound/pcm_params.h`, `sound/soc.h`.
- Detected declarations: `struct jz_codec`, `function jz4770_codec_set_bias_level`, `function jz4770_codec_startup`, `function jz4770_codec_shutdown`, `function jz4770_codec_pcm_trigger`, `function jz4770_codec_mute_stream`, `function hpout_event`, `function adc_poweron_event`, `function jz4770_codec_codec_init_regs`, `function jz4770_codec_codec_probe`.
- 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.