Skip to content

Commit 7cb6270

Browse files
harshaldev27arakshit011
authored andcommitted
FROMLIST: soc: qcom: ice: Add explicit power-domain and clock voting calls for ICE
Since Qualcomm inline-crypto engine (ICE) is now a dedicated driver de-coupled from the QCOM UFS driver, it should explicitly vote for it's needed resources during probe, specifically the UFS_PHY_GDSC power-domain and the 'core' and 'iface' clocks. Also updated the suspend and resume callbacks to handle votes on these resources. Link: https://lore.kernel.org/all/20260123-qcom_ice_power_and_clk_vote-v1-11-e9059776f85c@qti.qualcomm.com/ Signed-off-by: Harshal Dev <harshal.dev@oss.qualcomm.com> Signed-off-by: Abhinaba Rakshit <abhinaba.rakshit@oss.qualcomm.com>
1 parent 646184a commit 7cb6270

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

drivers/soc/qcom/ice.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#include <linux/of.h>
1717
#include <linux/of_platform.h>
1818
#include <linux/platform_device.h>
19+
#include <linux/pm.h>
20+
#include <linux/pm_runtime.h>
1921

2022
#include <linux/firmware/qcom/qcom_scm.h>
2123

@@ -108,6 +110,7 @@ struct qcom_ice {
108110
void __iomem *base;
109111

110112
struct clk *core_clk;
113+
struct clk *iface_clk;
111114
bool use_hwkm;
112115
bool hwkm_init_complete;
113116
u8 hwkm_version;
@@ -310,20 +313,30 @@ int qcom_ice_resume(struct qcom_ice *ice)
310313
struct device *dev = ice->dev;
311314
int err;
312315

316+
pm_runtime_get_sync(dev);
313317
err = clk_prepare_enable(ice->core_clk);
314318
if (err) {
315319
dev_err(dev, "failed to enable core clock (%d)\n",
316320
err);
317321
return err;
318322
}
323+
324+
err = clk_prepare_enable(ice->iface_clk);
325+
if (err) {
326+
dev_err(dev, "failed to enable iface clock (%d)\n",
327+
err);
328+
return err;
329+
}
319330
qcom_ice_hwkm_init(ice);
320331
return qcom_ice_wait_bist_status(ice);
321332
}
322333
EXPORT_SYMBOL_GPL(qcom_ice_resume);
323334

324335
int qcom_ice_suspend(struct qcom_ice *ice)
325336
{
337+
clk_disable_unprepare(ice->iface_clk);
326338
clk_disable_unprepare(ice->core_clk);
339+
pm_runtime_put_sync(ice->dev);
327340
ice->hwkm_init_complete = false;
328341

329342
return 0;
@@ -584,6 +597,10 @@ static struct qcom_ice *qcom_ice_create(struct device *dev,
584597
if (IS_ERR(engine->core_clk))
585598
return ERR_CAST(engine->core_clk);
586599

600+
engine->iface_clk = devm_clk_get_enabled(dev, "iface_clk");
601+
if (IS_ERR(engine->iface_clk))
602+
return ERR_CAST(engine->iface_clk);
603+
587604
if (!qcom_ice_check_supported(engine))
588605
return ERR_PTR(-EOPNOTSUPP);
589606

@@ -725,6 +742,9 @@ static int qcom_ice_probe(struct platform_device *pdev)
725742
return PTR_ERR(base);
726743
}
727744

745+
devm_pm_runtime_enable(&pdev->dev);
746+
pm_runtime_get_sync(&pdev->dev);
747+
728748
engine = qcom_ice_create(&pdev->dev, base);
729749
if (IS_ERR(engine))
730750
return PTR_ERR(engine);

0 commit comments

Comments
 (0)