sound/soc/codecs/rt1308-sdw.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/rt1308-sdw.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/rt1308-sdw.c- Extension
.c- Size
- 21667 bytes
- Lines
- 806
- 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/soundwire/sdw.hlinux/soundwire/sdw_type.hlinux/soundwire/sdw_registers.hlinux/module.hlinux/regmap.hsound/core.hsound/pcm.hsound/pcm_params.hsound/sdw.hsound/soc.hsound/soc-dapm.hsound/initval.hrt1308.hrt1308-sdw.h
Detected Declarations
function rt1308_readable_registerfunction rt1308_volatile_registerfunction rt1308_clock_configfunction rt1308_read_propfunction rt1308_apply_calib_paramsfunction rt1308_apply_bq_paramsfunction rt1308_io_initfunction rt1308_update_statusfunction rt1308_bus_configfunction rt1308_interrupt_callbackfunction rt1308_classd_eventfunction rt1308_set_sdw_streamfunction rt1308_sdw_shutdownfunction rt1308_sdw_set_tdm_slotfunction rt1308_sdw_hw_paramsfunction rt1308_sdw_pcm_hw_freefunction rt1308_sdw_parse_dtfunction rt1308_sdw_component_probefunction rt1308_sdw_initfunction rt1308_sdw_probefunction rt1308_sdw_removefunction rt1308_dev_suspendfunction rt1308_dev_resume
Annotated Snippet
if (!rt1308->bq_params) {
dev_err(dev, "Could not allocate bq_params memory\n");
ret = -ENOMEM;
} else {
ret = device_property_read_u8_array(dev, "realtek,bq-params", rt1308->bq_params, rt1308->bq_params_cnt);
if (ret < 0)
dev_err(dev, "Could not read list of realtek,bq-params\n");
}
}
dev_dbg(dev, "bq_params_cnt=%d\n", rt1308->bq_params_cnt);
return ret;
}
static int rt1308_sdw_component_probe(struct snd_soc_component *component)
{
struct rt1308_sdw_priv *rt1308 = snd_soc_component_get_drvdata(component);
int ret;
rt1308->component = component;
rt1308_sdw_parse_dt(rt1308, &rt1308->sdw_slave->dev);
if (!rt1308->first_hw_init)
return 0;
ret = pm_runtime_resume(component->dev);
if (ret < 0 && ret != -EACCES)
return ret;
/* apply BQ params */
rt1308_apply_bq_params(rt1308);
return 0;
}
static const struct snd_soc_component_driver soc_component_sdw_rt1308 = {
.probe = rt1308_sdw_component_probe,
.controls = rt1308_snd_controls,
.num_controls = ARRAY_SIZE(rt1308_snd_controls),
.dapm_widgets = rt1308_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(rt1308_dapm_widgets),
.dapm_routes = rt1308_dapm_routes,
.num_dapm_routes = ARRAY_SIZE(rt1308_dapm_routes),
.endianness = 1,
};
static const struct snd_soc_dai_ops rt1308_aif_dai_ops = {
.hw_params = rt1308_sdw_hw_params,
.hw_free = rt1308_sdw_pcm_hw_free,
.set_stream = rt1308_set_sdw_stream,
.shutdown = rt1308_sdw_shutdown,
.set_tdm_slot = rt1308_sdw_set_tdm_slot,
};
#define RT1308_STEREO_RATES SNDRV_PCM_RATE_48000
#define RT1308_FORMATS (SNDRV_PCM_FMTBIT_S8 | \
SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_S16_LE | \
SNDRV_PCM_FMTBIT_S24_LE)
static struct snd_soc_dai_driver rt1308_sdw_dai[] = {
{
.name = "rt1308-aif",
.playback = {
.stream_name = "DP1 Playback",
.channels_min = 1,
.channels_max = 2,
.rates = RT1308_STEREO_RATES,
.formats = RT1308_FORMATS,
},
.ops = &rt1308_aif_dai_ops,
},
};
static int rt1308_sdw_init(struct device *dev, struct regmap *regmap,
struct sdw_slave *slave)
{
struct rt1308_sdw_priv *rt1308;
int ret;
rt1308 = devm_kzalloc(dev, sizeof(*rt1308), GFP_KERNEL);
if (!rt1308)
return -ENOMEM;
dev_set_drvdata(dev, rt1308);
rt1308->sdw_slave = slave;
rt1308->regmap = regmap;
regcache_cache_only(rt1308->regmap, true);
/*
Annotation
- Immediate include surface: `linux/delay.h`, `linux/device.h`, `linux/pm_runtime.h`, `linux/mod_devicetable.h`, `linux/soundwire/sdw.h`, `linux/soundwire/sdw_type.h`, `linux/soundwire/sdw_registers.h`, `linux/module.h`.
- Detected declarations: `function rt1308_readable_register`, `function rt1308_volatile_register`, `function rt1308_clock_config`, `function rt1308_read_prop`, `function rt1308_apply_calib_params`, `function rt1308_apply_bq_params`, `function rt1308_io_init`, `function rt1308_update_status`, `function rt1308_bus_config`, `function rt1308_interrupt_callback`.
- 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.