sound/soc/fsl/fsl-asoc-card.c
Source file repositories/reference/linux-study-clean/sound/soc/fsl/fsl-asoc-card.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/fsl/fsl-asoc-card.c- Extension
.c- Size
- 37845 bytes
- Lines
- 1222
- 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/i2c.hlinux/module.hlinux/of_platform.hsound/ac97_codec.hsound/pcm_params.hsound/soc.hsound/jack.hsound/simple_card_utils.hfsl_esai.hfsl_sai.himx-audmux.h../codecs/sgtl5000.h../codecs/wm8962.h../codecs/wm8960.h../codecs/wm8994.h../codecs/tlv320aic31xx.h../codecs/nau8822.h../codecs/wm8904.h
Detected Declarations
struct codec_privstruct cpu_privstruct fsl_asoc_card_privfunction fsl_asoc_card_is_ac97function fsl_asoc_card_hw_paramsfunction fsl_asoc_card_hw_freefunction for_each_rtd_codec_daisfunction fsl_asoc_card_startupfunction linksfunction be_hw_params_fixupfunction fsl_asoc_card_audmux_initfunction modefunction fsl_asoc_card_spdif_initfunction hp_jack_eventfunction mic_jack_eventfunction fsl_asoc_card_late_probefunction for_each_rtd_codec_daisfunction fsl_asoc_card_probefunction for_each_link_codecsfunction for_each_link_codecsfunction simple_util_init_jack
Annotated Snippet
struct codec_priv {
struct clk *mclk;
unsigned long mclk_freq;
unsigned long free_freq;
u32 mclk_id;
int fll_id;
int pll_id;
int pll_ratio_s24;
};
/**
* struct cpu_priv - CPU private data
* @sysclk_freq: SYSCLK rates for set_sysclk()
* @sysclk_dir: SYSCLK directions for set_sysclk()
* @sysclk_id: SYSCLK ids for set_sysclk()
* @sysclk_ratio: SYSCLK ratio on sample rate
* @slot_width: Slot width of each frame
* @slot_num: Number of slots of each frame
*
* Note: [1] for tx and [0] for rx
*/
struct cpu_priv {
unsigned long sysclk_freq[2];
u32 sysclk_dir[2];
u32 sysclk_id[2];
u32 sysclk_ratio[2];
u32 slot_width;
u32 slot_num;
};
/**
* struct fsl_asoc_card_priv - Freescale Generic ASOC card private data
* @dai_link: DAI link structure including normal one and DPCM link
* @hp_jack: Headphone Jack structure
* @mic_jack: Microphone Jack structure
* @pdev: platform device pointer
* @codec_priv: CODEC private data
* @cpu_priv: CPU private data
* @card: ASoC card structure
* @constraint_rates: array of supported rates
* @constraint_channels: array of supported channels
* @streams: Mask of current active streams
* @sample_rate: Current sample rate
* @sample_format: Current sample format
* @asrc_rate: ASRC sample rate used by Back-Ends
* @asrc_format: ASRC sample format used by Back-Ends
* @dai_fmt: DAI format between CPU and CODEC
* @exclude_format: excluded format;
* @name: Card name
*/
struct fsl_asoc_card_priv {
struct snd_soc_dai_link dai_link[3];
struct simple_util_jack hp_jack;
struct simple_util_jack mic_jack;
struct platform_device *pdev;
struct codec_priv codec_priv[2];
struct cpu_priv cpu_priv;
struct snd_soc_card card;
const struct snd_pcm_hw_constraint_list *constraint_rates;
const struct snd_pcm_hw_constraint_list *constraint_channels;
u8 streams;
u32 sample_rate;
snd_pcm_format_t sample_format;
u32 asrc_rate;
snd_pcm_format_t asrc_format;
u32 dai_fmt;
u64 exclude_format;
char name[32];
};
/*
* This dapm route map exists for DPCM link only.
* The other routes shall go through Device Tree.
*
* Note: keep all ASRC routes in the second half
* to drop them easily for non-ASRC cases.
*/
static const struct snd_soc_dapm_route audio_map[] = {
/* 1st half -- Normal DAPM routes */
{"Playback", NULL, "CPU-Playback"},
{"CPU-Capture", NULL, "Capture"},
/* 2nd half -- ASRC DAPM routes */
{"CPU-Playback", NULL, "ASRC-Playback"},
{"ASRC-Capture", NULL, "CPU-Capture"},
};
static const struct snd_soc_dapm_route audio_map_ac97[] = {
/* 1st half -- Normal DAPM routes */
{"AC97 Playback", NULL, "CPU AC97 Playback"},
Annotation
- Immediate include surface: `linux/clk.h`, `linux/i2c.h`, `linux/module.h`, `linux/of_platform.h`, `sound/ac97_codec.h`, `sound/pcm_params.h`, `sound/soc.h`, `sound/jack.h`.
- Detected declarations: `struct codec_priv`, `struct cpu_priv`, `struct fsl_asoc_card_priv`, `function fsl_asoc_card_is_ac97`, `function fsl_asoc_card_hw_params`, `function fsl_asoc_card_hw_free`, `function for_each_rtd_codec_dais`, `function fsl_asoc_card_startup`, `function links`, `function be_hw_params_fixup`.
- 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.