sound/soc/fsl/imx-card.c
Source file repositories/reference/linux-study-clean/sound/soc/fsl/imx-card.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/fsl/imx-card.c- Extension
.c- Size
- 26804 bytes
- Lines
- 945
- 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/module.hlinux/init.hlinux/slab.hlinux/gpio/consumer.hlinux/of.hlinux/i2c.hlinux/clk.hsound/soc.hsound/pcm_params.hsound/pcm.hsound/soc-dapm.hsound/simple_card_utils.hfsl_sai.h
Detected Declarations
struct imx_akcodec_fs_mulstruct imx_akcodec_tdm_fs_mulstruct imx_card_plat_datastruct dai_link_datastruct imx_card_dataenum codec_typefunction format_is_dsdfunction format_is_tdmfunction codec_is_akcodecfunction akcodec_get_mclk_ratefunction imx_aif_hw_paramsfunction for_each_rtd_codec_daisfunction ak5558_hw_rule_ratefunction imx_aif_startupfunction imx_aif_shutdownfunction be_hw_params_fixupfunction imx_card_parse_offunction for_each_child_of_node_scopedfunction imx_card_probefunction for_each_card_prelinksfunction for_each_card_prelinks
Annotated Snippet
struct imx_akcodec_fs_mul {
unsigned int rmin;
unsigned int rmax;
unsigned int wmin;
unsigned int wmax;
};
/*
* Mapping TDM mode and frame width
*/
struct imx_akcodec_tdm_fs_mul {
unsigned int min;
unsigned int max;
unsigned int mul;
};
/*
* struct imx_card_plat_data - specific info for codecs
*
* @fs_mul: ratio of mclk/fs for normal mode
* @tdm_fs_mul: ratio of mclk/fs for tdm mode
* @support_rates: supported sample rate
* @support_tdm_rates: supported sample rate for tdm mode
* @support_channels: supported channels
* @support_tdm_channels: supported channels for tdm mode
* @num_fs_mul: ARRAY_SIZE of fs_mul
* @num_tdm_fs_mul: ARRAY_SIZE of tdm_fs_mul
* @num_rates: ARRAY_SIZE of support_rates
* @num_tdm_rates: ARRAY_SIZE of support_tdm_rates
* @num_channels: ARRAY_SIZE of support_channels
* @num_tdm_channels: ARRAY_SIZE of support_tdm_channels
* @type: codec type
*/
struct imx_card_plat_data {
struct imx_akcodec_fs_mul *fs_mul;
struct imx_akcodec_tdm_fs_mul *tdm_fs_mul;
const u32 *support_rates;
const u32 *support_tdm_rates;
const u32 *support_channels;
const u32 *support_tdm_channels;
unsigned int num_fs_mul;
unsigned int num_tdm_fs_mul;
unsigned int num_rates;
unsigned int num_tdm_rates;
unsigned int num_channels;
unsigned int num_tdm_channels;
unsigned int num_codecs;
enum codec_type type;
};
/*
* struct dai_link_data - specific info for dai link
*
* @slots: slot number
* @slot_width: slot width value
* @cpu_sysclk_id: sysclk id for cpu dai
* @one2one_ratio: true if mclk equal to bclk
*/
struct dai_link_data {
unsigned int slots;
unsigned int slot_width;
unsigned int cpu_sysclk_id;
bool one2one_ratio;
};
/*
* struct imx_card_data - platform device data
*
* @plat_data: pointer of imx_card_plat_data
* @dapm_routes: pointer of dapm_routes
* @link_data: private data for dai link
* @card: card instance
* @num_dapm_routes: number of dapm_routes
* @asrc_rate: asrc rates
* @asrc_format: asrc format
*/
struct imx_card_data {
struct imx_card_plat_data *plat_data;
struct snd_soc_dapm_route *dapm_routes;
struct dai_link_data *link_data;
struct snd_soc_card card;
int num_dapm_routes;
u32 asrc_rate;
snd_pcm_format_t asrc_format;
};
static struct imx_akcodec_fs_mul ak4458_fs_mul[] = {
/* Normal, < 32kHz */
{ .rmin = 8000, .rmax = 24000, .wmin = 256, .wmax = 1024, },
/* Normal, 32kHz */
Annotation
- Immediate include surface: `linux/module.h`, `linux/init.h`, `linux/slab.h`, `linux/gpio/consumer.h`, `linux/of.h`, `linux/i2c.h`, `linux/clk.h`, `sound/soc.h`.
- Detected declarations: `struct imx_akcodec_fs_mul`, `struct imx_akcodec_tdm_fs_mul`, `struct imx_card_plat_data`, `struct dai_link_data`, `struct imx_card_data`, `enum codec_type`, `function format_is_dsd`, `function format_is_tdm`, `function codec_is_akcodec`, `function akcodec_get_mclk_rate`.
- 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.