Lines Matching full:rng
33 #define to_mtk_rng(p) container_of(p, struct mtk_rng, rng)
38 struct hwrng rng; member
41 static int mtk_rng_init(struct hwrng *rng) in mtk_rng_init() argument
43 struct mtk_rng *priv = to_mtk_rng(rng); in mtk_rng_init()
58 static void mtk_rng_cleanup(struct hwrng *rng) in mtk_rng_cleanup() argument
60 struct mtk_rng *priv = to_mtk_rng(rng); in mtk_rng_cleanup()
70 static bool mtk_rng_wait_ready(struct hwrng *rng, bool wait) in mtk_rng_wait_ready() argument
72 struct mtk_rng *priv = to_mtk_rng(rng); in mtk_rng_wait_ready()
83 static int mtk_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait) in mtk_rng_read() argument
85 struct mtk_rng *priv = to_mtk_rng(rng); in mtk_rng_read()
88 pm_runtime_get_sync((struct device *)priv->rng.priv); in mtk_rng_read()
91 if (!mtk_rng_wait_ready(rng, wait)) in mtk_rng_read()
100 pm_runtime_mark_last_busy((struct device *)priv->rng.priv); in mtk_rng_read()
101 pm_runtime_put_sync_autosuspend((struct device *)priv->rng.priv); in mtk_rng_read()
115 priv->rng.name = pdev->name; in mtk_rng_probe()
117 priv->rng.init = mtk_rng_init; in mtk_rng_probe()
118 priv->rng.cleanup = mtk_rng_cleanup; in mtk_rng_probe()
120 priv->rng.read = mtk_rng_read; in mtk_rng_probe()
121 priv->rng.priv = (unsigned long)&pdev->dev; in mtk_rng_probe()
122 priv->rng.quality = 900; in mtk_rng_probe()
124 priv->clk = devm_clk_get(&pdev->dev, "rng"); in mtk_rng_probe()
135 ret = devm_hwrng_register(&pdev->dev, &priv->rng); in mtk_rng_probe()
137 dev_err(&pdev->dev, "failed to register rng device: %d\n", in mtk_rng_probe()
147 dev_info(&pdev->dev, "registered RNG driver\n"); in mtk_rng_probe()
157 mtk_rng_cleanup(&priv->rng); in mtk_rng_runtime_suspend()
166 return mtk_rng_init(&priv->rng); in mtk_rng_runtime_resume()
182 { .compatible = "mediatek,mt7986-rng" },
183 { .compatible = "mediatek,mt7623-rng" },