diff options
author | Taneja, Archit <archit@ti.com> | 2011-03-08 06:50:34 -0500 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2011-03-11 08:46:30 -0500 |
commit | 66534e8e936a0b926863df90054dc59826d70528 (patch) | |
tree | b00e7998a08b47a7b1250086194e9bf95367dfa5 /drivers/video/omap2 | |
parent | 7b12d7b66bac4ff51aeea0029734b7a921cbe817 (diff) |
OMAP2PLUS: DSS2: Cleanup clock source related code
Clean up some of the DSS functions which select/get clock sources, use switch
to select the clock source members since more clock sources will be introduced
later on.
Remove the use of macro CONFIG_OMAP2_DSS_DSI in dispc_fclk_rate, use a dummy
inline for function for dsi_get_pll_hsdiv_dispc_rate() instead for code clarity.
Signed-off-by: Archit Taneja <archit@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video/omap2')
-rw-r--r-- | drivers/video/omap2/dss/dispc.c | 15 | ||||
-rw-r--r-- | drivers/video/omap2/dss/dss.c | 32 | ||||
-rw-r--r-- | drivers/video/omap2/dss/dss.h | 5 |
3 files changed, 34 insertions, 18 deletions
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c index 4a368c47700e..28b690f2447f 100644 --- a/drivers/video/omap2/dss/dispc.c +++ b/drivers/video/omap2/dss/dispc.c | |||
@@ -2341,14 +2341,17 @@ unsigned long dispc_fclk_rate(void) | |||
2341 | { | 2341 | { |
2342 | unsigned long r = 0; | 2342 | unsigned long r = 0; |
2343 | 2343 | ||
2344 | if (dss_get_dispc_clk_source() == DSS_CLK_SRC_FCK) | 2344 | switch (dss_get_dispc_clk_source()) { |
2345 | case DSS_CLK_SRC_FCK: | ||
2345 | r = dss_clk_get_rate(DSS_CLK_FCK); | 2346 | r = dss_clk_get_rate(DSS_CLK_FCK); |
2346 | else | 2347 | break; |
2347 | #ifdef CONFIG_OMAP2_DSS_DSI | 2348 | case DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC: |
2348 | r = dsi_get_pll_hsdiv_dispc_rate(); | 2349 | r = dsi_get_pll_hsdiv_dispc_rate(); |
2349 | #else | 2350 | break; |
2350 | BUG(); | 2351 | default: |
2351 | #endif | 2352 | BUG(); |
2353 | } | ||
2354 | |||
2352 | return r; | 2355 | return r; |
2353 | } | 2356 | } |
2354 | 2357 | ||
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c index 2be4d03ece43..93813fd626be 100644 --- a/drivers/video/omap2/dss/dss.c +++ b/drivers/video/omap2/dss/dss.c | |||
@@ -293,13 +293,17 @@ void dss_select_dispc_clk_source(enum dss_clk_source clk_src) | |||
293 | { | 293 | { |
294 | int b; | 294 | int b; |
295 | 295 | ||
296 | BUG_ON(clk_src != DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC && | 296 | switch (clk_src) { |
297 | clk_src != DSS_CLK_SRC_FCK); | 297 | case DSS_CLK_SRC_FCK: |
298 | 298 | b = 0; | |
299 | b = clk_src == DSS_CLK_SRC_FCK ? 0 : 1; | 299 | break; |
300 | 300 | case DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC: | |
301 | if (clk_src == DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC) | 301 | b = 1; |
302 | dsi_wait_pll_hsdiv_dispc_active(); | 302 | dsi_wait_pll_hsdiv_dispc_active(); |
303 | break; | ||
304 | default: | ||
305 | BUG(); | ||
306 | } | ||
303 | 307 | ||
304 | REG_FLD_MOD(DSS_CONTROL, b, 0, 0); /* DISPC_CLK_SWITCH */ | 308 | REG_FLD_MOD(DSS_CONTROL, b, 0, 0); /* DISPC_CLK_SWITCH */ |
305 | 309 | ||
@@ -310,13 +314,17 @@ void dss_select_dsi_clk_source(enum dss_clk_source clk_src) | |||
310 | { | 314 | { |
311 | int b; | 315 | int b; |
312 | 316 | ||
313 | BUG_ON(clk_src != DSS_CLK_SRC_DSI_PLL_HSDIV_DSI && | 317 | switch (clk_src) { |
314 | clk_src != DSS_CLK_SRC_FCK); | 318 | case DSS_CLK_SRC_FCK: |
315 | 319 | b = 0; | |
316 | b = clk_src == DSS_CLK_SRC_FCK ? 0 : 1; | 320 | break; |
317 | 321 | case DSS_CLK_SRC_DSI_PLL_HSDIV_DSI: | |
318 | if (clk_src == DSS_CLK_SRC_DSI_PLL_HSDIV_DSI) | 322 | b = 1; |
319 | dsi_wait_pll_hsdiv_dsi_active(); | 323 | dsi_wait_pll_hsdiv_dsi_active(); |
324 | break; | ||
325 | default: | ||
326 | BUG(); | ||
327 | } | ||
320 | 328 | ||
321 | REG_FLD_MOD(DSS_CONTROL, b, 1, 1); /* DSI_CLK_SWITCH */ | 329 | REG_FLD_MOD(DSS_CONTROL, b, 1, 1); /* DSI_CLK_SWITCH */ |
322 | 330 | ||
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h index 85d4141689c1..fc41b3f0c27e 100644 --- a/drivers/video/omap2/dss/dss.h +++ b/drivers/video/omap2/dss/dss.h | |||
@@ -299,6 +299,11 @@ static inline int dsi_init_platform_driver(void) | |||
299 | static inline void dsi_uninit_platform_driver(void) | 299 | static inline void dsi_uninit_platform_driver(void) |
300 | { | 300 | { |
301 | } | 301 | } |
302 | static inline unsigned long dsi_get_pll_hsdiv_dispc_rate(void) | ||
303 | { | ||
304 | WARN("%s: DSI not compiled in, returning rate as 0\n", __func__); | ||
305 | return 0; | ||
306 | } | ||
302 | static inline void dsi_wait_pll_hsdiv_dispc_active(void) | 307 | static inline void dsi_wait_pll_hsdiv_dispc_active(void) |
303 | { | 308 | { |
304 | } | 309 | } |