diff mbox series

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

Message ID 20211013233632.471892-7-anitha.chrisanthus@intel.com (mailing list archive)
State New, archived
Headers show
Series [v3,1/7] drm/kmb: Work around for higher system clock | expand

Commit Message

Chrisanthus, Anitha Oct. 13, 2021, 11:36 p.m. UTC
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

Signed-off-by: Edmund Dea <edmund.j.dea@intel.com>
Signed-off-by: Anitha Chrisanthus <anitha.chrisanthus@intel.com>
---
 drivers/gpu/drm/kmb/kmb_drv.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Thomas Zimmermann Oct. 14, 2021, 12:50 p.m. UTC | #1
Hi

Am 14.10.21 um 01:36 schrieb 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
> 
> Signed-off-by: Edmund Dea <edmund.j.dea@intel.com>
> Signed-off-by: Anitha Chrisanthus <anitha.chrisanthus@intel.com>
> ---
>   drivers/gpu/drm/kmb/kmb_drv.c | 11 +++++++++++
>   1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/gpu/drm/kmb/kmb_drv.c b/drivers/gpu/drm/kmb/kmb_drv.c
> index 961ac6fb5fcf..b4e66eac63b5 100644
> --- a/drivers/gpu/drm/kmb/kmb_drv.c
> +++ b/drivers/gpu/drm/kmb/kmb_drv.c
> @@ -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)");

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

Best regards
Thomas

> +
>   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:
>
Thomas Zimmermann Oct. 14, 2021, 1:08 p.m. UTC | #2
Hi

Am 14.10.21 um 01:36 schrieb 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
> 
> Signed-off-by: Edmund Dea <edmund.j.dea@intel.com>
> Signed-off-by: Anitha Chrisanthus <anitha.chrisanthus@intel.com>
> ---
>   drivers/gpu/drm/kmb/kmb_drv.c | 11 +++++++++++
>   1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/gpu/drm/kmb/kmb_drv.c b/drivers/gpu/drm/kmb/kmb_drv.c
> index 961ac6fb5fcf..b4e66eac63b5 100644
> --- a/drivers/gpu/drm/kmb/kmb_drv.c
> +++ b/drivers/gpu/drm/kmb/kmb_drv.c
> @@ -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);

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

> +
>   	return 0;
>   
>    err_register:
>
Chrisanthus, Anitha Oct. 15, 2021, 5:16 p.m. UTC | #3
Hi Thomas,
Thanks for your review.

> -----Original Message-----
> From: Thomas Zimmermann <tzimmermann@suse.de>
> Sent: Thursday, October 14, 2021 6:08 AM
> To: Chrisanthus, Anitha <anitha.chrisanthus@intel.com>; dri-
> devel@lists.freedesktop.org
> Cc: sam@ravnborg.org; Dea, Edmund J <edmund.j.dea@intel.com>
> Subject: Re: [PATCH v3 7/7] drm/kmb: Enable support for framebuffer console
> 
> Hi
> 
> Am 14.10.21 um 01:36 schrieb 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
> >
> > Signed-off-by: Edmund Dea <edmund.j.dea@intel.com>
> > Signed-off-by: Anitha Chrisanthus <anitha.chrisanthus@intel.com>
> > ---
> >   drivers/gpu/drm/kmb/kmb_drv.c | 11 +++++++++++
> >   1 file changed, 11 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/kmb/kmb_drv.c
> b/drivers/gpu/drm/kmb/kmb_drv.c
> > index 961ac6fb5fcf..b4e66eac63b5 100644
> > --- a/drivers/gpu/drm/kmb/kmb_drv.c
> > +++ b/drivers/gpu/drm/kmb/kmb_drv.c
> > @@ -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);
> 
> 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.
> 
> Best regards
> Thomas
> 
> > +
> >   	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
Chrisanthus, Anitha Oct. 15, 2021, 5:17 p.m. UTC | #4
Hi Thomas,
Thanks for your review.

> -----Original Message-----
> From: Thomas Zimmermann <tzimmermann@suse.de>
> Sent: Thursday, October 14, 2021 5:50 AM
> To: Chrisanthus, Anitha <anitha.chrisanthus@intel.com>; dri-
> devel@lists.freedesktop.org
> Cc: sam@ravnborg.org; Dea, Edmund J <edmund.j.dea@intel.com>
> Subject: Re: [PATCH v3 7/7] drm/kmb: Enable support for framebuffer console
> 
> Hi
> 
> Am 14.10.21 um 01:36 schrieb 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
> >
> > Signed-off-by: Edmund Dea <edmund.j.dea@intel.com>
> > Signed-off-by: Anitha Chrisanthus <anitha.chrisanthus@intel.com>
> > ---
> >   drivers/gpu/drm/kmb/kmb_drv.c | 11 +++++++++++
> >   1 file changed, 11 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/kmb/kmb_drv.c
> b/drivers/gpu/drm/kmb/kmb_drv.c
> > index 961ac6fb5fcf..b4e66eac63b5 100644
> > --- a/drivers/gpu/drm/kmb/kmb_drv.c
> > +++ b/drivers/gpu/drm/kmb/kmb_drv.c
> > @@ -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)");
> 
> 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.
> 
> Best regards
> Thomas
> 
> > +
> >   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:
> >
> 
> --
> 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
diff mbox series

Patch

diff --git a/drivers/gpu/drm/kmb/kmb_drv.c b/drivers/gpu/drm/kmb/kmb_drv.c
index 961ac6fb5fcf..b4e66eac63b5 100644
--- a/drivers/gpu/drm/kmb/kmb_drv.c
+++ b/drivers/gpu/drm/kmb/kmb_drv.c
@@ -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: