From 19b3bd28b3e277d8892f663e7c61a813dbc54feb Mon Sep 17 00:00:00 2001 From: Seshendra Gadagottu Date: Fri, 16 Oct 2015 12:31:35 -0700 Subject: gpu: nvgpu: use platform data for ptimer source rate Instead of depending on clock frame-work, use platform data for ptimer source rate. Removed ptimerscaling10x platform data, and use ptimer source frequency to calculate ptimerscaling factor. Reviewed-on: http://git-master/r/819030 (cherry picked from commit dd291334d54dab80cab7eb1656dffc48a59610b4) Change-Id: I7638ce9875a6e440bbfc2ba2da0d0b094b2700ff Signed-off-by: Seshendra Gadagottu Reviewed-on: http://git-master/r/827300 GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/gk20a.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'drivers/gpu/nvgpu/gk20a/gk20a.h') diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index e106c479..58c8e9ad 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h @@ -50,6 +50,10 @@ struct acr_gm20b; #include "cde_gk20a.h" #include "debug_gk20a.h" +/* PTIMER_REF_FREQ_HZ corresponds to a period of 32 nanoseconds. + 32 ns is the resolution of ptimer. */ +#define PTIMER_REF_FREQ_HZ 31250000 + struct cooling_device_gk20a { struct thermal_cooling_device *gk20a_cooling_dev; unsigned int gk20a_freq_state; @@ -901,6 +905,10 @@ void gk20a_user_deinit(struct platform_device *dev); extern void gk20a_debug_dump_device(struct platform_device *pdev); +static inline u32 ptimer_scalingfactor10x(u32 ptimer_src_freq) +{ + return (u32)(((u64)(PTIMER_REF_FREQ_HZ * 10)) / ptimer_src_freq); +} static inline u32 scale_ptimer(u32 timeout , u32 scale10x) { if (((timeout*10) % scale10x) >= (scale10x/2)) -- cgit v1.2.2