diff mbox series

drm/panel: Add simple panel mode for the ARM RTSMv8

Message ID 20181018122742.28896-1-linus.walleij@linaro.org
State Superseded
Headers show
Series drm/panel: Add simple panel mode for the ARM RTSMv8 | expand

Commit Message

Linus Walleij Oct. 18, 2018, 12:27 p.m. UTC
Having failed any attempts at a more generic solution,
I fall back to the very specific solution: define a simple
panel for the ARM RTSMv8 emulated platform.

I am doing this so we can convert all old users from the
previous fbdev driver to the PL111 DRM driver.

This works fine as far as I can test, provided the
device tree for RTSMv8 is augmented accordingly.

Cc: Sudeep Holla <sudeep.holla@arm.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Mali DP Maintainers <malidp@foss.arm.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/gpu/drm/panel/panel-simple.c | 30 ++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

Comments

Liviu Dudau Oct. 18, 2018, 12:44 p.m. UTC | #1
Hi Linus,

On Thu, Oct 18, 2018 at 02:27:42PM +0200, Linus Walleij wrote:
> Having failed any attempts at a more generic solution,
> I fall back to the very specific solution: define a simple
> panel for the ARM RTSMv8 emulated platform.

<Sad face>

> 
> I am doing this so we can convert all old users from the
> previous fbdev driver to the PL111 DRM driver.
> 
> This works fine as far as I can test, provided the
> device tree for RTSMv8 is augmented accordingly.

While this patch looks good to me (you can add my Reviewed-by if you
want), I'm surprised to see no other patches for the users of the panel.
Is it all in a DTS change?

Best regards,
Liviu

> 
> Cc: Sudeep Holla <sudeep.holla@arm.com>
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Cc: Liviu Dudau <liviu.dudau@arm.com>
> Cc: Mali DP Maintainers <malidp@foss.arm.com>
> Cc: Robin Murphy <robin.murphy@arm.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/gpu/drm/panel/panel-simple.c | 30 ++++++++++++++++++++++++++++
>  1 file changed, 30 insertions(+)
> 
> diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
> index 97964f7f2ace..b36fb1db16fb 100644
> --- a/drivers/gpu/drm/panel/panel-simple.c
> +++ b/drivers/gpu/drm/panel/panel-simple.c
> @@ -2323,6 +2323,33 @@ static const struct panel_desc winstar_wf35ltiacd = {
>  	.bus_format = MEDIA_BUS_FMT_RGB888_1X24,
>  };
>  
> +static const struct drm_display_mode arm_rtsmv8_mode[] = {
> +	{
> +		.clock = 65000,
> +		.hdisplay = 1024,
> +		.hsync_start = 1024 + 24,
> +		.hsync_end = 1024 + 24 + 136,
> +		.htotal = 1024 + 24 + 136 + 160,
> +		.vdisplay = 768,
> +		.vsync_start = 768 + 3,
> +		.vsync_end = 768 + 3 + 6,
> +		.vtotal = 768 + 3 + 6 + 29,
> +		.vrefresh = 60,
> +		.flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
> +	},
> +};
> +
> +static const struct panel_desc arm_rtsmv8 = {
> +	.modes = arm_rtsmv8_mode,
> +	.num_modes = 1,
> +	.bpc = 8,
> +	.size = {
> +		.width = 400,
> +		.height = 300,
> +	},
> +	.bus_format = MEDIA_BUS_FMT_RGB888_1X24,
> +};
> +
>  static const struct of_device_id platform_of_match[] = {
>  	{
>  		.compatible = "ampire,am-480272h3tmqw-t01h",
> @@ -2330,6 +2357,9 @@ static const struct of_device_id platform_of_match[] = {
>  	}, {
>  		.compatible = "ampire,am800480r3tmqwa1h",
>  		.data = &ampire_am800480r3tmqwa1h,
> +	}, {
> +		.compatible = "arm,rtsmv8-display",
> +		.data = &arm_rtsmv8,
>  	}, {
>  		.compatible = "auo,b101aw03",
>  		.data = &auo_b101aw03,
> -- 
> 2.17.2
>
Linus Walleij Oct. 18, 2018, 12:54 p.m. UTC | #2
On Thu, Oct 18, 2018 at 2:44 PM Liviu Dudau <liviu.dudau@arm.com> wrote:

> While this patch looks good to me (you can add my Reviewed-by if you
> want),

Thanks.

> I'm surprised to see no other patches for the users of the panel.
> Is it all in a DTS change?

Yes I am expecting to send that out if I can get this merged. Then
Sudeep gets to switch all the vexpress machines to DRM in one go
(DTS + defconfig updates).

It looks like this for RTSMv8:

diff --git a/arch/arm64/boot/dts/arm/rtsm_ve-aemv8a.dts
b/arch/arm64/boot/dts/arm/rtsm_ve-aemv8a.dts
index 602f63f72c37..d1383b056b6a 100644
--- a/arch/arm64/boot/dts/arm/rtsm_ve-aemv8a.dts
+++ b/arch/arm64/boot/dts/arm/rtsm_ve-aemv8a.dts
@@ -78,6 +78,20 @@
                      <0x00000008 0x80000000 0 0x80000000>;
        };

+       reserved-memory {
+               #address-cells = <2>;
+               #size-cells = <2>;
+               ranges;
+
+               /* Chipselect 2,00000000 is physically at 0x18000000 */
+               vram: vram@18000000 {
+                       /* 8 MB of designated video RAM */
+                       compatible = "shared-dma-pool";
+                       reg = <0x00000000 0x18000000 0 0x00800000>;
+                       no-map;
+               };
+       };
+
        gic: interrupt-controller@2c001000 {
                compatible = "arm,cortex-a15-gic", "arm,cortex-a9-gic";
                #interrupt-cells = <3>;
@@ -107,6 +121,15 @@
                             <0 63 4>;
        };

+       panel {
+               compatible = "arm,rtsmv8-display";
+               port {
+                       panel_in: endpoint {
+                               remote-endpoint = <&clcd_pads>;
+                       };
+               };
+       };
+
        smb@8000000 {
                compatible = "simple-bus";
 diff --git a/arch/arm64/boot/dts/arm/rtsm_ve-motherboard.dtsi
b/arch/arm64/boot/dts/arm/rtsm_ve-motherboard.dtsi
index d2dbc3f39263..b25f3cbd3da8 100644
--- a/arch/arm64/boot/dts/arm/rtsm_ve-motherboard.dtsi
+++ b/arch/arm64/boot/dts/arm/rtsm_ve-motherboard.dtsi
@@ -24,11 +24,6 @@
                                bank-width = <4>;
                        };

-                       v2m_video_ram: vram@2,00000000 {
-                               compatible = "arm,vexpress-vram";
-                               reg = <2 0x00000000 0x00800000>;
-                       };
-
                        ethernet@2,02000000 {
                                compatible = "smsc,lan91c111";
                                reg = <2 0x02000000 0x10000>;
@@ -187,38 +182,16 @@
                                        interrupts = <14>;
                                        clocks = <&v2m_oscclk1>,
<&v2m_clk24mhz>;
                                        clock-names = "clcdclk", "apb_pclk";
-                                       arm,pl11x,framebuffer =
<0x18000000 0x00180000>;
-                                       memory-region = <&v2m_video_ram>;
-                                       max-memory-bandwidth =
<130000000>; /* 16bpp @ 63.5MHz */
+                                       /* 800x600 16bpp @36MHz works fine */
+                                       max-memory-bandwidth = <54000000>;
+                                       memory-region = <&vram>;

                                        port {
-                                               v2m_clcd_pads: endpoint {
-
remote-endpoint = <&v2m_clcd_panel>;
+                                               clcd_pads: endpoint {
+
remote-endpoint = <&panel_in>;

arm,pl11x,tft-r0g0b0-pads = <0 8 16>;
                                                };
                                        };
-
-                                       panel {
-                                               compatible = "panel-dpi";
-
-                                               port {
-
v2m_clcd_panel: endpoint {
-
remote-endpoint = <&v2m_clcd_pads>;
-                                                       };
-                                               };
-
-                                               panel-timing {
-
clock-frequency = <63500127>;
-                                                       hactive = <1024>;
-                                                       hback-porch = <152>;
-                                                       hfront-porch = <48>;
-                                                       hsync-len = <104>;
-                                                       vactive = <768>;
-                                                       vback-porch = <23>;
-                                                       vfront-porch = <3>;
-                                                       vsync-len = <4>;
-                                               };
-                                       };
                                };

                                virtio-block@130000 {

Yours,
Linus Walleij
Robin Murphy Oct. 18, 2018, 1:56 p.m. UTC | #3
Hi Linus,

On 18/10/18 13:27, Linus Walleij wrote:
> Having failed any attempts at a more generic solution,
> I fall back to the very specific solution: define a simple
> panel for the ARM RTSMv8 emulated platform.

 From the bits of the discussion that I've caught it does seem like this 
framebuffer-grovelling business might turn out to be fairly unique to 
RTSM/Fast Models, so I guess it's a reasonable compromise.

> I am doing this so we can convert all old users from the
> previous fbdev driver to the PL111 DRM driver.
> 
> This works fine as far as I can test, provided the
> device tree for RTSMv8 is augmented accordingly.
> 
> Cc: Sudeep Holla <sudeep.holla@arm.com>
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Cc: Liviu Dudau <liviu.dudau@arm.com>
> Cc: Mali DP Maintainers <malidp@foss.arm.com>
> Cc: Robin Murphy <robin.murphy@arm.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>   drivers/gpu/drm/panel/panel-simple.c | 30 ++++++++++++++++++++++++++++

Nit: binding doc?

>   1 file changed, 30 insertions(+)
> 
> diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
> index 97964f7f2ace..b36fb1db16fb 100644
> --- a/drivers/gpu/drm/panel/panel-simple.c
> +++ b/drivers/gpu/drm/panel/panel-simple.c
> @@ -2323,6 +2323,33 @@ static const struct panel_desc winstar_wf35ltiacd = {
>   	.bus_format = MEDIA_BUS_FMT_RGB888_1X24,
>   };
>   
> +static const struct drm_display_mode arm_rtsmv8_mode[] = {
> +	{
> +		.clock = 65000,
> +		.hdisplay = 1024,
> +		.hsync_start = 1024 + 24,
> +		.hsync_end = 1024 + 24 + 136,
> +		.htotal = 1024 + 24 + 136 + 160,
> +		.vdisplay = 768,
> +		.vsync_start = 768 + 3,
> +		.vsync_end = 768 + 3 + 6,
> +		.vtotal = 768 + 3 + 6 + 29,
> +		.vrefresh = 60,
> +		.flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
> +	},
> +};
> +
> +static const struct panel_desc arm_rtsmv8 = {
> +	.modes = arm_rtsmv8_mode,
> +	.num_modes = 1,
> +	.bpc = 8,
> +	.size = {
> +		.width = 400,
> +		.height = 300,
> +	},
> +	.bus_format = MEDIA_BUS_FMT_RGB888_1X24,
> +};
> +
>   static const struct of_device_id platform_of_match[] = {
>   	{
>   		.compatible = "ampire,am-480272h3tmqw-t01h",
> @@ -2330,6 +2357,9 @@ static const struct of_device_id platform_of_match[] = {
>   	}, {
>   		.compatible = "ampire,am800480r3tmqwa1h",
>   		.data = &ampire_am800480r3tmqwa1h,
> +	}, {
> +		.compatible = "arm,rtsmv8-display",

Nit: "arm,rtsm-display" would probably be a more accurate choice, since 
the implementation dates back to long before v8 of anything relevant ;)

Robin.

> +		.data = &arm_rtsmv8,
>   	}, {
>   		.compatible = "auo,b101aw03",
>   		.data = &auo_b101aw03,
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index 97964f7f2ace..b36fb1db16fb 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -2323,6 +2323,33 @@  static const struct panel_desc winstar_wf35ltiacd = {
 	.bus_format = MEDIA_BUS_FMT_RGB888_1X24,
 };
 
+static const struct drm_display_mode arm_rtsmv8_mode[] = {
+	{
+		.clock = 65000,
+		.hdisplay = 1024,
+		.hsync_start = 1024 + 24,
+		.hsync_end = 1024 + 24 + 136,
+		.htotal = 1024 + 24 + 136 + 160,
+		.vdisplay = 768,
+		.vsync_start = 768 + 3,
+		.vsync_end = 768 + 3 + 6,
+		.vtotal = 768 + 3 + 6 + 29,
+		.vrefresh = 60,
+		.flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
+	},
+};
+
+static const struct panel_desc arm_rtsmv8 = {
+	.modes = arm_rtsmv8_mode,
+	.num_modes = 1,
+	.bpc = 8,
+	.size = {
+		.width = 400,
+		.height = 300,
+	},
+	.bus_format = MEDIA_BUS_FMT_RGB888_1X24,
+};
+
 static const struct of_device_id platform_of_match[] = {
 	{
 		.compatible = "ampire,am-480272h3tmqw-t01h",
@@ -2330,6 +2357,9 @@  static const struct of_device_id platform_of_match[] = {
 	}, {
 		.compatible = "ampire,am800480r3tmqwa1h",
 		.data = &ampire_am800480r3tmqwa1h,
+	}, {
+		.compatible = "arm,rtsmv8-display",
+		.data = &arm_rtsmv8,
 	}, {
 		.compatible = "auo,b101aw03",
 		.data = &auo_b101aw03,