summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/clk/clk_mclk.c
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2017-01-24 08:30:42 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2017-02-22 07:15:02 -0500
commit8ee3aa4b3175d8d27e57a0f5d5e2cdf3d78a4a58 (patch)
tree505dfd2ea2aca2f1cbdb254baee980862d21e04d /drivers/gpu/nvgpu/clk/clk_mclk.c
parent1f855af63fdd31fe3dcfee75f4f5f9b62f30d87e (diff)
gpu: nvgpu: use common nvgpu mutex/spinlock APIs
Instead of using Linux APIs for mutex and spinlocks directly, use new APIs defined in <nvgpu/lock.h> Replace Linux specific mutex/spinlock declaration, init, lock, unlock APIs with new APIs e.g struct mutex is replaced by struct nvgpu_mutex and mutex_lock() is replaced by nvgpu_mutex_acquire() And also include <nvgpu/lock.h> instead of including <linux/mutex.h> and <linux/spinlock.h> Add explicit nvgpu/lock.h includes to below files to fix complilation failures. gk20a/platform_gk20a.h include/nvgpu/allocator.h Jira NVGPU-13 Change-Id: I81a05d21ecdbd90c2076a9f0aefd0e40b215bd33 Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: http://git-master/r/1293187 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/clk/clk_mclk.c')
-rw-r--r--drivers/gpu/nvgpu/clk/clk_mclk.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/gpu/nvgpu/clk/clk_mclk.c b/drivers/gpu/nvgpu/clk/clk_mclk.c
index 815f55ba..c2e9b35c 100644
--- a/drivers/gpu/nvgpu/clk/clk_mclk.c
+++ b/drivers/gpu/nvgpu/clk/clk_mclk.c
@@ -2185,8 +2185,8 @@ int clk_mclkseq_init_mclk_gddr5(struct gk20a *g)
2185 2185
2186 mclk = &g->clk_pmu.clk_mclk; 2186 mclk = &g->clk_pmu.clk_mclk;
2187 2187
2188 mutex_init(&mclk->mclk_lock); 2188 nvgpu_mutex_init(&mclk->mclk_lock);
2189 mutex_init(&mclk->data_lock); 2189 nvgpu_mutex_init(&mclk->data_lock);
2190 2190
2191 /* FBPA gain WAR */ 2191 /* FBPA gain WAR */
2192 gk20a_writel(g, fb_fbpa_fbio_iref_byte_rx_ctrl_r(), 0x22222222); 2192 gk20a_writel(g, fb_fbpa_fbio_iref_byte_rx_ctrl_r(), 0x22222222);
@@ -2257,7 +2257,7 @@ int clk_mclkseq_change_mclk_gddr5(struct gk20a *g, u16 val)
2257 2257
2258 mclk = &g->clk_pmu.clk_mclk; 2258 mclk = &g->clk_pmu.clk_mclk;
2259 2259
2260 mutex_lock(&mclk->mclk_lock); 2260 nvgpu_mutex_acquire(&mclk->mclk_lock);
2261 2261
2262 if (!mclk->init) 2262 if (!mclk->init)
2263 goto exit_status; 2263 goto exit_status;
@@ -2364,7 +2364,7 @@ int clk_mclkseq_change_mclk_gddr5(struct gk20a *g, u16 val)
2364#ifdef CONFIG_DEBUG_FS 2364#ifdef CONFIG_DEBUG_FS
2365 g->ops.read_ptimer(g, &t1); 2365 g->ops.read_ptimer(g, &t1);
2366 2366
2367 mutex_lock(&mclk->data_lock); 2367 nvgpu_mutex_acquire(&mclk->data_lock);
2368 mclk->switch_num++; 2368 mclk->switch_num++;
2369 2369
2370 if (mclk->switch_num == 1) { 2370 if (mclk->switch_num == 1) {
@@ -2387,11 +2387,11 @@ int clk_mclkseq_change_mclk_gddr5(struct gk20a *g, u16 val)
2387 mclk->switch_std += 2387 mclk->switch_std +=
2388 (curr - mclk->switch_avg) * (curr - prev_avg); 2388 (curr - mclk->switch_avg) * (curr - prev_avg);
2389 } 2389 }
2390 mutex_unlock(&mclk->data_lock); 2390 nvgpu_mutex_release(&mclk->data_lock);
2391#endif 2391#endif
2392exit_status: 2392exit_status:
2393 2393
2394 mutex_unlock(&mclk->mclk_lock); 2394 nvgpu_mutex_release(&mclk->mclk_lock);
2395 return status; 2395 return status;
2396} 2396}
2397 2397
@@ -2429,13 +2429,13 @@ static int mclk_switch_stats_show(struct seq_file *s, void *unused)
2429 mclk = &g->clk_pmu.clk_mclk; 2429 mclk = &g->clk_pmu.clk_mclk;
2430 2430
2431 /* Make copy of structure to reduce time with lock held */ 2431 /* Make copy of structure to reduce time with lock held */
2432 mutex_lock(&mclk->data_lock); 2432 nvgpu_mutex_acquire(&mclk->data_lock);
2433 std = mclk->switch_std; 2433 std = mclk->switch_std;
2434 avg = mclk->switch_avg; 2434 avg = mclk->switch_avg;
2435 max = mclk->switch_max; 2435 max = mclk->switch_max;
2436 min = mclk->switch_min; 2436 min = mclk->switch_min;
2437 num = mclk->switch_num; 2437 num = mclk->switch_num;
2438 mutex_unlock(&mclk->data_lock); 2438 nvgpu_mutex_release(&mclk->data_lock);
2439 2439
2440 tmp = std; 2440 tmp = std;
2441 do_div(tmp, num); 2441 do_div(tmp, num);