sound/soc/codecs/jz4760.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/jz4760.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/jz4760.c- Extension
.c- Size
- 24218 bytes
- Lines
- 861
- 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/bitfield.hlinux/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 jz4760_codec_set_bias_levelfunction jz4760_codec_startupfunction jz4760_codec_shutdownfunction jz4760_codec_pcm_triggerfunction jz4760_codec_mute_streamfunction hpout_eventfunction jz4760_codec_codec_init_regsfunction jz4760_codec_codec_probefunction jz4760_codec_hw_paramsfunction jz4760_codec_volatilefunction jz4760_codec_writeablefunction jz4760_codec_io_waitfunction jz4760_codec_reg_readfunction jz4760_codec_reg_writefunction jz4760_codec_probe
Annotated Snippet
struct jz_codec {
struct device *dev;
struct regmap *regmap;
void __iomem *base;
};
static int jz4760_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, JZ4760_CODEC_REG_IFR, REG_IFR_ALL_MASK);
regmap_clear_bits(regmap, JZ4760_CODEC_REG_PMR1, REG_PMR1_SB);
msleep(250);
regmap_clear_bits(regmap, JZ4760_CODEC_REG_PMR1, REG_PMR1_SB_SLEEP);
msleep(400);
break;
case SND_SOC_BIAS_STANDBY:
regmap_set_bits(regmap, JZ4760_CODEC_REG_PMR1, REG_PMR1_SB_SLEEP);
regmap_set_bits(regmap, JZ4760_CODEC_REG_PMR1, REG_PMR1_SB);
break;
default:
break;
}
return 0;
}
static int jz4760_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);
int ret = 0;
/*
* 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)
ret = snd_soc_dapm_force_enable_pin(dapm, "SYSCLK");
return ret;
}
static void jz4760_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 jz4760_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;
}
static int jz4760_codec_mute_stream(struct snd_soc_dai *dai, int mute, int direction)
{
struct snd_soc_component *codec = dai->component;
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/clk.h`, `linux/delay.h`, `linux/iopoll.h`, `linux/module.h`, `linux/regmap.h`, `linux/time64.h`, `sound/pcm_params.h`.
- Detected declarations: `struct jz_codec`, `function jz4760_codec_set_bias_level`, `function jz4760_codec_startup`, `function jz4760_codec_shutdown`, `function jz4760_codec_pcm_trigger`, `function jz4760_codec_mute_stream`, `function hpout_event`, `function jz4760_codec_codec_init_regs`, `function jz4760_codec_codec_probe`, `function jz4760_codec_hw_params`.
- 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.