aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2012-08-22 09:56:57 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2012-09-07 13:02:13 -0400
commit42a6961cf6d23632b8b5c64bd8711aef33e89518 (patch)
treec39757da18e882669b960fb57832caee74cb0291 /drivers/video
parent85099f11bd0360a0327edb1f61aeea89764677bf (diff)
OMAPDSS: Improve fifo management code
OMAP4+ allows assigning the overlay FIFOs freely, but that is not supported by omapdss yet. This patch takes a step forward by improving the fifo management to be more flexible. dispc.c is changed to keep track of the sizes of each fifo, and also the overlay using each fifo. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/omap2/dss/dispc.c39
1 files changed, 31 insertions, 8 deletions
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index e934abb08dcf..dc0f372c6b22 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -94,8 +94,11 @@ struct dispc_features {
94 u16 pos_x, unsigned long *core_clk); 94 u16 pos_x, unsigned long *core_clk);
95 unsigned long (*calc_core_clk) (enum omap_channel channel, 95 unsigned long (*calc_core_clk) (enum omap_channel channel,
96 u16 width, u16 height, u16 out_width, u16 out_height); 96 u16 width, u16 height, u16 out_width, u16 out_height);
97 u8 num_fifos;
97}; 98};
98 99
100#define DISPC_MAX_NR_FIFOS 5
101
99static struct { 102static struct {
100 struct platform_device *pdev; 103 struct platform_device *pdev;
101 void __iomem *base; 104 void __iomem *base;
@@ -105,7 +108,9 @@ static struct {
105 int irq; 108 int irq;
106 struct clk *dss_clk; 109 struct clk *dss_clk;
107 110
108 u32 fifo_size[MAX_DSS_OVERLAYS]; 111 u32 fifo_size[DISPC_MAX_NR_FIFOS];
112 /* maps which plane is using a fifo. fifo-id -> plane-id */
113 int fifo_assignment[DISPC_MAX_NR_FIFOS];
109 114
110 spinlock_t irq_lock; 115 spinlock_t irq_lock;
111 u32 irq_error_mask; 116 u32 irq_error_mask;
@@ -1061,10 +1066,10 @@ static void dispc_mgr_set_size(enum omap_channel channel, u16 width,
1061 dispc_write_reg(DISPC_SIZE_MGR(channel), val); 1066 dispc_write_reg(DISPC_SIZE_MGR(channel), val);
1062} 1067}
1063 1068
1064static void dispc_read_plane_fifo_sizes(void) 1069static void dispc_init_fifos(void)
1065{ 1070{
1066 u32 size; 1071 u32 size;
1067 int plane; 1072 int fifo;
1068 u8 start, end; 1073 u8 start, end;
1069 u32 unit; 1074 u32 unit;
1070 1075
@@ -1072,16 +1077,30 @@ static void dispc_read_plane_fifo_sizes(void)
1072 1077
1073 dss_feat_get_reg_field(FEAT_REG_FIFOSIZE, &start, &end); 1078 dss_feat_get_reg_field(FEAT_REG_FIFOSIZE, &start, &end);
1074 1079
1075 for (plane = 0; plane < dss_feat_get_num_ovls(); ++plane) { 1080 for (fifo = 0; fifo < dispc.feat->num_fifos; ++fifo) {
1076 size = REG_GET(DISPC_OVL_FIFO_SIZE_STATUS(plane), start, end); 1081 size = REG_GET(DISPC_OVL_FIFO_SIZE_STATUS(fifo), start, end);
1077 size *= unit; 1082 size *= unit;
1078 dispc.fifo_size[plane] = size; 1083 dispc.fifo_size[fifo] = size;
1084
1085 /*
1086 * By default fifos are mapped directly to overlays, fifo 0 to
1087 * ovl 0, fifo 1 to ovl 1, etc.
1088 */
1089 dispc.fifo_assignment[fifo] = fifo;
1079 } 1090 }
1080} 1091}
1081 1092
1082static u32 dispc_ovl_get_fifo_size(enum omap_plane plane) 1093static u32 dispc_ovl_get_fifo_size(enum omap_plane plane)
1083{ 1094{
1084 return dispc.fifo_size[plane]; 1095 int fifo;
1096 u32 size = 0;
1097
1098 for (fifo = 0; fifo < dispc.feat->num_fifos; ++fifo) {
1099 if (dispc.fifo_assignment[fifo] == plane)
1100 size += dispc.fifo_size[fifo];
1101 }
1102
1103 return size;
1085} 1104}
1086 1105
1087void dispc_ovl_set_fifo_threshold(enum omap_plane plane, u32 low, u32 high) 1106void dispc_ovl_set_fifo_threshold(enum omap_plane plane, u32 low, u32 high)
@@ -3708,7 +3727,7 @@ static void _omap_dispc_initial_config(void)
3708 3727
3709 dispc_set_loadmode(OMAP_DSS_LOAD_FRAME_ONLY); 3728 dispc_set_loadmode(OMAP_DSS_LOAD_FRAME_ONLY);
3710 3729
3711 dispc_read_plane_fifo_sizes(); 3730 dispc_init_fifos();
3712 3731
3713 dispc_configure_burst_sizes(); 3732 dispc_configure_burst_sizes();
3714 3733
@@ -3724,6 +3743,7 @@ static const struct dispc_features omap24xx_dispc_feats __initconst = {
3724 .hp_max = 256, 3743 .hp_max = 256,
3725 .calc_scaling = dispc_ovl_calc_scaling_24xx, 3744 .calc_scaling = dispc_ovl_calc_scaling_24xx,
3726 .calc_core_clk = calc_core_clk_24xx, 3745 .calc_core_clk = calc_core_clk_24xx,
3746 .num_fifos = 3,
3727}; 3747};
3728 3748
3729static const struct dispc_features omap34xx_rev1_0_dispc_feats __initconst = { 3749static const struct dispc_features omap34xx_rev1_0_dispc_feats __initconst = {
@@ -3735,6 +3755,7 @@ static const struct dispc_features omap34xx_rev1_0_dispc_feats __initconst = {
3735 .hp_max = 256, 3755 .hp_max = 256,
3736 .calc_scaling = dispc_ovl_calc_scaling_34xx, 3756 .calc_scaling = dispc_ovl_calc_scaling_34xx,
3737 .calc_core_clk = calc_core_clk_34xx, 3757 .calc_core_clk = calc_core_clk_34xx,
3758 .num_fifos = 3,
3738}; 3759};
3739 3760
3740static const struct dispc_features omap34xx_rev3_0_dispc_feats __initconst = { 3761static const struct dispc_features omap34xx_rev3_0_dispc_feats __initconst = {
@@ -3746,6 +3767,7 @@ static const struct dispc_features omap34xx_rev3_0_dispc_feats __initconst = {
3746 .hp_max = 4096, 3767 .hp_max = 4096,
3747 .calc_scaling = dispc_ovl_calc_scaling_34xx, 3768 .calc_scaling = dispc_ovl_calc_scaling_34xx,
3748 .calc_core_clk = calc_core_clk_34xx, 3769 .calc_core_clk = calc_core_clk_34xx,
3770 .num_fifos = 3,
3749}; 3771};
3750 3772
3751static const struct dispc_features omap44xx_dispc_feats __initconst = { 3773static const struct dispc_features omap44xx_dispc_feats __initconst = {
@@ -3757,6 +3779,7 @@ static const struct dispc_features omap44xx_dispc_feats __initconst = {
3757 .hp_max = 4096, 3779 .hp_max = 4096,
3758 .calc_scaling = dispc_ovl_calc_scaling_44xx, 3780 .calc_scaling = dispc_ovl_calc_scaling_44xx,
3759 .calc_core_clk = calc_core_clk_44xx, 3781 .calc_core_clk = calc_core_clk_44xx,
3782 .num_fifos = 5,
3760}; 3783};
3761 3784
3762static int __init dispc_init_features(struct device *dev) 3785static int __init dispc_init_features(struct device *dev)