diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2013-05-16 03:44:13 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2013-06-17 07:00:55 -0400 |
commit | 5391e87d1259e45fbb153aad97fe21a41403b534 (patch) | |
tree | 0b0a144fade93e13d90bda00964b44dce48fc20f | |
parent | 94954fcb8030cd5545dcfc5b8c94fa224e20985d (diff) |
OMAPDSS: remove dispc's dependency to VENC/HDMI
DISPC needs to know the clock rate for DIGIT (i.e. TV) channel, and this
clock is provided by either VENC or HDMI modules. Currently DISPC will
call a function in VENC/HDMI, asking what the clock rate is. This means
we have a fixed dependency from DISPC to both VENC and HDMI.
To have a more generic approach, and in particular to allow adding OMAP5
HDMI driver, we need to remove this dependency. This patch makes
VENC/HDMI inform DISPC when the their clock changes, thus reversing the
dependency and removing the issue.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
-rw-r--r-- | drivers/video/omap2/dss/dispc.c | 20 | ||||
-rw-r--r-- | drivers/video/omap2/dss/dss.h | 19 | ||||
-rw-r--r-- | drivers/video/omap2/dss/hdmi.c | 8 | ||||
-rw-r--r-- | drivers/video/omap2/dss/venc.c | 8 |
4 files changed, 12 insertions, 43 deletions
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c index 83d7bb9da609..02a7340111df 100644 --- a/drivers/video/omap2/dss/dispc.c +++ b/drivers/video/omap2/dss/dispc.c | |||
@@ -103,6 +103,7 @@ static struct { | |||
103 | int irq; | 103 | int irq; |
104 | 104 | ||
105 | unsigned long core_clk_rate; | 105 | unsigned long core_clk_rate; |
106 | unsigned long tv_pclk_rate; | ||
106 | 107 | ||
107 | u32 fifo_size[DISPC_MAX_NR_FIFOS]; | 108 | u32 fifo_size[DISPC_MAX_NR_FIFOS]; |
108 | /* maps which plane is using a fifo. fifo-id -> plane-id */ | 109 | /* maps which plane is using a fifo. fifo-id -> plane-id */ |
@@ -3071,22 +3072,15 @@ unsigned long dispc_mgr_pclk_rate(enum omap_channel channel) | |||
3071 | 3072 | ||
3072 | return r / pcd; | 3073 | return r / pcd; |
3073 | } else { | 3074 | } else { |
3074 | enum dss_hdmi_venc_clk_source_select source; | 3075 | return dispc.tv_pclk_rate; |
3075 | |||
3076 | source = dss_get_hdmi_venc_clk_source(); | ||
3077 | |||
3078 | switch (source) { | ||
3079 | case DSS_VENC_TV_CLK: | ||
3080 | return venc_get_pixel_clock(); | ||
3081 | case DSS_HDMI_M_PCLK: | ||
3082 | return hdmi_get_pixel_clock(); | ||
3083 | default: | ||
3084 | BUG(); | ||
3085 | return 0; | ||
3086 | } | ||
3087 | } | 3076 | } |
3088 | } | 3077 | } |
3089 | 3078 | ||
3079 | void dispc_set_tv_pclk(unsigned long pclk) | ||
3080 | { | ||
3081 | dispc.tv_pclk_rate = pclk; | ||
3082 | } | ||
3083 | |||
3090 | unsigned long dispc_core_clk_rate(void) | 3084 | unsigned long dispc_core_clk_rate(void) |
3091 | { | 3085 | { |
3092 | return dispc.core_clk_rate; | 3086 | return dispc.core_clk_rate; |
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h index 67a509ea1fcb..ed70fa01d192 100644 --- a/drivers/video/omap2/dss/dss.h +++ b/drivers/video/omap2/dss/dss.h | |||
@@ -426,6 +426,7 @@ void dispc_mgr_set_clock_div(enum omap_channel channel, | |||
426 | const struct dispc_clock_info *cinfo); | 426 | const struct dispc_clock_info *cinfo); |
427 | int dispc_mgr_get_clock_div(enum omap_channel channel, | 427 | int dispc_mgr_get_clock_div(enum omap_channel channel, |
428 | struct dispc_clock_info *cinfo); | 428 | struct dispc_clock_info *cinfo); |
429 | void dispc_set_tv_pclk(unsigned long pclk); | ||
429 | 430 | ||
430 | u32 dispc_wb_get_framedone_irq(void); | 431 | u32 dispc_wb_get_framedone_irq(void); |
431 | bool dispc_wb_go_busy(void); | 432 | bool dispc_wb_go_busy(void); |
@@ -437,17 +438,8 @@ int dispc_wb_setup(const struct omap_dss_writeback_info *wi, | |||
437 | bool mem_to_mem, const struct omap_video_timings *timings); | 438 | bool mem_to_mem, const struct omap_video_timings *timings); |
438 | 439 | ||
439 | /* VENC */ | 440 | /* VENC */ |
440 | #ifdef CONFIG_OMAP2_DSS_VENC | ||
441 | int venc_init_platform_driver(void) __init; | 441 | int venc_init_platform_driver(void) __init; |
442 | void venc_uninit_platform_driver(void) __exit; | 442 | void venc_uninit_platform_driver(void) __exit; |
443 | unsigned long venc_get_pixel_clock(void); | ||
444 | #else | ||
445 | static inline unsigned long venc_get_pixel_clock(void) | ||
446 | { | ||
447 | WARN("%s: VENC not compiled in, returning pclk as 0\n", __func__); | ||
448 | return 0; | ||
449 | } | ||
450 | #endif | ||
451 | int omapdss_venc_display_enable(struct omap_dss_device *dssdev); | 443 | int omapdss_venc_display_enable(struct omap_dss_device *dssdev); |
452 | void omapdss_venc_display_disable(struct omap_dss_device *dssdev); | 444 | void omapdss_venc_display_disable(struct omap_dss_device *dssdev); |
453 | void omapdss_venc_set_timings(struct omap_dss_device *dssdev, | 445 | void omapdss_venc_set_timings(struct omap_dss_device *dssdev, |
@@ -464,17 +456,8 @@ int venc_panel_init(void); | |||
464 | void venc_panel_exit(void); | 456 | void venc_panel_exit(void); |
465 | 457 | ||
466 | /* HDMI */ | 458 | /* HDMI */ |
467 | #ifdef CONFIG_OMAP4_DSS_HDMI | ||
468 | int hdmi_init_platform_driver(void) __init; | 459 | int hdmi_init_platform_driver(void) __init; |
469 | void hdmi_uninit_platform_driver(void) __exit; | 460 | void hdmi_uninit_platform_driver(void) __exit; |
470 | unsigned long hdmi_get_pixel_clock(void); | ||
471 | #else | ||
472 | static inline unsigned long hdmi_get_pixel_clock(void) | ||
473 | { | ||
474 | WARN("%s: HDMI not compiled in, returning pclk as 0\n", __func__); | ||
475 | return 0; | ||
476 | } | ||
477 | #endif | ||
478 | int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev); | 461 | int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev); |
479 | void omapdss_hdmi_display_disable(struct omap_dss_device *dssdev); | 462 | void omapdss_hdmi_display_disable(struct omap_dss_device *dssdev); |
480 | int omapdss_hdmi_core_enable(struct omap_dss_device *dssdev); | 463 | int omapdss_hdmi_core_enable(struct omap_dss_device *dssdev); |
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c index 3038eef99baf..e1c0992b522b 100644 --- a/drivers/video/omap2/dss/hdmi.c +++ b/drivers/video/omap2/dss/hdmi.c | |||
@@ -465,12 +465,6 @@ end: return cm; | |||
465 | 465 | ||
466 | } | 466 | } |
467 | 467 | ||
468 | unsigned long hdmi_get_pixel_clock(void) | ||
469 | { | ||
470 | /* HDMI Pixel Clock in Mhz */ | ||
471 | return hdmi.ip_data.cfg.timings.pixel_clock * 1000; | ||
472 | } | ||
473 | |||
474 | static void hdmi_compute_pll(struct omap_dss_device *dssdev, int phy, | 468 | static void hdmi_compute_pll(struct omap_dss_device *dssdev, int phy, |
475 | struct hdmi_pll_info *pi) | 469 | struct hdmi_pll_info *pi) |
476 | { | 470 | { |
@@ -663,6 +657,8 @@ void omapdss_hdmi_display_set_timing(struct omap_dss_device *dssdev, | |||
663 | if (t != NULL) | 657 | if (t != NULL) |
664 | hdmi.ip_data.cfg = *t; | 658 | hdmi.ip_data.cfg = *t; |
665 | 659 | ||
660 | dispc_set_tv_pclk(t->timings.pixel_clock * 1000); | ||
661 | |||
666 | mutex_unlock(&hdmi.lock); | 662 | mutex_unlock(&hdmi.lock); |
667 | } | 663 | } |
668 | 664 | ||
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c index 4a8a214067ab..8720f137d4f8 100644 --- a/drivers/video/omap2/dss/venc.c +++ b/drivers/video/omap2/dss/venc.c | |||
@@ -492,12 +492,6 @@ static void venc_power_off(struct omap_dss_device *dssdev) | |||
492 | venc_runtime_put(); | 492 | venc_runtime_put(); |
493 | } | 493 | } |
494 | 494 | ||
495 | unsigned long venc_get_pixel_clock(void) | ||
496 | { | ||
497 | /* VENC Pixel Clock in Mhz */ | ||
498 | return 13500000; | ||
499 | } | ||
500 | |||
501 | int omapdss_venc_display_enable(struct omap_dss_device *dssdev) | 495 | int omapdss_venc_display_enable(struct omap_dss_device *dssdev) |
502 | { | 496 | { |
503 | struct omap_dss_device *out = &venc.output; | 497 | struct omap_dss_device *out = &venc.output; |
@@ -551,6 +545,8 @@ void omapdss_venc_set_timings(struct omap_dss_device *dssdev, | |||
551 | 545 | ||
552 | venc.timings = *timings; | 546 | venc.timings = *timings; |
553 | 547 | ||
548 | dispc_set_tv_pclk(13500000); | ||
549 | |||
554 | mutex_unlock(&venc.venc_lock); | 550 | mutex_unlock(&venc.venc_lock); |
555 | } | 551 | } |
556 | 552 | ||