sound/soc/fsl/imx-rpmsg.c
Source file repositories/reference/linux-study-clean/sound/soc/fsl/imx-rpmsg.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/fsl/imx-rpmsg.c- Extension
.c- Size
- 8192 bytes
- Lines
- 307
- Domain
- Driver Families
- Bucket
- sound/soc
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/of_platform.hlinux/of_reserved_mem.hlinux/i2c.hlinux/slab.hlinux/clk.hsound/soc.hsound/jack.hsound/control.hsound/pcm_params.hsound/soc-dapm.hsound/simple_card_utils.himx-pcm-rpmsg.h
Detected Declarations
struct imx_rpmsgfunction imx_rpmsg_hw_paramsfunction imx_rpmsg_late_probefunction imx_rpmsg_probe
Annotated Snippet
struct device_driver *codec_drv;
struct device *codec_dev = NULL;
codec_np = data->dai.codecs->of_node;
if (codec_np) {
struct platform_device *codec_pdev;
struct i2c_client *codec_i2c;
codec_i2c = of_find_i2c_device_by_node(codec_np);
if (codec_i2c)
codec_dev = &codec_i2c->dev;
if (!codec_dev) {
codec_pdev = of_find_device_by_node(codec_np);
if (codec_pdev)
codec_dev = &codec_pdev->dev;
}
}
if (codec_dev) {
codec_drv = codec_dev->driver;
if (codec_drv->pm) {
memcpy(&lpa_pm, codec_drv->pm, sizeof(lpa_pm));
lpa_pm.suspend = NULL;
lpa_pm.resume = NULL;
lpa_pm.freeze = NULL;
lpa_pm.thaw = NULL;
lpa_pm.poweroff = NULL;
lpa_pm.restore = NULL;
codec_drv->pm = &lpa_pm;
}
put_device(codec_dev);
}
}
if (!data->sysclk)
return 0;
ret = snd_soc_dai_set_sysclk(codec_dai, 0, data->sysclk, SND_SOC_CLOCK_IN);
if (ret && ret != -ENOTSUPP) {
dev_err(dev, "failed to set sysclk in %s\n", __func__);
return ret;
}
return 0;
}
static int imx_rpmsg_probe(struct platform_device *pdev)
{
struct snd_soc_dai_link_component *dlc;
struct snd_soc_dai *cpu_dai;
struct device_node *np = NULL;
struct of_phandle_args args;
const char *platform_name;
struct imx_rpmsg *data;
int ret = 0;
dlc = devm_kzalloc(&pdev->dev, 3 * sizeof(*dlc), GFP_KERNEL);
if (!dlc)
return -ENOMEM;
data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
if (!data) {
ret = -ENOMEM;
goto fail;
}
data->dai.cpus = &dlc[0];
data->dai.num_cpus = 1;
data->dai.platforms = &dlc[1];
data->dai.num_platforms = 1;
data->dai.codecs = &dlc[2];
data->dai.num_codecs = 1;
data->dai.name = "rpmsg hifi";
data->dai.stream_name = "rpmsg hifi";
data->dai.dai_fmt = SND_SOC_DAIFMT_I2S |
SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBC_CFC;
data->dai.ops = &imx_rpmsg_ops;
/*
* i.MX rpmsg sound cards work on codec slave mode. MCLK will be
* disabled by CPU DAI driver in hw_free(). Some codec requires MCLK
* present at power up/down sequence. So need to set ignore_pmdown_time
* to power down codec immediately before MCLK is turned off.
*/
data->dai.ignore_pmdown_time = 1;
data->dai.cpus->dai_name = pdev->dev.platform_data;
cpu_dai = snd_soc_find_dai_with_mutex(data->dai.cpus);
if (!cpu_dai) {
Annotation
- Immediate include surface: `linux/module.h`, `linux/of_platform.h`, `linux/of_reserved_mem.h`, `linux/i2c.h`, `linux/slab.h`, `linux/clk.h`, `sound/soc.h`, `sound/jack.h`.
- Detected declarations: `struct imx_rpmsg`, `function imx_rpmsg_hw_params`, `function imx_rpmsg_late_probe`, `function imx_rpmsg_probe`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: pattern 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.