2021-09-28 12:18:23

by Guido Günther

[permalink] [raw]
Subject: [PATCH v1 0/5] mxsfb/nwl/panels: media bus format fixes

commit b776b0f00f24 ("drm: mxsfb: Use bus_format from the nearest bridge if
present") added bus format probing to mxsfb this exposed several issues in the
display stack as used on the Librem 5:

The nwl bridge and the panels didn't bother to set any media bus formats and in
that case mxsfb would not pick a reasonable default. This series aims to fix
this.

This series includes the patch from
https://lore.kernel.org/dri-devel/YVLYh%2FSgBritG%[email protected]/
with a `dev_warn` added.

The patches are against 5.15-rc3. I've marked a single patch with a 'fixes'
which is enough to unbreak the display stack in 5.15.


Guido Günther (5):
drm: mxsfb: Print failed bus format in hex
drm: mxsfb: Set proper default bus format when using a bridge
drm/bridge: nwl-dsi: Add atomic_get_input_bus_fmts
drm/panel: mantix: Add media bus format
drm/panel: st7703: Add media bus format

drivers/gpu/drm/bridge/nwl-dsi.c | 35 +++++++++++++++++++
drivers/gpu/drm/mxsfb/mxsfb_kms.c | 7 +++-
.../gpu/drm/panel/panel-mantix-mlaf057we51.c | 9 +++++
drivers/gpu/drm/panel/panel-sitronix-st7703.c | 8 +++++
4 files changed, 58 insertions(+), 1 deletion(-)

--
2.33.0


2021-09-28 12:18:34

by Guido Günther

[permalink] [raw]
Subject: [PATCH v1 1/5] drm: mxsfb: Print failed bus format in hex

media-bus-formats.h has them in hexadecimal as well so matching with
that file saves one conversion when debugging.

Signed-off-by: Guido Günther <[email protected]>
---
drivers/gpu/drm/mxsfb/mxsfb_kms.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/mxsfb/mxsfb_kms.c b/drivers/gpu/drm/mxsfb/mxsfb_kms.c
index af6c620adf6e..d6abd2077114 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_kms.c
+++ b/drivers/gpu/drm/mxsfb/mxsfb_kms.c
@@ -89,7 +89,7 @@ static void mxsfb_set_formats(struct mxsfb_drm_private *mxsfb,
ctrl |= CTRL_BUS_WIDTH_24;
break;
default:
- dev_err(drm->dev, "Unknown media bus format %d\n", bus_format);
+ dev_err(drm->dev, "Unknown media bus format 0x%x\n", bus_format);
break;
}

--
2.33.0

2021-09-28 12:18:50

by Guido Günther

[permalink] [raw]
Subject: [PATCH v1 4/5] drm/panel: mantix: Add media bus format

This allows the DSI bridge to detect the correct bus format.
We currently only support MEDIA_BUS_FMT_RGB888_1X24.

Signed-off-by: Guido Günther <[email protected]>
---
drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c b/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c
index f0e9bce23c41..d6bcf1045255 100644
--- a/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c
+++ b/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c
@@ -8,6 +8,7 @@
#include <linux/backlight.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
+#include <linux/media-bus-format.h>
#include <linux/module.h>
#include <linux/of_device.h>
#include <linux/regulator/consumer.h>
@@ -232,6 +233,10 @@ static const struct drm_display_mode default_mode_ys = {
.height_mm = 130,
};

+static const u32 mantix_bus_formats[] = {
+ MEDIA_BUS_FMT_RGB888_1X24,
+};
+
static int mantix_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
@@ -253,6 +258,10 @@ static int mantix_get_modes(struct drm_panel *panel,
connector->display_info.height_mm = mode->height_mm;
drm_mode_probed_add(connector, mode);

+ drm_display_info_set_bus_formats(&connector->display_info,
+ mantix_bus_formats,
+ ARRAY_SIZE(mantix_bus_formats));
+
return 1;
}

--
2.33.0

2021-09-28 12:19:22

by Guido Günther

[permalink] [raw]
Subject: [PATCH v1 5/5] drm/panel: st7703: Add media bus format

This allows the DSI bridge to detect the correct bus format.
We currently only support MEDIA_BUS_FMT_RGB888_1X24.

Signed-off-by: Guido Günther <[email protected]>
---
drivers/gpu/drm/panel/panel-sitronix-st7703.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
index a2c303e5732c..73f69c929a75 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
@@ -453,6 +453,10 @@ static int st7703_prepare(struct drm_panel *panel)
return ret;
}

+static const u32 mantix_bus_formats[] = {
+ MEDIA_BUS_FMT_RGB888_1X24,
+};
+
static int st7703_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
@@ -474,6 +478,10 @@ static int st7703_get_modes(struct drm_panel *panel,
connector->display_info.height_mm = mode->height_mm;
drm_mode_probed_add(connector, mode);

+ drm_display_info_set_bus_formats(&connector->display_info,
+ mantix_bus_formats,
+ ARRAY_SIZE(mantix_bus_formats));
+
return 1;
}

--
2.33.0

2021-10-06 14:39:35

by Robert Foss

[permalink] [raw]
Subject: Re: [PATCH v1 1/5] drm: mxsfb: Print failed bus format in hex

On Tue, 28 Sept 2021 at 14:16, Guido Günther <[email protected]> wrote:
>
> media-bus-formats.h has them in hexadecimal as well so matching with
> that file saves one conversion when debugging.
>
> Signed-off-by: Guido Günther <[email protected]>
> ---
> drivers/gpu/drm/mxsfb/mxsfb_kms.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/mxsfb/mxsfb_kms.c b/drivers/gpu/drm/mxsfb/mxsfb_kms.c
> index af6c620adf6e..d6abd2077114 100644
> --- a/drivers/gpu/drm/mxsfb/mxsfb_kms.c
> +++ b/drivers/gpu/drm/mxsfb/mxsfb_kms.c
> @@ -89,7 +89,7 @@ static void mxsfb_set_formats(struct mxsfb_drm_private *mxsfb,
> ctrl |= CTRL_BUS_WIDTH_24;
> break;
> default:
> - dev_err(drm->dev, "Unknown media bus format %d\n", bus_format);
> + dev_err(drm->dev, "Unknown media bus format 0x%x\n", bus_format);
> break;
> }

Reviewed-by: Robert Foss <[email protected]>