aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/omap2/dss/dispc.c
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2011-06-21 02:35:36 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2011-07-01 05:07:14 -0400
commit5ed8cf5b8e053832a3d0552e0a9681a3ff0325ee (patch)
tree7b344de5b36f8720cc03a762c28931b6126b212f /drivers/video/omap2/dss/dispc.c
parent15ffa1dac53820bb712851d329ba465f74b00f76 (diff)
OMAP: DSS2: Fix FIFO threshold and burst size for OMAP4
The DMA FIFO threshold registers and burst size registers have changed for OMAP4. The current code only handles OMAP2/3 case, and so the values are a bit off for OMAP4. A summary of the differences between OMAP2/3 and OMAP4: Burst size: OMAP2/3: 4 x 32 bits / 8 x 32 bits / 16 x 32 bits OMAP4: 2 x 128 bits / 4 x 128 bits / 8 x 128 bits Threshold size: OMAP2/3: in bytes (8 bit units) OMAP4: in 128bit units This patch fixes the issue by creating two new helper functions in dss_features: dss_feat_get_buffer_size_unit() and dss_feat_get_burst_size_unit(). These return (in bytes) the unit size for threshold registers and unit size for burst size register, respectively, and are used to calculate correct values. For the threshold size the usage is straightforward. However, the burst size register has different multipliers for OMAP2/3 and OMAP4. This patch solves the problem by defining the multipliers for the burst size as 2x, 4x and 8x, which fit fine for the OMAP4 burst size definition (i.e. burst size unit for OMAP4 is 128bits), but requires a slight twist on OMAP2/3 by defining the burst size unit as 64bit. As the driver in practice always uses the maximum burst size, and no use case currently exists where we would want to use a smaller burst size, this patch changes the driver to hardcode the burst size when initializing DISPC. This makes the threshold configuration code somewhat simpler. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video/omap2/dss/dispc.c')
-rw-r--r--drivers/video/omap2/dss/dispc.c50
1 files changed, 42 insertions, 8 deletions
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 1abed77e989..ba1ccf709e1 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -78,6 +78,12 @@ struct dispc_v_coef {
78 s8 vc00; 78 s8 vc00;
79}; 79};
80 80
81enum omap_burst_size {
82 BURST_SIZE_X2 = 0,
83 BURST_SIZE_X4 = 1,
84 BURST_SIZE_X8 = 2,
85};
86
81#define REG_GET(idx, start, end) \ 87#define REG_GET(idx, start, end) \
82 FLD_GET(dispc_read_reg(idx), start, end) 88 FLD_GET(dispc_read_reg(idx), start, end)
83 89
@@ -992,11 +998,10 @@ static void _dispc_set_channel_out(enum omap_plane plane,
992 dispc_write_reg(DISPC_OVL_ATTRIBUTES(plane), val); 998 dispc_write_reg(DISPC_OVL_ATTRIBUTES(plane), val);
993} 999}
994 1000
995void dispc_set_burst_size(enum omap_plane plane, 1001static void dispc_set_burst_size(enum omap_plane plane,
996 enum omap_burst_size burst_size) 1002 enum omap_burst_size burst_size)
997{ 1003{
998 int shift; 1004 int shift;
999 u32 val;
1000 1005
1001 enable_clocks(1); 1006 enable_clocks(1);
1002 1007
@@ -1013,13 +1018,28 @@ void dispc_set_burst_size(enum omap_plane plane,
1013 return; 1018 return;
1014 } 1019 }
1015 1020
1016 val = dispc_read_reg(DISPC_OVL_ATTRIBUTES(plane)); 1021 REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), burst_size, shift + 1, shift);
1017 val = FLD_MOD(val, burst_size, shift+1, shift);
1018 dispc_write_reg(DISPC_OVL_ATTRIBUTES(plane), val);
1019 1022
1020 enable_clocks(0); 1023 enable_clocks(0);
1021} 1024}
1022 1025
1026static void dispc_configure_burst_sizes(void)
1027{
1028 int i;
1029 const int burst_size = BURST_SIZE_X8;
1030
1031 /* Configure burst size always to maximum size */
1032 for (i = 0; i < omap_dss_get_num_overlays(); ++i)
1033 dispc_set_burst_size(i, burst_size);
1034}
1035
1036u32 dispc_get_burst_size(enum omap_plane plane)
1037{
1038 unsigned unit = dss_feat_get_burst_size_unit();
1039 /* burst multiplier is always x8 (see dispc_configure_burst_sizes()) */
1040 return unit * 8;
1041}
1042
1023void dispc_enable_gamma_table(bool enable) 1043void dispc_enable_gamma_table(bool enable)
1024{ 1044{
1025 /* 1045 /*
@@ -1118,14 +1138,17 @@ static void dispc_read_plane_fifo_sizes(void)
1118 u32 size; 1138 u32 size;
1119 int plane; 1139 int plane;
1120 u8 start, end; 1140 u8 start, end;
1141 u32 unit;
1142
1143 unit = dss_feat_get_buffer_size_unit();
1121 1144
1122 enable_clocks(1); 1145 enable_clocks(1);
1123 1146
1124 dss_feat_get_reg_field(FEAT_REG_FIFOSIZE, &start, &end); 1147 dss_feat_get_reg_field(FEAT_REG_FIFOSIZE, &start, &end);
1125 1148
1126 for (plane = 0; plane < ARRAY_SIZE(dispc.fifo_size); ++plane) { 1149 for (plane = 0; plane < ARRAY_SIZE(dispc.fifo_size); ++plane) {
1127 size = FLD_GET(dispc_read_reg(DISPC_OVL_FIFO_SIZE_STATUS(plane)), 1150 size = REG_GET(DISPC_OVL_FIFO_SIZE_STATUS(plane), start, end);
1128 start, end); 1151 size *= unit;
1129 dispc.fifo_size[plane] = size; 1152 dispc.fifo_size[plane] = size;
1130 } 1153 }
1131 1154
@@ -1137,9 +1160,18 @@ u32 dispc_get_plane_fifo_size(enum omap_plane plane)
1137 return dispc.fifo_size[plane]; 1160 return dispc.fifo_size[plane];
1138} 1161}
1139 1162
1140void dispc_setup_plane_fifo(enum omap_plane plane, u32 low, u32 high) 1163void dispc_set_fifo_threshold(enum omap_plane plane, u32 low, u32 high)
1141{ 1164{
1142 u8 hi_start, hi_end, lo_start, lo_end; 1165 u8 hi_start, hi_end, lo_start, lo_end;
1166 u32 unit;
1167
1168 unit = dss_feat_get_buffer_size_unit();
1169
1170 WARN_ON(low % unit != 0);
1171 WARN_ON(high % unit != 0);
1172
1173 low /= unit;
1174 high /= unit;
1143 1175
1144 dss_feat_get_reg_field(FEAT_REG_FIFOHIGHTHRESHOLD, &hi_start, &hi_end); 1176 dss_feat_get_reg_field(FEAT_REG_FIFOHIGHTHRESHOLD, &hi_start, &hi_end);
1145 dss_feat_get_reg_field(FEAT_REG_FIFOLOWTHRESHOLD, &lo_start, &lo_end); 1177 dss_feat_get_reg_field(FEAT_REG_FIFOLOWTHRESHOLD, &lo_start, &lo_end);
@@ -3624,6 +3656,8 @@ static void _omap_dispc_initial_config(void)
3624 dispc_set_loadmode(OMAP_DSS_LOAD_FRAME_ONLY); 3656 dispc_set_loadmode(OMAP_DSS_LOAD_FRAME_ONLY);
3625 3657
3626 dispc_read_plane_fifo_sizes(); 3658 dispc_read_plane_fifo_sizes();
3659
3660 dispc_configure_burst_sizes();
3627} 3661}
3628 3662
3629int dispc_enable_plane(enum omap_plane plane, bool enable) 3663int dispc_enable_plane(enum omap_plane plane, bool enable)