mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
msm_rng: Enable/ Disable Bus bandwidth for every RNG read call
This patch adds calls to enable and disable bus bandwidth for every RNG Read call. Change-Id: Ia1ac31ffa79a8be2761c243eee9bf87f25422c24 Signed-off-by: Dinesh K Garg <dineshg@codeaurora.org>
This commit is contained in:
parent
969302f5a7
commit
8df7aab686
1 changed files with 35 additions and 0 deletions
|
@ -120,6 +120,12 @@ int msm_rng_direct_read(struct msm_rng_device *msm_rng_dev, void *data)
|
||||||
pdev = msm_rng_dev->pdev;
|
pdev = msm_rng_dev->pdev;
|
||||||
base = msm_rng_dev->base;
|
base = msm_rng_dev->base;
|
||||||
|
|
||||||
|
if (msm_rng_dev->qrng_perf_client) {
|
||||||
|
ret = msm_bus_scale_client_update_request(
|
||||||
|
msm_rng_dev->qrng_perf_client, 1);
|
||||||
|
if (ret)
|
||||||
|
pr_err("bus_scale_client_update_req failed!\n");
|
||||||
|
}
|
||||||
/* enable PRNG clock */
|
/* enable PRNG clock */
|
||||||
ret = clk_prepare_enable(msm_rng_dev->prng_clk);
|
ret = clk_prepare_enable(msm_rng_dev->prng_clk);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@ -146,6 +152,13 @@ int msm_rng_direct_read(struct msm_rng_device *msm_rng_dev, void *data)
|
||||||
/* vote to turn off clock */
|
/* vote to turn off clock */
|
||||||
clk_disable_unprepare(msm_rng_dev->prng_clk);
|
clk_disable_unprepare(msm_rng_dev->prng_clk);
|
||||||
|
|
||||||
|
if (msm_rng_dev->qrng_perf_client) {
|
||||||
|
ret = msm_bus_scale_client_update_request(
|
||||||
|
msm_rng_dev->qrng_perf_client, 0);
|
||||||
|
if (ret)
|
||||||
|
pr_err("bus_scale_client_update_req failed!\n");
|
||||||
|
}
|
||||||
|
|
||||||
val = 0L;
|
val = 0L;
|
||||||
return currsize;
|
return currsize;
|
||||||
|
|
||||||
|
@ -185,6 +198,13 @@ static int msm_rng_drbg_read(struct hwrng *rng,
|
||||||
} else
|
} else
|
||||||
ret1 = 1;
|
ret1 = 1;
|
||||||
|
|
||||||
|
if (msm_rng_dev->qrng_perf_client) {
|
||||||
|
ret = msm_bus_scale_client_update_request(
|
||||||
|
msm_rng_dev->qrng_perf_client, 1);
|
||||||
|
if (ret)
|
||||||
|
pr_err("bus_scale_client_update_req failed!\n");
|
||||||
|
}
|
||||||
|
|
||||||
/* read random data from h/w */
|
/* read random data from h/w */
|
||||||
/* enable PRNG clock */
|
/* enable PRNG clock */
|
||||||
ret = clk_prepare_enable(msm_rng_dev->prng_clk);
|
ret = clk_prepare_enable(msm_rng_dev->prng_clk);
|
||||||
|
@ -216,6 +236,13 @@ static int msm_rng_drbg_read(struct hwrng *rng,
|
||||||
/* vote to turn off clock */
|
/* vote to turn off clock */
|
||||||
clk_disable_unprepare(msm_rng_dev->prng_clk);
|
clk_disable_unprepare(msm_rng_dev->prng_clk);
|
||||||
|
|
||||||
|
if (msm_rng_dev->qrng_perf_client) {
|
||||||
|
ret = msm_bus_scale_client_update_request(
|
||||||
|
msm_rng_dev->qrng_perf_client, 0);
|
||||||
|
if (ret)
|
||||||
|
pr_err("bus_scale_client_update_req failed!\n");
|
||||||
|
}
|
||||||
|
|
||||||
up(&msm_rng_dev->drbg_sem);
|
up(&msm_rng_dev->drbg_sem);
|
||||||
|
|
||||||
return currsize;
|
return currsize;
|
||||||
|
@ -370,6 +397,14 @@ static int __devinit msm_rng_enable_hw(struct msm_rng_device *msm_rng_dev)
|
||||||
mb();
|
mb();
|
||||||
}
|
}
|
||||||
clk_disable_unprepare(msm_rng_dev->prng_clk);
|
clk_disable_unprepare(msm_rng_dev->prng_clk);
|
||||||
|
|
||||||
|
if (msm_rng_dev->qrng_perf_client) {
|
||||||
|
ret = msm_bus_scale_client_update_request(
|
||||||
|
msm_rng_dev->qrng_perf_client, 0);
|
||||||
|
if (ret)
|
||||||
|
pr_err("bus_scale_client_update_req failed!\n");
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue