drivers/crypto/rockchip/rk3288_crypto.c
Source file repositories/reference/linux-study-clean/drivers/crypto/rockchip/rk3288_crypto.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/crypto/rockchip/rk3288_crypto.c- Extension
.c- Size
- 11428 bytes
- Lines
- 449
- Domain
- Driver Families
- Bucket
- drivers/crypto
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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
rk3288_crypto.hcrypto/engine.hcrypto/internal/hash.hcrypto/internal/skcipher.hlinux/clk.hlinux/dma-mapping.hlinux/debugfs.hlinux/delay.hlinux/err.hlinux/kernel.hlinux/io.hlinux/module.hlinux/platform_device.hlinux/of.hlinux/reset.hlinux/spinlock.h
Detected Declarations
function rk_crypto_get_clksfunction rk_crypto_enable_clkfunction rk_crypto_disable_clkfunction rk_crypto_pm_suspendfunction rk_crypto_pm_resumefunction rk_crypto_pm_initfunction rk_crypto_pm_exitfunction rk_crypto_irq_handlefunction rk_crypto_debugfs_showfunction register_debugfsfunction rk_crypto_registerfunction rk_crypto_unregisterfunction rk_crypto_probefunction rk_crypto_remove
Annotated Snippet
if (cr > dev->variant->rkclks[j].max) {
err = clk_set_rate(dev->clks[i].clk,
dev->variant->rkclks[j].max);
if (err)
dev_err(dev->dev, "Fail downclocking %s from %lu to %lu\n",
dev->variant->rkclks[j].name, cr,
dev->variant->rkclks[j].max);
else
dev_info(dev->dev, "Downclocking %s from %lu to %lu\n",
dev->variant->rkclks[j].name, cr,
dev->variant->rkclks[j].max);
}
}
}
return 0;
}
static int rk_crypto_enable_clk(struct rk_crypto_info *dev)
{
int err;
err = clk_bulk_prepare_enable(dev->num_clks, dev->clks);
if (err)
dev_err(dev->dev, "Could not enable clock clks\n");
return err;
}
static void rk_crypto_disable_clk(struct rk_crypto_info *dev)
{
clk_bulk_disable_unprepare(dev->num_clks, dev->clks);
}
/*
* Power management strategy: The device is suspended until a request
* is handled. For avoiding suspend/resume yoyo, the autosuspend is set to 2s.
*/
static int rk_crypto_pm_suspend(struct device *dev)
{
struct rk_crypto_info *rkdev = dev_get_drvdata(dev);
rk_crypto_disable_clk(rkdev);
reset_control_assert(rkdev->rst);
return 0;
}
static int rk_crypto_pm_resume(struct device *dev)
{
struct rk_crypto_info *rkdev = dev_get_drvdata(dev);
int ret;
ret = rk_crypto_enable_clk(rkdev);
if (ret)
return ret;
reset_control_deassert(rkdev->rst);
return 0;
}
static const struct dev_pm_ops rk_crypto_pm_ops = {
SET_RUNTIME_PM_OPS(rk_crypto_pm_suspend, rk_crypto_pm_resume, NULL)
};
static int rk_crypto_pm_init(struct rk_crypto_info *rkdev)
{
int err;
pm_runtime_use_autosuspend(rkdev->dev);
pm_runtime_set_autosuspend_delay(rkdev->dev, 2000);
err = pm_runtime_set_suspended(rkdev->dev);
if (err)
return err;
pm_runtime_enable(rkdev->dev);
return err;
}
static void rk_crypto_pm_exit(struct rk_crypto_info *rkdev)
{
pm_runtime_disable(rkdev->dev);
}
static irqreturn_t rk_crypto_irq_handle(int irq, void *dev_id)
{
struct rk_crypto_info *dev = platform_get_drvdata(dev_id);
u32 interrupt_status;
interrupt_status = CRYPTO_READ(dev, RK_CRYPTO_INTSTS);
Annotation
- Immediate include surface: `rk3288_crypto.h`, `crypto/engine.h`, `crypto/internal/hash.h`, `crypto/internal/skcipher.h`, `linux/clk.h`, `linux/dma-mapping.h`, `linux/debugfs.h`, `linux/delay.h`.
- Detected declarations: `function rk_crypto_get_clks`, `function rk_crypto_enable_clk`, `function rk_crypto_disable_clk`, `function rk_crypto_pm_suspend`, `function rk_crypto_pm_resume`, `function rk_crypto_pm_init`, `function rk_crypto_pm_exit`, `function rk_crypto_irq_handle`, `function rk_crypto_debugfs_show`, `function register_debugfs`.
- Atlas domain: Driver Families / drivers/crypto.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.