sound/soc/meson/axg-pdm.c
Source file repositories/reference/linux-study-clean/sound/soc/meson/axg-pdm.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/meson/axg-pdm.c- Extension
.c- Size
- 17317 bytes
- Lines
- 642
- 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/module.hlinux/of_irq.hlinux/of_platform.hlinux/regmap.hsound/soc.hsound/soc-dai.hsound/pcm_params.h
Detected Declarations
struct axg_pdm_lpfstruct axg_pdm_hcicstruct axg_pdm_hpfstruct axg_pdm_filtersstruct axg_pdm_cfgstruct axg_pdmfunction axg_pdm_enablefunction axg_pdm_disablefunction axg_pdm_filters_enablefunction axg_pdm_triggerfunction axg_pdm_get_osfunction axg_pdm_set_sysclkfunction axg_pdm_set_sample_pointerfunction axg_pdm_set_channel_maskfunction axg_pdm_hw_paramsfunction axg_pdm_startupfunction axg_pdm_shutdownfunction axg_pdm_set_hcic_ctrlfunction axg_pdm_set_lpf_ctrlfunction axg_pdm_set_hpf_ctrlfunction axg_pdm_set_lpf_filtersfunction axg_pdm_dai_probefunction axg_pdm_dai_removefunction axg_pdm_probe
Annotated Snippet
struct axg_pdm_lpf {
unsigned int ds;
unsigned int round_mode;
const unsigned int *tap;
unsigned int tap_num;
};
struct axg_pdm_hcic {
unsigned int shift;
unsigned int mult;
unsigned int steps;
unsigned int ds;
};
struct axg_pdm_hpf {
unsigned int out_factor;
unsigned int steps;
};
struct axg_pdm_filters {
struct axg_pdm_hcic hcic;
struct axg_pdm_hpf hpf;
struct axg_pdm_lpf lpf[PDM_LPF_NUM];
};
struct axg_pdm_cfg {
const struct axg_pdm_filters *filters;
unsigned int sys_rate;
};
struct axg_pdm {
const struct axg_pdm_cfg *cfg;
struct regmap *map;
struct clk *dclk;
struct clk *sysclk;
struct clk *pclk;
};
static void axg_pdm_enable(struct regmap *map)
{
/* Reset AFIFO */
regmap_update_bits(map, PDM_CTRL, PDM_CTRL_RST_FIFO, PDM_CTRL_RST_FIFO);
regmap_update_bits(map, PDM_CTRL, PDM_CTRL_RST_FIFO, 0);
/* Enable PDM */
regmap_update_bits(map, PDM_CTRL, PDM_CTRL_EN, PDM_CTRL_EN);
}
static void axg_pdm_disable(struct regmap *map)
{
regmap_update_bits(map, PDM_CTRL, PDM_CTRL_EN, 0);
}
static void axg_pdm_filters_enable(struct regmap *map, bool enable)
{
unsigned int val = enable ? PDM_FILTER_EN : 0;
regmap_update_bits(map, PDM_HCIC_CTRL1, PDM_FILTER_EN, val);
regmap_update_bits(map, PDM_F1_CTRL, PDM_FILTER_EN, val);
regmap_update_bits(map, PDM_F2_CTRL, PDM_FILTER_EN, val);
regmap_update_bits(map, PDM_F3_CTRL, PDM_FILTER_EN, val);
regmap_update_bits(map, PDM_HPF_CTRL, PDM_FILTER_EN, val);
}
static int axg_pdm_trigger(struct snd_pcm_substream *substream, int cmd,
struct snd_soc_dai *dai)
{
struct axg_pdm *priv = snd_soc_dai_get_drvdata(dai);
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
axg_pdm_enable(priv->map);
return 0;
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
axg_pdm_disable(priv->map);
return 0;
default:
return -EINVAL;
}
}
static unsigned int axg_pdm_get_os(struct axg_pdm *priv)
{
const struct axg_pdm_filters *filters = priv->cfg->filters;
Annotation
- Immediate include surface: `linux/clk.h`, `linux/module.h`, `linux/of_irq.h`, `linux/of_platform.h`, `linux/regmap.h`, `sound/soc.h`, `sound/soc-dai.h`, `sound/pcm_params.h`.
- Detected declarations: `struct axg_pdm_lpf`, `struct axg_pdm_hcic`, `struct axg_pdm_hpf`, `struct axg_pdm_filters`, `struct axg_pdm_cfg`, `struct axg_pdm`, `function axg_pdm_enable`, `function axg_pdm_disable`, `function axg_pdm_filters_enable`, `function axg_pdm_trigger`.
- 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.