Commit b6bb679b authored by Bich Hemon's avatar Bich Hemon Committed by Vincent Abriou

drm/sti: fix dvo data_enable signal

Modify AWG algorithm in order to handle more than 1023 lines
Signed-off-by: default avatarBich Hemon <bich.hemon@st.com>
Reviewed-by: default avatarBenjamin Gaignard <benjamin.gaignard@linaro.org>
Reviewed-by: default avatarVincent Abriou <vincent.abriou@st.com>
parent 9a024948
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "sti_awg_utils.h" #include "sti_awg_utils.h"
#define AWG_OPCODE_OFFSET 10 #define AWG_OPCODE_OFFSET 10
#define AWG_MAX_ARG 0x3ff
enum opcode { enum opcode {
SET, SET,
...@@ -67,7 +68,7 @@ static int awg_generate_instr(enum opcode opcode, ...@@ -67,7 +68,7 @@ static int awg_generate_instr(enum opcode opcode,
mux = 0; mux = 0;
data_enable = 0; data_enable = 0;
arg &= (0x3ff); arg &= AWG_MAX_ARG;
break; break;
case REPEAT: case REPEAT:
case REPLAY: case REPLAY:
...@@ -78,13 +79,13 @@ static int awg_generate_instr(enum opcode opcode, ...@@ -78,13 +79,13 @@ static int awg_generate_instr(enum opcode opcode,
mux = 0; mux = 0;
data_enable = 0; data_enable = 0;
arg &= (0x3ff); arg &= AWG_MAX_ARG;
break; break;
case JUMP: case JUMP:
mux = 0; mux = 0;
data_enable = 0; data_enable = 0;
arg |= 0x40; /* for jump instruction 7th bit is 1 */ arg |= 0x40; /* for jump instruction 7th bit is 1 */
arg &= 0x3ff; arg &= AWG_MAX_ARG;
break; break;
case STOP: case STOP:
arg = 0; arg = 0;
...@@ -112,22 +113,13 @@ static int awg_generate_instr(enum opcode opcode, ...@@ -112,22 +113,13 @@ static int awg_generate_instr(enum opcode opcode,
return 0; return 0;
} }
int sti_awg_generate_code_data_enable_mode( static int awg_generate_line_signal(
struct awg_code_generation_params *fwparams, struct awg_code_generation_params *fwparams,
struct awg_timing *timing) struct awg_timing *timing)
{ {
long int val; long int val;
int ret = 0; int ret = 0;
if (timing->trailing_lines > 0) {
/* skip trailing lines */
val = timing->blanking_level;
ret |= awg_generate_instr(RPLSET, val, 0, 0, fwparams);
val = timing->trailing_lines - 1;
ret |= awg_generate_instr(REPLAY, val, 0, 0, fwparams);
}
if (timing->trailing_pixels > 0) { if (timing->trailing_pixels > 0) {
/* skip trailing pixel */ /* skip trailing pixel */
val = timing->blanking_level; val = timing->blanking_level;
...@@ -152,9 +144,36 @@ int sti_awg_generate_code_data_enable_mode( ...@@ -152,9 +144,36 @@ int sti_awg_generate_code_data_enable_mode(
ret |= awg_generate_instr(SET, val, 0, 0, fwparams); ret |= awg_generate_instr(SET, val, 0, 0, fwparams);
} }
/* replay the sequence as many active lines defined */ return ret;
val = timing->active_lines - 1; }
ret |= awg_generate_instr(REPLAY, val, 0, 0, fwparams);
int sti_awg_generate_code_data_enable_mode(
struct awg_code_generation_params *fwparams,
struct awg_timing *timing)
{
long int val, tmp_val;
int ret = 0;
if (timing->trailing_lines > 0) {
/* skip trailing lines */
val = timing->blanking_level;
ret |= awg_generate_instr(RPLSET, val, 0, 0, fwparams);
val = timing->trailing_lines - 1;
ret |= awg_generate_instr(REPLAY, val, 0, 0, fwparams);
}
tmp_val = timing->active_lines - 1;
while (tmp_val > 0) {
/* generate DE signal for each line */
ret |= awg_generate_line_signal(fwparams, timing);
/* replay the sequence as many active lines defined */
ret |= awg_generate_instr(REPLAY,
min_t(int, AWG_MAX_ARG, tmp_val),
0, 0, fwparams);
tmp_val -= AWG_MAX_ARG;
}
if (timing->blanking_lines > 0) { if (timing->blanking_lines > 0) {
/* skip blanking lines */ /* skip blanking lines */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment