drivers/crypto/allwinner/sun4i-ss/sun4i-ss-core.c
Source file repositories/reference/linux-study-clean/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/crypto/allwinner/sun4i-ss/sun4i-ss-core.c- Extension
.c- Size
- 13989 bytes
- Lines
- 523
- 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.
- 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.hlinux/crypto.hlinux/debugfs.hlinux/io.hlinux/module.hlinux/of.hlinux/platform_device.hcrypto/scatterwalk.hlinux/scatterlist.hlinux/interrupt.hlinux/delay.hlinux/reset.hsun4i-ss.h
Detected Declarations
function sun4i_ss_debugfs_showfunction sun4i_ss_pm_suspendfunction sun4i_ss_pm_resumefunction sun4i_ss_pm_initfunction sun4i_ss_pm_exitfunction sun4i_ss_probefunction sun4i_ss_remove
Annotated Snippet
switch (ss_algs[i].type) {
case CRYPTO_ALG_TYPE_SKCIPHER:
seq_printf(seq, "%s %s reqs=%lu opti=%lu fallback=%lu tsize=%lu\n",
ss_algs[i].alg.crypto.base.cra_driver_name,
ss_algs[i].alg.crypto.base.cra_name,
ss_algs[i].stat_req, ss_algs[i].stat_opti, ss_algs[i].stat_fb,
ss_algs[i].stat_bytes);
break;
case CRYPTO_ALG_TYPE_AHASH:
seq_printf(seq, "%s %s reqs=%lu\n",
ss_algs[i].alg.hash.halg.base.cra_driver_name,
ss_algs[i].alg.hash.halg.base.cra_name,
ss_algs[i].stat_req);
break;
}
}
return 0;
}
DEFINE_SHOW_ATTRIBUTE(sun4i_ss_debugfs);
/*
* Power management strategy: The device is suspended unless a TFM exists for
* one of the algorithms proposed by this driver.
*/
static int sun4i_ss_pm_suspend(struct device *dev)
{
struct sun4i_ss_ctx *ss = dev_get_drvdata(dev);
reset_control_assert(ss->reset);
clk_disable_unprepare(ss->ssclk);
clk_disable_unprepare(ss->busclk);
return 0;
}
static int sun4i_ss_pm_resume(struct device *dev)
{
struct sun4i_ss_ctx *ss = dev_get_drvdata(dev);
int err;
err = clk_prepare_enable(ss->busclk);
if (err) {
dev_err(ss->dev, "Cannot prepare_enable busclk\n");
goto err_enable;
}
err = clk_prepare_enable(ss->ssclk);
if (err) {
dev_err(ss->dev, "Cannot prepare_enable ssclk\n");
goto err_enable;
}
err = reset_control_deassert(ss->reset);
if (err) {
dev_err(ss->dev, "Cannot deassert reset control\n");
goto err_enable;
}
return err;
err_enable:
sun4i_ss_pm_suspend(dev);
return err;
}
static const struct dev_pm_ops sun4i_ss_pm_ops = {
SET_RUNTIME_PM_OPS(sun4i_ss_pm_suspend, sun4i_ss_pm_resume, NULL)
};
/*
* When power management is enabled, this function enables the PM and set the
* device as suspended
* When power management is disabled, this function just enables the device
*/
static int sun4i_ss_pm_init(struct sun4i_ss_ctx *ss)
{
int err;
pm_runtime_use_autosuspend(ss->dev);
pm_runtime_set_autosuspend_delay(ss->dev, 2000);
err = pm_runtime_set_suspended(ss->dev);
if (err)
return err;
pm_runtime_enable(ss->dev);
return err;
}
static void sun4i_ss_pm_exit(struct sun4i_ss_ctx *ss)
{
Annotation
- Immediate include surface: `linux/clk.h`, `linux/crypto.h`, `linux/debugfs.h`, `linux/io.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `crypto/scatterwalk.h`.
- Detected declarations: `function sun4i_ss_debugfs_show`, `function sun4i_ss_pm_suspend`, `function sun4i_ss_pm_resume`, `function sun4i_ss_pm_init`, `function sun4i_ss_pm_exit`, `function sun4i_ss_probe`, `function sun4i_ss_remove`.
- 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.
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.