Skip to contentSkip to conversation

mx3fb: Fix parameter to sdc_init_panel

PATCH New Alexander Stein 2 participants 10 messages Feb 10, 2011 – Feb 16, 2011 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mx3fb: Fix parameter to sdc_init_panel

h_end_width and v_end_width should only contain the front porches. Otherwise, SCREEN_WIDTH (pixel clocks between HSYNC) in SDC_HOR_CONF and SCREEN_HEIGHT (rows between VSYNC) in SDC_VER_CONF get false values.

---
 drivers/video/mx3fb.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
drivers/video/mx3fb.c +3 -4
index ef71e56..9040833 100644
@@ -881,12 +881,11 @@ static int __set_par(struct fb_info *fbi, bool lock)
 				   IPU_PIX_FMT_BGR666 : IPU_PIX_FMT_RGB666,
 				   fbi->var.left_margin,
 				   fbi->var.hsync_len,
-				   fbi->var.right_margin +
-				   fbi->var.hsync_len,
+				   fbi->var.right_margin,
 				   fbi->var.upper_margin,
 				   fbi->var.vsync_len,
-				   fbi->var.lower_margin +
-				   fbi->var.vsync_len, sig_cfg) != 0) {
+				   fbi->var.lower_margin,
+				   sig_cfg) != 0) {
 			dev_err(fbi->device,
 				"mx3fb: Error initializing panel.\n");
 			return -EINVAL;
Signature · 1 line
1.7.3.4
#1 lore raw

PATCH 1/1 mx3fb: Fix parameter to sdc_init_panel

Quoted 3 lines · Alexander Stein

h_end_width and v_end_width should only contain the front porches. Otherwise, SCREEN_WIDTH (pixel clocks between HSYNC) in SDC_HOR_CONF and SCREEN_HEIGHT (rows between VSYNC) in SDC_VER_CONF get false values.

Hm, no, this corrupts image on my pcm990 test-board. What makes you think this patch is needed? How do you see, that current values are "false?"

Thanks
Guennadi

Quoted 30 lines
---
 drivers/video/mx3fb.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
drivers/video/mx3fb.c +3 -4
index ef71e56..9040833 100644
@@ -881,12 +881,11 @@ static int __set_par(struct fb_info *fbi, bool lock)
 				   IPU_PIX_FMT_BGR666 : IPU_PIX_FMT_RGB666,
 				   fbi->var.left_margin,
 				   fbi->var.hsync_len,
-				   fbi->var.right_margin +
-				   fbi->var.hsync_len,
+				   fbi->var.right_margin,
 				   fbi->var.upper_margin,
 				   fbi->var.vsync_len,
-				   fbi->var.lower_margin +
-				   fbi->var.vsync_len, sig_cfg) != 0) {
+				   fbi->var.lower_margin,
+				   sig_cfg) != 0) {
 			dev_err(fbi->device,
 				"mx3fb: Error initializing panel.\n");
 			return -EINVAL;
Signature · 1 line
1.7.3.4

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#2 lore raw

PATCH 1/1 mx3fb: Fix parameter to sdc_init_panel

Quoted 18 lines · Guennadi Liakhovetski
Quoted 3 lines · Alexander Stein

h_end_width and v_end_width should only contain the front porches. Otherwise, SCREEN_WIDTH (pixel clocks between HSYNC) in SDC_HOR_CONF and SCREEN_HEIGHT (rows between VSYNC) in SDC_VER_CONF get false values.

Hm, no, this corrupts image on my pcm990 test-board. What makes you think this patch is needed? How do you see, that current values are "false?"

Thanks
Guennadi

Quoted 6 lines
---
 drivers/video/mx3fb.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
Quoted 5 lines

drivers/video/mx3fb.c static int __set_par(struct fb_info *fbi, bool lock)

Quoted 5 lines
drivers/video/mx3fb.c +0 -0
index ef71e56..9040833 100644
@@ -881,12 +881,11 @@ static int __set_par(struct fb_info *fbi, bool lock)

Also just occurred to me - your offset of 881 lines is 100 lines below my offset for the same code - against what tree is this patch, or do you have some local changes there? Can it be, that that's the reason for your problem?

Thanks
Guennadi

Quoted 16 lines
Quoted 16 lines
drivers/video/mx3fb.c +3 -4
 				   IPU_PIX_FMT_BGR666 : IPU_PIX_FMT_RGB666,
 				   fbi->var.left_margin,
 				   fbi->var.hsync_len,
-				   fbi->var.right_margin +
-				   fbi->var.hsync_len,
+				   fbi->var.right_margin,
 				   fbi->var.upper_margin,
 				   fbi->var.vsync_len,
-				   fbi->var.lower_margin +
-				   fbi->var.vsync_len, sig_cfg) != 0) {
+				   fbi->var.lower_margin,
+				   sig_cfg) != 0) {
 			dev_err(fbi->device,
 				"mx3fb: Error initializing panel.\n");
 			return -EINVAL;
Quoted 9 lines
Quoted 3 lines

1.7.3.4

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#3 lore raw

PATCH 1/1 mx3fb: Fix parameter to sdc_init_panel

Quoted 9 lines · On Thursday 10 February 2011, 12:00:09 Guennadi Liakhovetski wrote:
Quoted 8 lines · Guennadi Liakhovetski
Quoted 4 lines · Alexander Stein

h_end_width and v_end_width should only contain the front porches. Otherwise, SCREEN_WIDTH (pixel clocks between HSYNC) in SDC_HOR_CONF and SCREEN_HEIGHT (rows between VSYNC) in SDC_VER_CONF get false values.

Hm, no, this corrupts image on my pcm990 test-board. What makes you think this patch is needed? How do you see, that current values are "false?"

Ok, i will just write about HSYNC the problem about VSYNC is similar. Let's assume we have a display with the following properties.

left_margin   = 38
right_margin  = 32
hsync_len     = 20
width         = 800

Without the patch we get the following arguments on sdc_init_panel

width           = 800
h_start_width   = 38 (left_margin)
h_sync_width    = 20 (hsync_len)
h_end_width     = 52 = 32 + 20 (right_margin + hsync_len)

So we will write into SDC_HOR_CONF:

reg = ((h_sync_width - 1) << 26) |

    ((width + h_start_width + h_end_width - 1) << 16);
reg = ((20 - 1) << 26) |
    ((800 + 38 + 52 - 1) << 16);

So the value SCREEN_WIDTH get written is
width + left_margin + right_margin + hsync_len
which is IMO wrong. The description in the reference manual states:

Quoted 2 lines

Screen width minus 1. Specifies the number of pixel clock periods between the last HSYNC and the new HSYNC.

It should just be: width + left_margin + right_margin
I fell accross it, as I have a display with 800 px width and rather big left_margin. The sum got greater than 1023 which is what SCREEN_WIDTH can hold at maximum.

I don't know which display you used, but I guess your right_margin (and lower_margin) needs to be adjusted.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

---

 drivers/video/mx3fb.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
Quoted 11 lines
Quoted 6 lines

drivers/video/mx3fb.c static int __set_par(struct fb_info *fbi, bool · line 881

Quoted 6 lines
drivers/video/mx3fb.c +0 -0
index ef71e56..9040833 100644
@@ -881,12 +881,11 @@ static int __set_par(struct fb_info *fbi, bool
 lock)

Also just occurred to me - your offset of 881 lines is 100 lines below my offset for the same code - against what tree is this patch, or do you have some local changes there? Can it be, that that's the reason for your problem?

Oh, I didn't rebase this patch on current linux git. This patch is on my 2.6.34 kernel. Anyway, since 2.6.34 there are no related patches on mx3fb.c.

Alexander

#4 lore raw

PATCH 1/1 mx3fb: Fix parameter to sdc_init_panel

Quoted 10 lines · Alexander Stein
Quoted 9 lines · On Thursday 10 February 2011, 12:00:09 Guennadi Liakhovetski wrote:
Quoted 8 lines · Guennadi Liakhovetski
Quoted 4 lines · Alexander Stein

h_end_width and v_end_width should only contain the front porches. Otherwise, SCREEN_WIDTH (pixel clocks between HSYNC) in SDC_HOR_CONF and SCREEN_HEIGHT (rows between VSYNC) in SDC_VER_CONF get false values.

Hm, no, this corrupts image on my pcm990 test-board. What makes you think this patch is needed? How do you see, that current values are "false?"

(I certainly meant the pcm037 module)

Quoted 25 lines

Ok, i will just write about HSYNC the problem about VSYNC is similar. Let's assume we have a display with the following properties.

left_margin   = 38
right_margin  = 32
hsync_len     = 20
width         = 800

Without the patch we get the following arguments on sdc_init_panel

width           = 800
h_start_width   = 38 (left_margin)
h_sync_width    = 20 (hsync_len)
h_end_width     = 52 = 32 + 20 (right_margin + hsync_len)

So we will write into SDC_HOR_CONF:

reg = ((h_sync_width - 1) << 26) |

    ((width + h_start_width + h_end_width - 1) << 16);
reg = ((20 - 1) << 26) |
    ((800 + 38 + 52 - 1) << 16);

So the value SCREEN_WIDTH get written is
width + left_margin + right_margin + hsync_len
which is IMO wrong. The description in the reference manual states:

Quoted 2 lines

Screen width minus 1. Specifies the number of pixel clock periods between the last HSYNC and the new HSYNC.

Quoted 7 lines

It should just be: width + left_margin + right_margin
I fell accross it, as I have a display with 800 px width and rather big left_margin. The sum got greater than 1023 which is what SCREEN_WIDTH can hold at maximum.

I don't know which display you used, but I guess your right_margin (and lower_margin) needs to be adjusted.

Ok, agree. But then you need to adjust all current users and have them tested... Otherwise, of course, you can just adjust your platform panel data to work with the current calculations, even though in principle your patch seems to be doing the right thing (tm), according to the manual. But if applied as is without fixing all the users, it can very well break them...

Thanks
Guennadi

Quoted 18 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

---

 drivers/video/mx3fb.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
Quoted 11 lines
Quoted 6 lines

drivers/video/mx3fb.c static int __set_par(struct fb_info *fbi, bool · line 881

Quoted 6 lines
drivers/video/mx3fb.c +0 -0
index ef71e56..9040833 100644
@@ -881,12 +881,11 @@ static int __set_par(struct fb_info *fbi, bool
 lock)

Also just occurred to me - your offset of 881 lines is 100 lines below my offset for the same code - against what tree is this patch, or do you have some local changes there? Can it be, that that's the reason for your problem?

Quoted 5 lines

Oh, I didn't rebase this patch on current linux git. This patch is on my 2.6.34 kernel. Anyway, since 2.6.34 there are no related patches on mx3fb.c.

Alexander

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#5 lore raw

PATCH 1/1 mx3fb: Fix parameter to sdc_init_panel

Quoted 38 lines · On Thursday 10 February 2011, 13:48:23 Guennadi Liakhovetski wrote:
Quoted 30 lines

Ok, i will just write about HSYNC the problem about VSYNC is similar. Let's assume we have a display with the following properties.

left_margin   = 38
right_margin  = 32
hsync_len     = 20
width         = 800

Without the patch we get the following arguments on sdc_init_panel

width           = 800
h_start_width   = 38 (left_margin)
h_sync_width    = 20 (hsync_len)
h_end_width     = 52 = 32 + 20 (right_margin + hsync_len)

So we will write into SDC_HOR_CONF:

reg = ((h_sync_width - 1) << 26) |

    ((width + h_start_width + h_end_width - 1) << 16);

reg = ((20 - 1) << 26) |

    ((800 + 38 + 52 - 1) << 16);

So the value SCREEN_WIDTH get written is
width + left_margin + right_margin + hsync_len

which is IMO wrong. The description in the reference manual states:

Quoted 2 lines

Screen width minus 1. Specifies the number of pixel clock periods between the last HSYNC and the new HSYNC.

Quoted 7 lines

It should just be: width + left_margin + right_margin
I fell accross it, as I have a display with 800 px width and rather big left_margin. The sum got greater than 1023 which is what SCREEN_WIDTH can hold at maximum.

I don't know which display you used, but I guess your right_margin (and lower_margin) needs to be adjusted.

Quoted 6 lines

Ok, agree. But then you need to adjust all current users and have them tested... Otherwise, of course, you can just adjust your platform panel data to work with the current calculations, even though in principle your patch seems to be doing the right thing (tm), according to the manual. But if applied as is without fixing all the users, it can very well break them...

Ok, I've just seen there are some model defines in mx3fb.c which would also be affected.
I'll try to find all mx3fb users and fix their videomodes and repost a new patch.

Alexander

#6 lore raw

PATCH 1/1 mx3fb: Fix parameter to sdc_init_panel

Quoted 11 lines · On Thursday 10 February 2011, 14:01:17 Alexander Stein wrote:
Quoted 9 lines · On Thursday 10 February 2011, 13:48:23 Guennadi Liakhovetski wrote:
Quoted 2 lines

I don't know which display you used, but I guess your right_margin (and lower_margin) needs to be adjusted.

Ok, agree. But then you need to adjust all current users and have them tested... Otherwise, of course, you can just adjust your platform panel data to work with the current calculations, even though in principle your patch seems to be doing the right thing (tm), according to the manual. But if applied as is without fixing all the users, it can very well break them...

Quoted 4 lines

Ok, I've just seen there are some model defines in mx3fb.c which would also be affected.
I'll try to find all mx3fb users and fix their videomodes and repost a new patch.

Uh, this seems next to impossible for me to handle it my own. I checked some users of the mx3fb but I cant say which ones will be affected and which ones not (e.g. without any hsync/vsync, on data enable).
I've not idea how to fix it then.

Alexander

#7 lore raw

PATCH 1/1 mx3fb: Fix parameter to sdc_init_panel

Quoted 17 lines · Alexander Stein
Quoted 11 lines · On Thursday 10 February 2011, 14:01:17 Alexander Stein wrote:
Quoted 9 lines · On Thursday 10 February 2011, 13:48:23 Guennadi Liakhovetski wrote:
Quoted 2 lines

I don't know which display you used, but I guess your right_margin (and lower_margin) needs to be adjusted.

Ok, agree. But then you need to adjust all current users and have them tested... Otherwise, of course, you can just adjust your platform panel data to work with the current calculations, even though in principle your patch seems to be doing the right thing (tm), according to the manual. But if applied as is without fixing all the users, it can very well break them...

Quoted 4 lines

Ok, I've just seen there are some model defines in mx3fb.c which would also be affected.
I'll try to find all mx3fb users and fix their videomodes and repost a new patch.

Quoted 4 lines

Uh, this seems next to impossible for me to handle it my own. I checked some users of the mx3fb but I cant say which ones will be affected and which ones not (e.g. without any hsync/vsync, on data enable).
I've not idea how to fix it then.

Well, you can, of course, adjust parameters for your platform to be able to run with this incorrect parameter definition...

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#8 lore raw

PATCH 1/1 mx3fb: Fix parameter to sdc_init_panel

Quoted 18 lines · On Monday 14 February 2011, 08:57:04 Guennadi Liakhovetski wrote:
Quoted 17 lines · Alexander Stein
Quoted 15 lines · On Thursday 10 February 2011, 14:01:17 Alexander Stein wrote:
Quoted 9 lines · On Thursday 10 February 2011, 13:48:23 Guennadi Liakhovetski wrote:
Quoted 2 lines

I don't know which display you used, but I guess your right_margin (and lower_margin) needs to be adjusted.

Ok, agree. But then you need to adjust all current users and have them tested... Otherwise, of course, you can just adjust your platform panel data to work with the current calculations, even though in principle your patch seems to be doing the right thing (tm), according to the manual. But if applied as is without fixing all the users, it can very well break them...

Ok, I've just seen there are some model defines in mx3fb.c which would also be affected.
I'll try to find all mx3fb users and fix their videomodes and repost a new patch.

Quoted 7 lines
Quoted 4 lines

Uh, this seems next to impossible for me to handle it my own. I checked some users of the mx3fb but I cant say which ones will be affected and which ones not (e.g. without any hsync/vsync, on data enable). I've not idea how to fix it then.

Well, you can, of course, adjust parameters for your platform to be able to run with this incorrect parameter definition...

This is just an ugly work-around. Depending on the settings you may even get an overflow resulting in a not-working display at all.

Alexander

#9 lore raw

PATCH 1/1 mx3fb: Fix parameter to sdc_init_panel

Quoted 24 lines · Alexander Stein
Quoted 23 lines · On Monday 14 February 2011, 08:57:04 Guennadi Liakhovetski wrote:
Quoted 21 lines · Alexander Stein
Quoted 11 lines · On Thursday 10 February 2011, 14:01:17 Alexander Stein wrote:
Quoted 9 lines · On Thursday 10 February 2011, 13:48:23 Guennadi Liakhovetski wrote:
Quoted 2 lines

I don't know which display you used, but I guess your right_margin (and lower_margin) needs to be adjusted.

Ok, agree. But then you need to adjust all current users and have them tested... Otherwise, of course, you can just adjust your platform panel data to work with the current calculations, even though in principle your patch seems to be doing the right thing (tm), according to the manual. But if applied as is without fixing all the users, it can very well break them...

Quoted 4 lines

Ok, I've just seen there are some model defines in mx3fb.c which would also be affected.
I'll try to find all mx3fb users and fix their videomodes and repost a new patch.

Uh, this seems next to impossible for me to handle it my own. I checked some users of the mx3fb but I cant say which ones will be affected and which ones not (e.g. without any hsync/vsync, on data enable). I've not idea how to fix it then.

Quoted 5 lines
Quoted 2 lines

Well, you can, of course, adjust parameters for your platform to be able to run with this incorrect parameter definition...

This is just an ugly work-around. Depending on the settings you may even get an overflow resulting in a not-working display at all.

Sure, I know, that this is a work-around. But I don't see options apart from

1. fix the driver and maybe a couple of platforms, that we have at hand and hope, that others will fix theirs or shout loud enough, when they discover, that their platforms are broken

2. fix the driver and all users and try to get as many of them as we can to test our fixes

3. leave the driver and work around the bug in all new platforms

Choose your poison;)

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/