drivers/misc/atmel-ssc.c
Source file repositories/reference/linux-study-clean/drivers/misc/atmel-ssc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/misc/atmel-ssc.c- Extension
.c- Size
- 6008 bytes
- Lines
- 280
- Domain
- Driver Families
- Bucket
- drivers/misc
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/platform_device.hlinux/list.hlinux/clk.hlinux/err.hlinux/io.hlinux/mutex.hlinux/atmel-ssc.hlinux/slab.hlinux/module.hlinux/of.h../../sound/soc/atmel/atmel_ssc_dai.h
Detected Declarations
function ssc_freefunction atmel_ssc_get_driver_datafunction ssc_sound_dai_probefunction ssc_sound_dai_removefunction ssc_sound_dai_probefunction ssc_sound_dai_removefunction ssc_removeexport ssc_requestexport ssc_free
Annotated Snippet
if (ssc->pdev->dev.of_node) {
if (of_alias_get_id(ssc->pdev->dev.of_node, "ssc")
== ssc_num) {
ssc->pdev->id = ssc_num;
ssc_valid = 1;
break;
}
} else if (ssc->pdev->id == ssc_num) {
ssc_valid = 1;
break;
}
}
if (!ssc_valid) {
mutex_unlock(&user_lock);
pr_err("ssc: ssc%d platform device is missing\n", ssc_num);
return ERR_PTR(-ENODEV);
}
if (ssc->user) {
mutex_unlock(&user_lock);
dev_dbg(&ssc->pdev->dev, "module busy\n");
return ERR_PTR(-EBUSY);
}
ssc->user++;
mutex_unlock(&user_lock);
clk_prepare(ssc->clk);
return ssc;
}
EXPORT_SYMBOL(ssc_request);
void ssc_free(struct ssc_device *ssc)
{
bool disable_clk = true;
mutex_lock(&user_lock);
if (ssc->user)
ssc->user--;
else {
disable_clk = false;
dev_dbg(&ssc->pdev->dev, "device already free\n");
}
mutex_unlock(&user_lock);
if (disable_clk)
clk_unprepare(ssc->clk);
}
EXPORT_SYMBOL(ssc_free);
static struct atmel_ssc_platform_data at91rm9200_config = {
.use_dma = 0,
.has_fslen_ext = 0,
};
static struct atmel_ssc_platform_data at91sam9rl_config = {
.use_dma = 0,
.has_fslen_ext = 1,
};
static struct atmel_ssc_platform_data at91sam9g45_config = {
.use_dma = 1,
.has_fslen_ext = 1,
};
static const struct platform_device_id atmel_ssc_devtypes[] = {
{
.name = "at91rm9200_ssc",
.driver_data = (unsigned long) &at91rm9200_config,
}, {
.name = "at91sam9rl_ssc",
.driver_data = (unsigned long) &at91sam9rl_config,
}, {
.name = "at91sam9g45_ssc",
.driver_data = (unsigned long) &at91sam9g45_config,
}, {
/* sentinel */
}
};
#ifdef CONFIG_OF
static const struct of_device_id atmel_ssc_dt_ids[] = {
{
.compatible = "atmel,at91rm9200-ssc",
.data = &at91rm9200_config,
}, {
.compatible = "atmel,at91sam9rl-ssc",
.data = &at91sam9rl_config,
}, {
Annotation
- Immediate include surface: `linux/platform_device.h`, `linux/list.h`, `linux/clk.h`, `linux/err.h`, `linux/io.h`, `linux/mutex.h`, `linux/atmel-ssc.h`, `linux/slab.h`.
- Detected declarations: `function ssc_free`, `function atmel_ssc_get_driver_data`, `function ssc_sound_dai_probe`, `function ssc_sound_dai_remove`, `function ssc_sound_dai_probe`, `function ssc_sound_dai_remove`, `function ssc_remove`, `export ssc_request`, `export ssc_free`.
- Atlas domain: Driver Families / drivers/misc.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.