sound/soc/codecs/rt1316-sdw.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/rt1316-sdw.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/rt1316-sdw.c- Extension
.c- Size
- 20567 bytes
- Lines
- 783
- 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/delay.hlinux/device.hlinux/pm_runtime.hlinux/mod_devicetable.hlinux/module.hlinux/regmap.hsound/core.hsound/pcm.hsound/pcm_params.hsound/sdw.hsound/soc-dapm.hsound/initval.hrt1316-sdw.h
Detected Declarations
function rt1316_readable_registerfunction rt1316_volatile_registerfunction rt1316_read_propfunction rt1316_apply_bq_paramsfunction rt1316_io_initfunction rt1316_update_statusfunction rt1316_classd_eventfunction rt1316_pde24_eventfunction rt1316_set_sdw_streamfunction rt1316_sdw_shutdownfunction rt1316_sdw_hw_paramsfunction rt1316_sdw_pcm_hw_freefunction rt1316_sdw_parse_dtfunction rt1316_sdw_component_probefunction rt1316_sdw_initfunction rt1316_sdw_probefunction rt1316_sdw_removefunction rt1316_dev_suspendfunction rt1316_dev_resume
Annotated Snippet
if (!rt1316->bq_params) {
dev_err(dev, "%s: Could not allocate bq_params memory\n", __func__);
ret = -ENOMEM;
} else {
ret = device_property_read_u8_array(dev, "realtek,bq-params", rt1316->bq_params, rt1316->bq_params_cnt);
if (ret < 0)
dev_err(dev, "%s: Could not read list of realtek,bq-params\n", __func__);
}
}
dev_dbg(dev, "bq_params_cnt=%d\n", rt1316->bq_params_cnt);
return ret;
}
static int rt1316_sdw_component_probe(struct snd_soc_component *component)
{
struct rt1316_sdw_priv *rt1316 = snd_soc_component_get_drvdata(component);
int ret;
rt1316->component = component;
rt1316_sdw_parse_dt(rt1316, &rt1316->sdw_slave->dev);
if (!rt1316->first_hw_init)
return 0;
ret = pm_runtime_resume(component->dev);
if (ret < 0 && ret != -EACCES)
return ret;
/* apply BQ params */
rt1316_apply_bq_params(rt1316);
return 0;
}
static const struct snd_soc_component_driver soc_component_sdw_rt1316 = {
.probe = rt1316_sdw_component_probe,
.controls = rt1316_snd_controls,
.num_controls = ARRAY_SIZE(rt1316_snd_controls),
.dapm_widgets = rt1316_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(rt1316_dapm_widgets),
.dapm_routes = rt1316_dapm_routes,
.num_dapm_routes = ARRAY_SIZE(rt1316_dapm_routes),
.endianness = 1,
};
static const struct snd_soc_dai_ops rt1316_aif_dai_ops = {
.hw_params = rt1316_sdw_hw_params,
.hw_free = rt1316_sdw_pcm_hw_free,
.set_stream = rt1316_set_sdw_stream,
.shutdown = rt1316_sdw_shutdown,
};
#define RT1316_STEREO_RATES SNDRV_PCM_RATE_48000
#define RT1316_FORMATS (SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_S16_LE | \
SNDRV_PCM_FMTBIT_S24_LE)
static struct snd_soc_dai_driver rt1316_sdw_dai[] = {
{
.name = "rt1316-aif",
.playback = {
.stream_name = "DP1 Playback",
.channels_min = 1,
.channels_max = 2,
.rates = RT1316_STEREO_RATES,
.formats = RT1316_FORMATS,
},
.capture = {
.stream_name = "DP2 Capture",
.channels_min = 1,
.channels_max = 2,
.rates = RT1316_STEREO_RATES,
.formats = RT1316_FORMATS,
},
.ops = &rt1316_aif_dai_ops,
},
};
static int rt1316_sdw_init(struct device *dev, struct regmap *regmap,
struct sdw_slave *slave)
{
struct rt1316_sdw_priv *rt1316;
int ret;
rt1316 = devm_kzalloc(dev, sizeof(*rt1316), GFP_KERNEL);
if (!rt1316)
return -ENOMEM;
dev_set_drvdata(dev, rt1316);
rt1316->sdw_slave = slave;
Annotation
- Immediate include surface: `linux/delay.h`, `linux/device.h`, `linux/pm_runtime.h`, `linux/mod_devicetable.h`, `linux/module.h`, `linux/regmap.h`, `sound/core.h`, `sound/pcm.h`.
- Detected declarations: `function rt1316_readable_register`, `function rt1316_volatile_register`, `function rt1316_read_prop`, `function rt1316_apply_bq_params`, `function rt1316_io_init`, `function rt1316_update_status`, `function rt1316_classd_event`, `function rt1316_pde24_event`, `function rt1316_set_sdw_stream`, `function rt1316_sdw_shutdown`.
- 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.