drivers/soundwire/master.c
Source file repositories/reference/linux-study-clean/drivers/soundwire/master.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/soundwire/master.c- Extension
.c- Size
- 4972 bytes
- Lines
- 189
- Domain
- Driver Families
- Bucket
- drivers/soundwire
- 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/device.hlinux/acpi.hlinux/pm_runtime.hlinux/soundwire/sdw.hlinux/soundwire/sdw_type.hbus.h
Detected Declarations
function clock_frequencies_showfunction clock_gears_showfunction sdw_master_device_releasefunction sdw_master_device_addfunction sdw_master_device_del
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
// Copyright(c) 2019-2020 Intel Corporation.
#include <linux/device.h>
#include <linux/acpi.h>
#include <linux/pm_runtime.h>
#include <linux/soundwire/sdw.h>
#include <linux/soundwire/sdw_type.h>
#include "bus.h"
/*
* The 3s value for autosuspend will only be used if there are no
* devices physically attached on a bus segment. In practice enabling
* the bus operation will result in children devices become active and
* the master device will only suspend when all its children are no
* longer active.
*/
#define SDW_MASTER_SUSPEND_DELAY_MS 3000
/*
* The sysfs for properties reflects the MIPI description as given
* in the MIPI DisCo spec
*
* Base file is:
* sdw-master-N
* |---- revision
* |---- clk_stop_modes
* |---- max_clk_freq
* |---- clk_freq
* |---- clk_gears
* |---- default_row
* |---- default_col
* |---- dynamic_shape
* |---- err_threshold
*/
#define sdw_master_attr(field, format_string) \
static ssize_t field##_show(struct device *dev, \
struct device_attribute *attr, \
char *buf) \
{ \
struct sdw_master_device *md = dev_to_sdw_master_device(dev); \
return sprintf(buf, format_string, md->bus->prop.field); \
} \
static DEVICE_ATTR_RO(field)
sdw_master_attr(revision, "0x%x\n");
sdw_master_attr(clk_stop_modes, "0x%x\n");
sdw_master_attr(max_clk_freq, "%d\n");
sdw_master_attr(default_row, "%d\n");
sdw_master_attr(default_col, "%d\n");
sdw_master_attr(default_frame_rate, "%d\n");
sdw_master_attr(dynamic_frame, "%d\n");
sdw_master_attr(err_threshold, "%d\n");
static ssize_t clock_frequencies_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct sdw_master_device *md = dev_to_sdw_master_device(dev);
ssize_t size = 0;
int i;
for (i = 0; i < md->bus->prop.num_clk_freq; i++)
size += sprintf(buf + size, "%8d ",
md->bus->prop.clk_freq[i]);
size += sprintf(buf + size, "\n");
return size;
}
static DEVICE_ATTR_RO(clock_frequencies);
static ssize_t clock_gears_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct sdw_master_device *md = dev_to_sdw_master_device(dev);
ssize_t size = 0;
int i;
for (i = 0; i < md->bus->prop.num_clk_gears; i++)
size += sprintf(buf + size, "%8d ",
md->bus->prop.clk_gears[i]);
size += sprintf(buf + size, "\n");
return size;
}
static DEVICE_ATTR_RO(clock_gears);
static struct attribute *master_node_attrs[] = {
&dev_attr_revision.attr,
&dev_attr_clk_stop_modes.attr,
Annotation
- Immediate include surface: `linux/device.h`, `linux/acpi.h`, `linux/pm_runtime.h`, `linux/soundwire/sdw.h`, `linux/soundwire/sdw_type.h`, `bus.h`.
- Detected declarations: `function clock_frequencies_show`, `function clock_gears_show`, `function sdw_master_device_release`, `function sdw_master_device_add`, `function sdw_master_device_del`.
- Atlas domain: Driver Families / drivers/soundwire.
- 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.