drivers/soc/pxa/ssp.c
Source file repositories/reference/linux-study-clean/drivers/soc/pxa/ssp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/soc/pxa/ssp.c- Extension
.c- Size
- 5207 bytes
- Lines
- 224
- Domain
- Driver Families
- Bucket
- drivers/soc
- 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/module.hlinux/kernel.hlinux/sched.hlinux/slab.hlinux/errno.hlinux/interrupt.hlinux/ioport.hlinux/init.hlinux/mutex.hlinux/clk.hlinux/err.hlinux/platform_device.hlinux/pxa2xx_ssp.hlinux/io.hlinux/of.hlinux/of_device.hasm/irq.h
Detected Declarations
function list_for_each_entryfunction list_for_each_entryfunction pxa_ssp_freefunction pxa_ssp_probefunction pxa_ssp_removefunction pxa_ssp_initfunction pxa_ssp_exitexport pxa_ssp_requestexport pxa_ssp_request_ofexport pxa_ssp_free
Annotated Snippet
if (ssp->port_id == port && ssp->use_count == 0) {
ssp->use_count++;
ssp->label = label;
break;
}
}
mutex_unlock(&ssp_lock);
if (&ssp->node == &ssp_list)
return NULL;
return ssp;
}
EXPORT_SYMBOL(pxa_ssp_request);
struct ssp_device *pxa_ssp_request_of(const struct device_node *of_node,
const char *label)
{
struct ssp_device *ssp = NULL;
mutex_lock(&ssp_lock);
list_for_each_entry(ssp, &ssp_list, node) {
if (ssp->of_node == of_node && ssp->use_count == 0) {
ssp->use_count++;
ssp->label = label;
break;
}
}
mutex_unlock(&ssp_lock);
if (&ssp->node == &ssp_list)
return NULL;
return ssp;
}
EXPORT_SYMBOL(pxa_ssp_request_of);
void pxa_ssp_free(struct ssp_device *ssp)
{
mutex_lock(&ssp_lock);
if (ssp->use_count) {
ssp->use_count--;
ssp->label = NULL;
} else
dev_err(ssp->dev, "device already free\n");
mutex_unlock(&ssp_lock);
}
EXPORT_SYMBOL(pxa_ssp_free);
#ifdef CONFIG_OF
static const struct of_device_id pxa_ssp_of_ids[] = {
{ .compatible = "mrvl,pxa25x-ssp", .data = (void *) PXA25x_SSP },
{ .compatible = "mvrl,pxa25x-nssp", .data = (void *) PXA25x_NSSP },
{ .compatible = "mrvl,pxa27x-ssp", .data = (void *) PXA27x_SSP },
{ .compatible = "mrvl,pxa3xx-ssp", .data = (void *) PXA3xx_SSP },
{ .compatible = "mvrl,pxa168-ssp", .data = (void *) PXA168_SSP },
{ .compatible = "mrvl,pxa910-ssp", .data = (void *) PXA910_SSP },
{ .compatible = "mrvl,ce4100-ssp", .data = (void *) CE4100_SSP },
{ },
};
MODULE_DEVICE_TABLE(of, pxa_ssp_of_ids);
#endif
static int pxa_ssp_probe(struct platform_device *pdev)
{
struct resource *res;
struct ssp_device *ssp;
struct device *dev = &pdev->dev;
ssp = devm_kzalloc(dev, sizeof(struct ssp_device), GFP_KERNEL);
if (ssp == NULL)
return -ENOMEM;
ssp->dev = dev;
ssp->clk = devm_clk_get(dev, NULL);
if (IS_ERR(ssp->clk))
return PTR_ERR(ssp->clk);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res == NULL) {
dev_err(dev, "no memory resource defined\n");
return -ENODEV;
}
res = devm_request_mem_region(dev, res->start, resource_size(res),
pdev->name);
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/sched.h`, `linux/slab.h`, `linux/errno.h`, `linux/interrupt.h`, `linux/ioport.h`, `linux/init.h`.
- Detected declarations: `function list_for_each_entry`, `function list_for_each_entry`, `function pxa_ssp_free`, `function pxa_ssp_probe`, `function pxa_ssp_remove`, `function pxa_ssp_init`, `function pxa_ssp_exit`, `export pxa_ssp_request`, `export pxa_ssp_request_of`, `export pxa_ssp_free`.
- Atlas domain: Driver Families / drivers/soc.
- 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.