drivers/soc/ti/pruss.c
Source file repositories/reference/linux-study-clean/drivers/soc/ti/pruss.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/soc/ti/pruss.c- Extension
.c- Size
- 15429 bytes
- Lines
- 602
- 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/clk-provider.hlinux/dma-mapping.hlinux/io.hlinux/mfd/syscon.hlinux/module.hlinux/of.hlinux/of_address.hlinux/of_platform.hlinux/platform_device.hlinux/pm_runtime.hlinux/pruss_driver.hlinux/regmap.hlinux/remoteproc.hlinux/slab.hpruss.h
Detected Declarations
struct pruss_private_datafunction pruss_getfunction pruss_putfunction pruss_request_mem_regionfunction pruss_release_mem_regionfunction pruss_cfg_get_gpmuxfunction pruss_cfg_set_gpmuxfunction pruss_cfg_gpimodefunction pruss_cfg_miirt_enablefunction pruss_cfg_xfr_enablefunction pruss_of_free_clk_providerfunction pruss_clk_unregister_muxfunction pruss_clk_mux_setupfunction pruss_clk_initfunction pruss_of_setup_memoriesfunction pruss_cfg_of_initfunction pruss_probefunction pruss_removeexport pruss_getexport pruss_putexport pruss_request_mem_regionexport pruss_release_mem_regionexport pruss_cfg_get_gpmuxexport pruss_cfg_set_gpmuxexport pruss_cfg_gpimodeexport pruss_cfg_miirt_enableexport pruss_cfg_xfr_enable
Annotated Snippet
struct pruss_private_data {
bool has_no_sharedram;
bool has_core_mux_clock;
};
/**
* pruss_get() - get the pruss for a given PRU remoteproc
* @rproc: remoteproc handle of a PRU instance
*
* Finds the parent pruss device for a PRU given the @rproc handle of the
* PRU remote processor. This function increments the pruss device's refcount,
* so always use pruss_put() to decrement it back once pruss isn't needed
* anymore.
*
* This API doesn't check if @rproc is valid or not. It is expected the caller
* will have done a pru_rproc_get() on @rproc, before calling this API to make
* sure that @rproc is valid.
*
* Return: pruss handle on success, and an ERR_PTR on failure using one
* of the following error values
* -EINVAL if invalid parameter
* -ENODEV if PRU device or PRUSS device is not found
*/
struct pruss *pruss_get(struct rproc *rproc)
{
struct pruss *pruss;
struct device *dev;
struct platform_device *ppdev;
if (IS_ERR_OR_NULL(rproc))
return ERR_PTR(-EINVAL);
dev = &rproc->dev;
/* make sure it is PRU rproc */
if (!dev->parent || !is_pru_rproc(dev->parent))
return ERR_PTR(-ENODEV);
ppdev = to_platform_device(dev->parent->parent);
pruss = platform_get_drvdata(ppdev);
if (!pruss)
return ERR_PTR(-ENODEV);
get_device(pruss->dev);
return pruss;
}
EXPORT_SYMBOL_GPL(pruss_get);
/**
* pruss_put() - decrement pruss device's usecount
* @pruss: pruss handle
*
* Complimentary function for pruss_get(). Needs to be called
* after the PRUSS is used, and only if the pruss_get() succeeds.
*/
void pruss_put(struct pruss *pruss)
{
if (IS_ERR_OR_NULL(pruss))
return;
put_device(pruss->dev);
}
EXPORT_SYMBOL_GPL(pruss_put);
/**
* pruss_request_mem_region() - request a memory resource
* @pruss: the pruss instance
* @mem_id: the memory resource id
* @region: pointer to memory region structure to be filled in
*
* This function allows a client driver to request a memory resource,
* and if successful, will let the client driver own the particular
* memory region until released using the pruss_release_mem_region()
* API.
*
* Return: 0 if requested memory region is available (in such case pointer to
* memory region is returned via @region), an error otherwise
*/
int pruss_request_mem_region(struct pruss *pruss, enum pruss_mem mem_id,
struct pruss_mem_region *region)
{
if (!pruss || !region || mem_id >= PRUSS_MEM_MAX)
return -EINVAL;
mutex_lock(&pruss->lock);
if (pruss->mem_in_use[mem_id]) {
mutex_unlock(&pruss->lock);
return -EBUSY;
Annotation
- Immediate include surface: `linux/clk-provider.h`, `linux/dma-mapping.h`, `linux/io.h`, `linux/mfd/syscon.h`, `linux/module.h`, `linux/of.h`, `linux/of_address.h`, `linux/of_platform.h`.
- Detected declarations: `struct pruss_private_data`, `function pruss_get`, `function pruss_put`, `function pruss_request_mem_region`, `function pruss_release_mem_region`, `function pruss_cfg_get_gpmux`, `function pruss_cfg_set_gpmux`, `function pruss_cfg_gpimode`, `function pruss_cfg_miirt_enable`, `function pruss_cfg_xfr_enable`.
- 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.