Skip to contentSkip to conversation

drm/kmb: Work around for higher system clock

PATCH In review Anitha Chrisanthus 3 participants 17 messages Oct 13, 2021 – Oct 15, 2021

Subsystems (2)
lore
Share & tools
lore

Anitha Chrisanthus

author maintainer
#0 lore raw

PATCH v3 1/7 drm/kmb: Work around for higher system clock

Use a different value for system clock offset in the ppl/llp ratio calculations for clocks higher than 500 Mhz.

Fixes 98521f4d4b4c ("drm/kmb: Mipi DSI part of the display driver")
---
 drivers/gpu/drm/kmb/kmb_dsi.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/kmb/kmb_dsi.c +10 -1
index 1793cd31b117..86e8e7943e89 100644
@@ -482,6 +482,10 @@ static u32 mipi_tx_fg_section_cfg(struct kmb_dsi *kmb_dsi,
 	return 0;
 }
 
+#define CLK_DIFF_LOW 50
+#define CLK_DIFF_HI 60
+#define SYSCLK_500  500
+
 static void mipi_tx_fg_cfg_regs(struct kmb_dsi *kmb_dsi, u8 frame_gen,
 				struct mipi_tx_frame_timing_cfg *fg_cfg)
 {
@@ -492,7 +496,12 @@ static void mipi_tx_fg_cfg_regs(struct kmb_dsi *kmb_dsi, u8 frame_gen,
 	/* 500 Mhz system clock minus 50 to account for the difference in
 	 * MIPI clock speed in RTL tests
 	 */
-	sysclk = kmb_dsi->sys_clk_mhz - 50;
+	if (kmb_dsi->sys_clk_mhz == SYSCLK_500) {
+		sysclk = kmb_dsi->sys_clk_mhz - CLK_DIFF_LOW;
+	} else {
+		/* 700 Mhz clk*/
+		sysclk = kmb_dsi->sys_clk_mhz - CLK_DIFF_HI;
+	}
 
 	/* PPL-Pixel Packing Layer, LLP-Low Level Protocol
 	 * Frame genartor timing parameters are clocked on the system clock,
Signature · 1 line
2.25.1
author maintainer
#1 lore raw

PATCH v3 2/7 drm/kmb: Limit supported mode to 1080p

KMB only supports single resolution(1080p), this commit checks for 1920x1080x60 or 1920x1080x59 in crtc_mode_valid.
Also, modes with vfp < 4 are not supported in KMB display. This change prunes display modes with vfp < 4.

v2: added vfp check

Fixes 7f7b96a8a0a1 ("drm/kmb: Add support for KeemBay Display")
---
 drivers/gpu/drm/kmb/kmb_crtc.c | 34 ++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/kmb/kmb_drv.h  | 13 ++++++++++---
 2 files changed, 44 insertions(+), 3 deletions(-)
drivers/gpu/drm/kmb/kmb_crtc.c +34 -0
index 44327bc629ca..08a45e813db7 100644
@@ -185,11 +185,45 @@ static void kmb_crtc_atomic_flush(struct drm_crtc *crtc,
 	spin_unlock_irq(&crtc->dev->event_lock);
 }
 
+static enum drm_mode_status
+		kmb_crtc_mode_valid(struct drm_crtc *crtc,
+				    const struct drm_display_mode *mode)
+{
+	int refresh;
+	struct drm_device *dev = crtc->dev;
+	int vfp = mode->vsync_start - mode->vdisplay;
+
+	if (mode->vdisplay < KMB_CRTC_MAX_HEIGHT) {
+		drm_dbg(dev, "height = %d less than %d",
+			mode->vdisplay, KMB_CRTC_MAX_HEIGHT);
+		return MODE_BAD_VVALUE;
+	}
+	if (mode->hdisplay < KMB_CRTC_MAX_WIDTH) {
+		drm_dbg(dev, "width = %d less than %d",
+			mode->hdisplay, KMB_CRTC_MAX_WIDTH);
+		return MODE_BAD_HVALUE;
+	}
+	refresh = drm_mode_vrefresh(mode);
+	if (refresh < KMB_MIN_VREFRESH || refresh > KMB_MAX_VREFRESH) {
+		drm_dbg(dev, "refresh = %d less than %d or greater than %d",
+			refresh, KMB_MIN_VREFRESH, KMB_MAX_VREFRESH);
+		return MODE_BAD;
+	}
+
+	if (vfp < KMB_CRTC_MIN_VFP) {
+		drm_dbg(dev, "vfp = %d less than %d", vfp, KMB_CRTC_MIN_VFP);
+		return MODE_BAD;
+	}
+
+	return MODE_OK;
+}
+
 static const struct drm_crtc_helper_funcs kmb_crtc_helper_funcs = {
 	.atomic_begin = kmb_crtc_atomic_begin,
 	.atomic_enable = kmb_crtc_atomic_enable,
 	.atomic_disable = kmb_crtc_atomic_disable,
 	.atomic_flush = kmb_crtc_atomic_flush,
+	.mode_valid = kmb_crtc_mode_valid,
 };
 
 int kmb_setup_crtc(struct drm_device *drm)
drivers/gpu/drm/kmb/kmb_drv.h +10 -3
index 69a62e2d03ff..d297218869e8 100644
@@ -18,13 +18,20 @@
 
 #define DRIVER_DATE			"20210223"
 #define DRIVER_MAJOR			1
-#define DRIVER_MINOR			1
-
+#define DRIVER_MINOR			2
+
+/* Platform definitions */
+#define KMB_CRTC_MIN_VFP		4
+#define KMB_CRTC_MAX_WIDTH		1920 /* max width in pixels */
+#define KMB_CRTC_MAX_HEIGHT		1080 /* max height in pixels */
+#define KMB_CRTC_MIN_WIDTH		1920
+#define KMB_CRTC_MIN_HEIGHT		1080
 #define KMB_FB_MAX_WIDTH		1920
 #define KMB_FB_MAX_HEIGHT		1080
 #define KMB_FB_MIN_WIDTH		1
 #define KMB_FB_MIN_HEIGHT		1
-
+#define KMB_MIN_VREFRESH		59    /*vertical refresh in Hz */
+#define KMB_MAX_VREFRESH		60    /*vertical refresh in Hz */
 #define KMB_LCD_DEFAULT_CLK		200000000
 #define KMB_SYS_CLK_MHZ			500
 
Signature · 1 line
2.25.1
Acked-by on v3 2/7
#2 lore raw

Re: [PATCH v3 2/7] drm/kmb: Limit supported mode to 1080p

Quoted 10 lines · Anitha Chrisanthus

KMB only supports single resolution(1080p), this commit checks for 1920x1080x60 or 1920x1080x59 in crtc_mode_valid.
Also, modes with vfp < 4 are not supported in KMB display. This change prunes display modes with vfp < 4.

v2: added vfp check

Fixes 7f7b96a8a0a1 ("drm/kmb: Add support for KeemBay Display")

This looks wrong. I assume it Edmund also did some development work so you should also add:

One nit below. With these nits fixed:

Sam

Quoted 60 lines
---
 drivers/gpu/drm/kmb/kmb_crtc.c | 34 ++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/kmb/kmb_drv.h  | 13 ++++++++++---
 2 files changed, 44 insertions(+), 3 deletions(-)
drivers/gpu/drm/kmb/kmb_crtc.c +34 -0
index 44327bc629ca..08a45e813db7 100644
@@ -185,11 +185,45 @@ static void kmb_crtc_atomic_flush(struct drm_crtc *crtc,
 	spin_unlock_irq(&crtc->dev->event_lock);
 }
 
+static enum drm_mode_status
+		kmb_crtc_mode_valid(struct drm_crtc *crtc,
+				    const struct drm_display_mode *mode)
+{
+	int refresh;
+	struct drm_device *dev = crtc->dev;
+	int vfp = mode->vsync_start - mode->vdisplay;
+
+	if (mode->vdisplay < KMB_CRTC_MAX_HEIGHT) {
+		drm_dbg(dev, "height = %d less than %d",
+			mode->vdisplay, KMB_CRTC_MAX_HEIGHT);
+		return MODE_BAD_VVALUE;
+	}
+	if (mode->hdisplay < KMB_CRTC_MAX_WIDTH) {
+		drm_dbg(dev, "width = %d less than %d",
+			mode->hdisplay, KMB_CRTC_MAX_WIDTH);
+		return MODE_BAD_HVALUE;
+	}
+	refresh = drm_mode_vrefresh(mode);
+	if (refresh < KMB_MIN_VREFRESH || refresh > KMB_MAX_VREFRESH) {
+		drm_dbg(dev, "refresh = %d less than %d or greater than %d",
+			refresh, KMB_MIN_VREFRESH, KMB_MAX_VREFRESH);
+		return MODE_BAD;
+	}
+
+	if (vfp < KMB_CRTC_MIN_VFP) {
+		drm_dbg(dev, "vfp = %d less than %d", vfp, KMB_CRTC_MIN_VFP);
+		return MODE_BAD;
+	}
+
+	return MODE_OK;
+}
+
 static const struct drm_crtc_helper_funcs kmb_crtc_helper_funcs = {
 	.atomic_begin = kmb_crtc_atomic_begin,
 	.atomic_enable = kmb_crtc_atomic_enable,
 	.atomic_disable = kmb_crtc_atomic_disable,
 	.atomic_flush = kmb_crtc_atomic_flush,
+	.mode_valid = kmb_crtc_mode_valid,
 };
 
 int kmb_setup_crtc(struct drm_device *drm)
drivers/gpu/drm/kmb/kmb_drv.h +0 -0
index 69a62e2d03ff..d297218869e8 100644

drivers/gpu/drm/kmb/kmb_drv.h line 21

Quoted 6 lines
drivers/gpu/drm/kmb/kmb_drv.h +1 -2
@@ -18,13 +18,20 @@
 
 #define DRIVER_DATE			"20210223"
 #define DRIVER_MAJOR			1
-#define DRIVER_MINOR			1
-
+#define DRIVER_MINOR			2

This change looks un-related.

Quoted 19 lines
drivers/gpu/drm/kmb/kmb_drv.h +9 -1
+
+/* Platform definitions */
+#define KMB_CRTC_MIN_VFP		4
+#define KMB_CRTC_MAX_WIDTH		1920 /* max width in pixels */
+#define KMB_CRTC_MAX_HEIGHT		1080 /* max height in pixels */
+#define KMB_CRTC_MIN_WIDTH		1920
+#define KMB_CRTC_MIN_HEIGHT		1080
 #define KMB_FB_MAX_WIDTH		1920
 #define KMB_FB_MAX_HEIGHT		1080
 #define KMB_FB_MIN_WIDTH		1
 #define KMB_FB_MIN_HEIGHT		1
-
+#define KMB_MIN_VREFRESH		59    /*vertical refresh in Hz */
+#define KMB_MAX_VREFRESH		60    /*vertical refresh in Hz */
 #define KMB_LCD_DEFAULT_CLK		200000000
 #define KMB_SYS_CLK_MHZ			500
 
Signature · 1 line
2.25.1
author maintainer
#3 lore raw

PATCH v3 3/7 drm/kmb: Remove clearing DPHY regs

In reply to Anitha Chrisanthus

From: Edmund Dea <[email protected]>

Don't clear the shared DPHY registers common to MIPI Rx and MIPI Tx during DSI initialization since this was causing MIPI Rx reset. Rest of the writes are bitwise, so will not affect Mipi Rx side.

Fixes 98521f4d4b4c ("drm/kmb: Mipi DSI part of the display driver")
---
 drivers/gpu/drm/kmb/kmb_dsi.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/gpu/drm/kmb/kmb_dsi.c +0 -5
index 86e8e7943e89..a0669b842ff5 100644
@@ -1393,11 +1393,6 @@ int kmb_dsi_mode_set(struct kmb_dsi *kmb_dsi, struct drm_display_mode *mode,
 		mipi_tx_init_cfg.lane_rate_mbps = data_rate;
 	}
 
-	kmb_write_mipi(kmb_dsi, DPHY_ENABLE, 0);
-	kmb_write_mipi(kmb_dsi, DPHY_INIT_CTRL0, 0);
-	kmb_write_mipi(kmb_dsi, DPHY_INIT_CTRL1, 0);
-	kmb_write_mipi(kmb_dsi, DPHY_INIT_CTRL2, 0);
-
 	/* Initialize mipi controller */
 	mipi_tx_init_cntrl(kmb_dsi, &mipi_tx_init_cfg);
 
Signature · 1 line
2.25.1
Acked-by on v3 3/7
#4 lore raw

Re: [PATCH v3 3/7] drm/kmb: Remove clearing DPHY regs

Quoted 9 lines · Anitha Chrisanthus

From: Edmund Dea <[email protected]>

Don't clear the shared DPHY registers common to MIPI Rx and MIPI Tx during DSI initialization since this was causing MIPI Rx reset. Rest of the writes are bitwise, so will not affect Mipi Rx side.

Fixes 98521f4d4b4c ("drm/kmb: Mipi DSI part of the display driver")

As Edmund is author, he should be listed first. The s-o-b lines expressed the order.
With this fixed.

Quoted 22 lines
---
 drivers/gpu/drm/kmb/kmb_dsi.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/gpu/drm/kmb/kmb_dsi.c +0 -5
index 86e8e7943e89..a0669b842ff5 100644
@@ -1393,11 +1393,6 @@ int kmb_dsi_mode_set(struct kmb_dsi *kmb_dsi, struct drm_display_mode *mode,
 		mipi_tx_init_cfg.lane_rate_mbps = data_rate;
 	}
 
-	kmb_write_mipi(kmb_dsi, DPHY_ENABLE, 0);
-	kmb_write_mipi(kmb_dsi, DPHY_INIT_CTRL0, 0);
-	kmb_write_mipi(kmb_dsi, DPHY_INIT_CTRL1, 0);
-	kmb_write_mipi(kmb_dsi, DPHY_INIT_CTRL2, 0);
-
 	/* Initialize mipi controller */
 	mipi_tx_init_cntrl(kmb_dsi, &mipi_tx_init_cfg);
 
Signature · 1 line
2.25.1
author maintainer
#5 lore raw

PATCH v3 4/7 drm/kmb: Disable change of plane parameters

In reply to Anitha Chrisanthus

From: Edmund Dea <[email protected]>

Due to HW limitations, KMB cannot change height, width, or pixel format after initial plane configuration.

v2: removed memset disp_cfg as it is already zero.

Fixes 7f7b96a8a0a1 ("drm/kmb: Add support for KeemBay Display")
---
 drivers/gpu/drm/kmb/kmb_drv.h   |  1 +
 drivers/gpu/drm/kmb/kmb_plane.c | 43 ++++++++++++++++++++++++++++++++-
 drivers/gpu/drm/kmb/kmb_plane.h |  6 +++++
 3 files changed, 49 insertions(+), 1 deletion(-)
drivers/gpu/drm/kmb/kmb_drv.h +1 -0
index d297218869e8..b3203f583a46 100644
@@ -57,6 +57,7 @@ struct kmb_drm_private {
 	spinlock_t			irq_lock;
 	int				irq_lcd;
 	int				sys_clk_mhz;
+	struct disp_cfg			init_disp_cfg[KMB_MAX_PLANES];
 	struct layer_status		plane_status[KMB_MAX_PLANES];
 	int				kmb_under_flow;
 	int				kmb_flush_done;
drivers/gpu/drm/kmb/kmb_plane.c +42 -1

86 lines not on this page · raw message

drivers/gpu/drm/kmb/kmb_plane.h +6 -0
index 6e8d22cf8819..b51144044fe8 100644
@@ -63,6 +63,12 @@ struct layer_status {
 	u32 ctrl;
 };
 
+struct disp_cfg {
+	unsigned int width;
+	unsigned int height;
+	unsigned int format;
+};
+
 struct kmb_plane *kmb_plane_init(struct drm_device *drm);
 void kmb_plane_destroy(struct drm_plane *plane);
 #endif /* __KMB_PLANE_H__ */
Signature · 1 line
2.25.1
Acked-by on v3 4/7
#6 lore raw

Re: [PATCH v3 4/7] drm/kmb: Disable change of plane parameters

Hi Anitha,

Quoted 10 lines · Anitha Chrisanthus

From: Edmund Dea <[email protected]>

Due to HW limitations, KMB cannot change height, width, or pixel format after initial plane configuration.

v2: removed memset disp_cfg as it is already zero.

Fixes 7f7b96a8a0a1 ("drm/kmb: Add support for KeemBay Display")

Looks fine and the s-o-b order is OK.

Sam

author maintainer
#7 lore raw

PATCH v3 5/7 drm/kmb: Corrected typo in handle_lcd_irq

In reply to Anitha Chrisanthus

Check for Overflow bits for layer3 in the irq handler.

Fixes 7f7b96a8a0a1 ("drm/kmb: Add support for KeemBay Display")
---
 drivers/gpu/drm/kmb/kmb_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/kmb/kmb_drv.c +1 -1
index 12ce669650cc..961ac6fb5fcf 100644
@@ -380,7 +380,7 @@ static irqreturn_t handle_lcd_irq(struct drm_device *dev)
 		if (val & LAYER3_DMA_FIFO_UNDERFLOW)
 			drm_dbg(&kmb->drm,
 				"LAYER3:GL1 DMA UNDERFLOW val = 0x%lx", val);
-		if (val & LAYER3_DMA_FIFO_UNDERFLOW)
+		if (val & LAYER3_DMA_FIFO_OVERFLOW)
 			drm_dbg(&kmb->drm,
 				"LAYER3:GL1 DMA OVERFLOW val = 0x%lx", val);
 	}
Signature · 1 line
2.25.1
author maintainer
#9 lore raw

PATCH v3 6/7 drm/kmb: Enable ADV bridge after modeset

In reply to Anitha Chrisanthus

On KMB, ADV bridge must be programmed and powered on prior to MIPI DSI HW initialization.

Fixes 98521f4d4b4c ("drm/kmb: Mipi DSI part of the display driver")
---
 drivers/gpu/drm/kmb/kmb_dsi.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/kmb/kmb_dsi.c +1 -0
index a0669b842ff5..7ab6b7b44cbc 100644
@@ -1341,6 +1341,7 @@ static void connect_lcd_to_mipi(struct kmb_dsi *kmb_dsi)
 		return;
 	}
 
+	drm_bridge_chain_enable(adv_bridge);
 	/* DISABLE MIPI->CIF CONNECTION */
 	regmap_write(msscam, MSS_MIPI_CIF_CFG, 0);
 
Signature · 1 line
2.25.1
#10 lore raw

Re: [PATCH v3 6/7] drm/kmb: Enable ADV bridge after modeset

Hi Anitha,

Quoted 15 lines · Anitha Chrisanthus

On KMB, ADV bridge must be programmed and powered on prior to MIPI DSI HW initialization.

Fixes 98521f4d4b4c ("drm/kmb: Mipi DSI part of the display driver")
---
 drivers/gpu/drm/kmb/kmb_dsi.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/kmb/kmb_dsi.c +0 -0
index a0669b842ff5..7ab6b7b44cbc 100644

drivers/gpu/drm/kmb/kmb_dsi.c static void connect_lcd_to_mipi(struct kmb_dsi *kmb_dsi) · line 1344

Quoted 4 lines
drivers/gpu/drm/kmb/kmb_dsi.c +1 -0
@@ -1341,6 +1341,7 @@ static void connect_lcd_to_mipi(struct kmb_dsi *kmb_dsi)
 		return;
 	}
 
+	drm_bridge_chain_enable(adv_bridge);

Do not use drm_bridge_chain_enable(). If you really need to do this hack use the atomic variant. The one you use here is about to be deleted.

That said - I expect this to be a workaround for some design issue. One bridge driver should not need to power on another bridge, the infrastructure should take care.
I know we did not make kmb_dsi a proper bridge, but this may be the time to do it so we avoid such a workaround and the driver will then be able to use the bridge infrastructure as it is supposed to do.

Sam

Quoted 5 lines
drivers/gpu/drm/kmb/kmb_dsi.c +0 -0
 	/* DISABLE MIPI->CIF CONNECTION */
 	regmap_write(msscam, MSS_MIPI_CIF_CFG, 0);
 
Signature · 1 line
2.25.1
author maintainer
#11 lore raw

PATCH v3 7/7 drm/kmb: Enable support for framebuffer console

In reply to Anitha Chrisanthus

Enable support for fbcon (framebuffer console).
The user can initialize fbcon by loading kmb-drm with the parameter console=1.

v2: added missing static clk_enable

---
 drivers/gpu/drm/kmb/kmb_drv.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/gpu/drm/kmb/kmb_drv.c +11 -0
index 961ac6fb5fcf..b4e66eac63b5 100644
@@ -5,6 +5,7 @@
 
 #include <linux/clk.h>
 #include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/of_graph.h>
 #include <linux/of_platform.h>
 #include <linux/of_reserved_mem.h>
@@ -15,6 +16,7 @@
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_drv.h>
+#include <drm/drm_fb_helper.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_probe_helper.h>
@@ -24,6 +26,12 @@
 #include "kmb_dsi.h"
 #include "kmb_regs.h"
 
+/* Module Parameters */
+static bool console;
+module_param(console, bool, 0400);
+MODULE_PARM_DESC(console,
+		 "Enable framebuffer console support (0=disable [default], 1=on)");
+
 static int kmb_display_clk_enable(struct kmb_drm_private *kmb)
 {
 	int ret = 0;
@@ -559,6 +567,9 @@ static int kmb_probe(struct platform_device *pdev)
 	if (ret)
 		goto err_register;
 
+	if (console)
+		drm_fbdev_generic_setup(&kmb->drm, 32);
+
 	return 0;
 
  err_register:
Signature · 1 line
2.25.1
#12 lore raw

Re: [PATCH v3 7/7] drm/kmb: Enable support for framebuffer console

Hi

Am 14.10.21 um 01:36 schrieb Anitha Chrisanthus:

Quoted 33 lines

Enable support for fbcon (framebuffer console).
The user can initialize fbcon by loading kmb-drm with the parameter console=1.

v2: added missing static clk_enable

---
  drivers/gpu/drm/kmb/kmb_drv.c | 11 +++++++++++
  1 file changed, 11 insertions(+)
drivers/gpu/drm/kmb/kmb_drv.c +2 -0
index 961ac6fb5fcf..b4e66eac63b5 100644
@@ -5,6 +5,7 @@
 
  #include <linux/clk.h>
  #include <linux/module.h>
+#include <linux/moduleparam.h>
  #include <linux/of_graph.h>
  #include <linux/of_platform.h>
  #include <linux/of_reserved_mem.h>
@@ -15,6 +16,7 @@
 
  #include <drm/drm_atomic_helper.h>
  #include <drm/drm_drv.h>
+#include <drm/drm_fb_helper.h>
  #include <drm/drm_gem_cma_helper.h>
  #include <drm/drm_gem_framebuffer_helper.h>
  #include <drm/drm_probe_helper.h>

drivers/gpu/drm/kmb/kmb_drv.c line 33

Quoted 8 lines
drivers/gpu/drm/kmb/kmb_drv.c +5 -0
@@ -24,6 +26,12 @@
  #include "kmb_dsi.h"
  #include "kmb_regs.h"
 
+/* Module Parameters */
+static bool console;
+module_param(console, bool, 0400);
+MODULE_PARM_DESC(console,
+		 "Enable framebuffer console support (0=disable [default], 1=on)");

There's already fbdev_emulation in drm_fb_helper.c. No need for a separate parameter here.

Best regards
Thomas

Quoted 15 lines
drivers/gpu/drm/kmb/kmb_drv.c +4 -0
+
  static int kmb_display_clk_enable(struct kmb_drm_private *kmb)
  {
  	int ret = 0;
@@ -559,6 +567,9 @@ static int kmb_probe(struct platform_device *pdev)
  	if (ret)
  		goto err_register;
 
+	if (console)
+		drm_fbdev_generic_setup(&kmb->drm, 32);
+
  	return 0;
 
   err_register:
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer
author maintainer
#13 lore raw

RE: [PATCH v3 7/7] drm/kmb: Enable support for framebuffer console

Hi Thomas,
Thanks for your review.

Quoted 55 lines

-----Original Message-----
From: Thomas Zimmermann <[email protected]>
Sent: Thursday, October 14, 2021 5:50 AM
To: Chrisanthus, Anitha <[email protected]>; dri- [email protected]
Cc: [email protected]; Dea, Edmund J <[email protected]>
Subject: Re: [PATCH v3 7/7] drm/kmb: Enable support for framebuffer console

Hi

Am 14.10.21 um 01:36 schrieb Anitha Chrisanthus:

Quoted 6 lines

Enable support for fbcon (framebuffer console).
The user can initialize fbcon by loading kmb-drm with the parameter console=1.

v2: added missing static clk_enable

Review

Quoted 7 lines
---
  drivers/gpu/drm/kmb/kmb_drv.c | 11 +++++++++++
  1 file changed, 11 insertions(+)
(quoted diff) +0 -0

b/drivers/gpu/drm/kmb/kmb_drv.c

Quoted 20 lines

index 961ac6fb5fcf..b4e66eac63b5 100644

drivers/gpu/drm/kmb/kmb_drv.c +2 -0
@@ -5,6 +5,7 @@
 
  #include <linux/clk.h>
  #include <linux/module.h>
+#include <linux/moduleparam.h>
  #include <linux/of_graph.h>
  #include <linux/of_platform.h>
  #include <linux/of_reserved_mem.h>
@@ -15,6 +16,7 @@
 
  #include <drm/drm_atomic_helper.h>
  #include <drm/drm_drv.h>
+#include <drm/drm_fb_helper.h>
  #include <drm/drm_gem_cma_helper.h>
  #include <drm/drm_gem_framebuffer_helper.h>
  #include <drm/drm_probe_helper.h>

drivers/gpu/drm/kmb/kmb_drv.c line 33

Quoted 8 lines
drivers/gpu/drm/kmb/kmb_drv.c +5 -0
@@ -24,6 +26,12 @@
  #include "kmb_dsi.h"
  #include "kmb_regs.h"
 
+/* Module Parameters */
+static bool console;
+module_param(console, bool, 0400);
+MODULE_PARM_DESC(console,
+		 "Enable framebuffer console support (0=disable [default],

1=on)");

Quoted 2 lines

There's already fbdev_emulation in drm_fb_helper.c. No need for a separate parameter here.

Good catch, I'll change it in V4.

Quoted 27 lines

Best regards
Thomas

Quoted 6 lines
drivers/gpu/drm/kmb/kmb_drv.c +1 -0
+
  static int kmb_display_clk_enable(struct kmb_drm_private *kmb)
  {
  	int ret = 0;

drivers/gpu/drm/kmb/kmb_drv.c static int kmb_probe(struct platform_device *pdev) · line 575

Quoted 9 lines
drivers/gpu/drm/kmb/kmb_drv.c +3 -0
@@ -559,6 +567,9 @@ static int kmb_probe(struct platform_device *pdev)
  	if (ret)
  		goto err_register;
 
+	if (console)
+		drm_fbdev_generic_setup(&kmb->drm, 32);
+
  	return 0;
 
   err_register:

--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer

#14 lore raw

Re: [PATCH v3 7/7] drm/kmb: Enable support for framebuffer console

In reply to Anitha Chrisanthus

Hi

Am 14.10.21 um 01:36 schrieb Anitha Chrisanthus:

Quoted 46 lines

Enable support for fbcon (framebuffer console).
The user can initialize fbcon by loading kmb-drm with the parameter console=1.

v2: added missing static clk_enable

---
  drivers/gpu/drm/kmb/kmb_drv.c | 11 +++++++++++
  1 file changed, 11 insertions(+)
drivers/gpu/drm/kmb/kmb_drv.c +8 -0
index 961ac6fb5fcf..b4e66eac63b5 100644
@@ -5,6 +5,7 @@
 
  #include <linux/clk.h>
  #include <linux/module.h>
+#include <linux/moduleparam.h>
  #include <linux/of_graph.h>
  #include <linux/of_platform.h>
  #include <linux/of_reserved_mem.h>
@@ -15,6 +16,7 @@
 
  #include <drm/drm_atomic_helper.h>
  #include <drm/drm_drv.h>
+#include <drm/drm_fb_helper.h>
  #include <drm/drm_gem_cma_helper.h>
  #include <drm/drm_gem_framebuffer_helper.h>
  #include <drm/drm_probe_helper.h>
@@ -24,6 +26,12 @@
  #include "kmb_dsi.h"
  #include "kmb_regs.h"
 
+/* Module Parameters */
+static bool console;
+module_param(console, bool, 0400);
+MODULE_PARM_DESC(console,
+		 "Enable framebuffer console support (0=disable [default], 1=on)");
+
  static int kmb_display_clk_enable(struct kmb_drm_private *kmb)
  {
  	int ret = 0;

drivers/gpu/drm/kmb/kmb_drv.c static int kmb_probe(struct platform_device *pdev) · line 571

Quoted 5 lines
drivers/gpu/drm/kmb/kmb_drv.c +2 -0
@@ -559,6 +567,9 @@ static int kmb_probe(struct platform_device *pdev)
  	if (ret)
  		goto err_register;
 
+	if (console)
+		drm_fbdev_generic_setup(&kmb->drm, 32);

The use of the final parameter is somewhat confusing and should probably be 0. It's the number of bits per pixel. 32 is the default. But the preferred way of selecting color mode is via dev->mode_config.preferred_depth, which is the color depth (24!). So maybe rather set preferred_depth to 24 and let the fbdev helper figure out the details.

Best regards
Thomas

Quoted 5 lines
drivers/gpu/drm/kmb/kmb_drv.c +1 -0
+
  	return 0;
 
   err_register:
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer
author maintainer
#15 lore raw

RE: [PATCH v3 7/7] drm/kmb: Enable support for framebuffer console

Hi Thomas,
Thanks for your review.

Quoted 62 lines

-----Original Message-----
From: Thomas Zimmermann <[email protected]>
Sent: Thursday, October 14, 2021 6:08 AM
To: Chrisanthus, Anitha <[email protected]>; dri- [email protected]
Cc: [email protected]; Dea, Edmund J <[email protected]>
Subject: Re: [PATCH v3 7/7] drm/kmb: Enable support for framebuffer console

Hi

Am 14.10.21 um 01:36 schrieb Anitha Chrisanthus:

Quoted 6 lines

Enable support for fbcon (framebuffer console).
The user can initialize fbcon by loading kmb-drm with the parameter console=1.

v2: added missing static clk_enable

Review

Quoted 7 lines
---
  drivers/gpu/drm/kmb/kmb_drv.c | 11 +++++++++++
  1 file changed, 11 insertions(+)
(quoted diff) +0 -0

b/drivers/gpu/drm/kmb/kmb_drv.c

Quoted 20 lines

index 961ac6fb5fcf..b4e66eac63b5 100644

drivers/gpu/drm/kmb/kmb_drv.c +2 -0
@@ -5,6 +5,7 @@
 
  #include <linux/clk.h>
  #include <linux/module.h>
+#include <linux/moduleparam.h>
  #include <linux/of_graph.h>
  #include <linux/of_platform.h>
  #include <linux/of_reserved_mem.h>
@@ -15,6 +16,7 @@
 
  #include <drm/drm_atomic_helper.h>
  #include <drm/drm_drv.h>
+#include <drm/drm_fb_helper.h>
  #include <drm/drm_gem_cma_helper.h>
  #include <drm/drm_gem_framebuffer_helper.h>
  #include <drm/drm_probe_helper.h>

drivers/gpu/drm/kmb/kmb_drv.c line 33

Quoted 8 lines
drivers/gpu/drm/kmb/kmb_drv.c +5 -0
@@ -24,6 +26,12 @@
  #include "kmb_dsi.h"
  #include "kmb_regs.h"
 
+/* Module Parameters */
+static bool console;
+module_param(console, bool, 0400);
+MODULE_PARM_DESC(console,
+		 "Enable framebuffer console support (0=disable [default],

1=on)");

Quoted 8 lines
drivers/gpu/drm/kmb/kmb_drv.c +1 -0
+
  static int kmb_display_clk_enable(struct kmb_drm_private *kmb)
  {
  	int ret = 0;
@@ -559,6 +567,9 @@ static int kmb_probe(struct platform_device *pdev)
  	if (ret)
  		goto err_register;
 
Quoted 9 lines

drivers/gpu/drm/kmb/kmb_drv.c static int kmb_probe(struct platform_device *pdev) · line 571

Quoted 2 lines
drivers/gpu/drm/kmb/kmb_drv.c +2 -0
+	if (console)
+		drm_fbdev_generic_setup(&kmb->drm, 32);

The use of the final parameter is somewhat confusing and should probably be 0. It's the number of bits per pixel. 32 is the default. But the preferred way of selecting color mode is via dev->mode_config.preferred_depth, which is the color depth (24!). So maybe rather set preferred_depth to 24 and let the fbdev helper figure out the details.

Will change it in v4.

Quoted 17 lines

Best regards
Thomas

drivers/gpu/drm/kmb/kmb_drv.c static int kmb_probe(struct platform_device *pdev) · line 575

Quoted 5 lines
drivers/gpu/drm/kmb/kmb_drv.c +1 -0
+
  	return 0;
 
   err_register:

--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer