drivers/soundwire/mipi_disco.c
Source file repositories/reference/linux-study-clean/drivers/soundwire/mipi_disco.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/soundwire/mipi_disco.c- Extension
.c- Size
- 14819 bytes
- Lines
- 530
- Domain
- Driver Families
- Bucket
- drivers/soundwire
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/device.hlinux/property.hlinux/mod_devicetable.hlinux/soundwire/sdw.hbus.h
Detected Declarations
function Configurationfunction mipi_device_property_read_boolfunction sdw_master_read_propfunction sdw_slave_read_dp0function sdw_slave_read_dpnfunction for_each_set_bitfunction sdw_slave_read_lane_mappingfunction sdw_slave_read_propexport sdw_master_read_propexport sdw_slave_read_lane_mappingexport sdw_slave_read_prop
Annotated Snippet
if (!prop->clk_freq) {
fwnode_handle_put(link);
return -ENOMEM;
}
ret = fwnode_property_read_u32_array(link,
"mipi-sdw-clock-frequencies-supported",
prop->clk_freq, prop->num_clk_freq);
if (ret < 0)
return ret;
}
/*
* Check the frequencies supported. If FW doesn't provide max
* freq, then populate here by checking values.
*/
if (!prop->max_clk_freq && prop->clk_freq) {
prop->max_clk_freq = prop->clk_freq[0];
for (i = 1; i < prop->num_clk_freq; i++) {
if (prop->clk_freq[i] > prop->max_clk_freq)
prop->max_clk_freq = prop->clk_freq[i];
}
}
scales_prop = "mipi-sdw-supported-clock-scales";
nval = fwnode_property_count_u32(link, scales_prop);
if (nval == 0) {
scales_prop = "mipi-sdw-supported-clock-gears";
nval = fwnode_property_count_u32(link, scales_prop);
}
if (nval > 0) {
prop->num_clk_gears = nval;
prop->clk_gears = devm_kcalloc(bus->dev, prop->num_clk_gears,
sizeof(*prop->clk_gears),
GFP_KERNEL);
if (!prop->clk_gears) {
fwnode_handle_put(link);
return -ENOMEM;
}
ret = fwnode_property_read_u32_array(link,
scales_prop,
prop->clk_gears,
prop->num_clk_gears);
if (ret < 0)
return ret;
}
fwnode_property_read_u32(link, "mipi-sdw-default-frame-rate",
&prop->default_frame_rate);
fwnode_property_read_u32(link, "mipi-sdw-default-frame-row-size",
&prop->default_row);
fwnode_property_read_u32(link, "mipi-sdw-default-frame-col-size",
&prop->default_col);
prop->dynamic_frame = mipi_fwnode_property_read_bool(link,
"mipi-sdw-dynamic-frame-shape");
fwnode_property_read_u32(link, "mipi-sdw-command-error-threshold",
&prop->err_threshold);
fwnode_handle_put(link);
return 0;
}
EXPORT_SYMBOL(sdw_master_read_prop);
static int sdw_slave_read_dp0(struct sdw_slave *slave,
struct fwnode_handle *port,
struct sdw_dp0_prop *dp0)
{
int nval;
int ret;
fwnode_property_read_u32(port, "mipi-sdw-port-max-wordlength",
&dp0->max_word);
fwnode_property_read_u32(port, "mipi-sdw-port-min-wordlength",
&dp0->min_word);
nval = fwnode_property_count_u32(port, "mipi-sdw-port-wordlength-configs");
if (nval > 0) {
dp0->num_words = nval;
dp0->words = devm_kcalloc(&slave->dev,
dp0->num_words, sizeof(*dp0->words),
GFP_KERNEL);
if (!dp0->words)
Annotation
- Immediate include surface: `linux/device.h`, `linux/property.h`, `linux/mod_devicetable.h`, `linux/soundwire/sdw.h`, `bus.h`.
- Detected declarations: `function Configuration`, `function mipi_device_property_read_bool`, `function sdw_master_read_prop`, `function sdw_slave_read_dp0`, `function sdw_slave_read_dpn`, `function for_each_set_bit`, `function sdw_slave_read_lane_mapping`, `function sdw_slave_read_prop`, `export sdw_master_read_prop`, `export sdw_slave_read_lane_mapping`.
- Atlas domain: Driver Families / drivers/soundwire.
- Implementation status: integration 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.