Skip to contentSkip to conversation

drm/tilcdc: fix raster control register setting

PATCH RESEND In review Dario Binacchi 3 participants 4 messages Feb 16, 2021 – Feb 18, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 drm/tilcdc: fix raster control register setting

The fdd property of the tilcdc_panel_info structure must set the reqdly bit field (bit 12 to 19) of the raster control register. The previous statement set the least significant bit instead.

---

 drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/tilcdc/tilcdc_crtc.c +1 -1
index 30213708fc99..238068e28729 100644
@@ -393,7 +393,7 @@ static void tilcdc_crtc_set_mode(struct drm_crtc *crtc)
 			return;
 		}
 	}
-	reg |= info->fdd < 12;
+	reg |= info->fdd << 12;
 	tilcdc_write(dev, LCDC_RASTER_CTRL_REG, reg);
 
 	if (info->invert_pxl_clk)
Signature · 6 lines
2.17.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 17 lines · Dario Binacchi

The fdd property of the tilcdc_panel_info structure must set the reqdly bit field (bit 12 to 19) of the raster control register. The previous statement set the least significant bit instead.

---

 drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/tilcdc/tilcdc_crtc.c +0 -0
index 30213708fc99..238068e28729 100644

drivers/gpu/drm/tilcdc/tilcdc_crtc.c static void tilcdc_crtc_set_mode(struct drm_crtc *crtc) · line 399

Quoted 8 lines
drivers/gpu/drm/tilcdc/tilcdc_crtc.c +1 -1
@@ -393,7 +393,7 @@ static void tilcdc_crtc_set_mode(struct drm_crtc *crtc)
 			return;
 		}
 	}
-	reg |= info->fdd < 12;
+	reg |= info->fdd << 12;
 	tilcdc_write(dev, LCDC_RASTER_CTRL_REG, reg);
 
 	if (info->invert_pxl_clk)

This is interesting, looks like this has always been broken, and in many cases sets bits 0, which is the enable bit. So we enable LCDC before even setting the fb address. How does this not blow up LCDC totally?

The fix looks correct to me, but it will change the register value for boards that have apparently been working for years.

Dario, did you test this on actual HW, or did you just spot the error?

Tomi
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw

Hi Tomi,

Quoted 34 lines

Il 17/02/2021 07:41 Tomi Valkeinen <[email protected]> ha scritto:

Quoted 17 lines · Dario Binacchi

The fdd property of the tilcdc_panel_info structure must set the reqdly bit field (bit 12 to 19) of the raster control register. The previous statement set the least significant bit instead.

---

 drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/tilcdc/tilcdc_crtc.c +0 -0
index 30213708fc99..238068e28729 100644

drivers/gpu/drm/tilcdc/tilcdc_crtc.c static void tilcdc_crtc_set_mode(struct drm_crtc *crtc) · line 399

Quoted 8 lines
drivers/gpu/drm/tilcdc/tilcdc_crtc.c +1 -1
@@ -393,7 +393,7 @@ static void tilcdc_crtc_set_mode(struct drm_crtc *crtc)
 			return;
 		}
 	}
-	reg |= info->fdd < 12;
+	reg |= info->fdd << 12;
 	tilcdc_write(dev, LCDC_RASTER_CTRL_REG, reg);
 
 	if (info->invert_pxl_clk)

This is interesting, looks like this has always been broken, and in many cases sets bits 0, which is the enable bit. So we enable LCDC before even setting the fb address. How does this not blow up LCDC totally?

Quoted 4 lines

The fix looks correct to me, but it will change the register value for boards that have apparently been working for years.

Dario, did you test this on actual HW, or did you just spot the error?

I tested it on Beaglebone Black + LCD cape (4.3inch). I also checked the register value with devmem.

Regards,
Dario

Quoted 8 lines

Tomi
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

maintainer Reviewed-by Tested-by on v1 1/1
#3 lore raw
In reply to Dario Binacchi
Quoted 5 lines · Dario Binacchi

The fdd property of the tilcdc_panel_info structure must set the reqdly bit field (bit 12 to 19) of the raster control register. The previous statement set the least significant bit instead.

Thanks for a good catch. I'll merge to this drm-misc-next soon.

Best regards,
Jyri

Quoted 20 lines

---

 drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/tilcdc/tilcdc_crtc.c +1 -1
index 30213708fc99..238068e28729 100644
@@ -393,7 +393,7 @@ static void tilcdc_crtc_set_mode(struct drm_crtc 
 *crtc)
 			return;
 		}
 	}
-	reg |= info->fdd < 12;
+	reg |= info->fdd << 12;
 	tilcdc_write(dev, LCDC_RASTER_CTRL_REG, reg);
 
Quoted 1 line

if (info->invert_pxl_clk)

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel