drm/panel: simple: add bus-format support for panel-dpi
Subsystems (4)
v2 cover drm/panel: simple: add bus-format support for panel-dpi
From: Max Krummenacher <[email protected]>
Commit 4a1d0dbc8332 ("drm/panel: simple: add panel-dpi support") added support for defining a panel from device tree provided data.
However support for setting the bus format is missing, so that with the current implementation a 'panel-dpi' panel can only be used if the driver of the display interface connected can cope with a missing bus_format.
This patch series defines the new property bus-format and adds it to the panel-dpi implementation.
Check initial discussions [1] and [2].
[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/
Changes in v2:
- Fix errors found by dt_binding_check
Max Krummenacher (3):
dt-bindings: display: add new bus-format property for panel-dpi
dt-bindings: display: startek,startek-kd050c: allow bus-format
property
drm/panel: simple: add bus-format support for panel-dpi
.../bindings/display/panel/panel-dpi.yaml | 11 +++++ .../display/panel/startek,startek-kd050c.yaml | 1 + drivers/gpu/drm/panel/panel-simple.c | 43 +++++++++++++++++++ .../dt-bindings/display/dt-media-bus-format.h | 23 ++++++++++ 4 files changed, 78 insertions(+) create mode 100644 include/dt-bindings/display/dt-media-bus-format.h
Signature · 1 line
2.20.1
PATCH v2 1/3 dt-bindings: display: add new bus-format property for panel-dpi
From: Max Krummenacher <[email protected]>
The property is used to set the enum bus_format and infer the bpc for a panel defined by 'panel-dpi'.
This specifies how the panel is connected to the display interface.
---
Changes in v2:
- Fix errors found by dt_binding_check
.../bindings/display/panel/panel-dpi.yaml | 11 +++++++++ .../dt-bindings/display/dt-media-bus-format.h | 23 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 include/dt-bindings/display/dt-media-bus-format.h
Documentation/devicetree/bindings/display/panel/panel-dpi.yaml +11 -0
@@ -21,6 +21,14 @@ properties: - {} - const: panel-dpi + bus-format: + $ref: /schemas/types.yaml#/definitions/uint32 + description: | + Describes how the display panel is connected to the display interface. + Valid values are defined in <dt-bindings/display/dt-media-bus-format.h>. + The mapping between the color/significance of the panel lines to the + parallel data lines are defined in [1]. + [1] https://www.kernel.org/doc/html/v5.17/userspace-api/media/v4l/subdev-formats.html#packed-rgb-formats backlight: true enable-gpios: true height-mm: true
@@ -39,11 +47,14 @@ additionalProperties: false examples: - | + #include <dt-bindings/display/dt-media-bus-format.h> + panel { compatible = "startek,startek-kd050c", "panel-dpi"; label = "osddisplay"; power-supply = <&vcc_supply>; backlight = <&backlight>; + bus-format = <DT_MEDIA_BUS_FMT_RGB888_1X24>; port { lcd_in: endpoint {
include/dt-bindings/display/dt-media-bus-format.h new file +23 -0
@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0-only OR MIT */ +/* +* Copyright 2022 Max Krummenacher <[email protected]> +*/ + +#ifndef __DT_BINDINGS_DT_MEDIA_BUS_FORMAT_H +#define __DT_BINDINGS_DT_MEDIA_BUS_FORMAT_H + +/* +* Attention: Keep these macro names in sync with +* include/uapi/linux/media-bus-format.h +*/ + +#define DT_MEDIA_BUS_FMT_RGB565_1X16 1 +#define DT_MEDIA_BUS_FMT_RGB666_1X18 2 +#define DT_MEDIA_BUS_FMT_RBG888_1X24 3 +#define DT_MEDIA_BUS_FMT_RGB666_1X24_CPADHI 4 +#define DT_MEDIA_BUS_FMT_BGR888_1X24 5 +#define DT_MEDIA_BUS_FMT_GBR888_1X24 6 +#define DT_MEDIA_BUS_FMT_RGB888_1X24 7 +#define DT_MEDIA_BUS_FMT_RGB888_1X32_PADHI 8 + +#endif /* __DT_BINDINGS_DT_MEDIA_BUS_FORMAT_H */
Signature · 1 line
2.20.1
Rob Herring
maintainerRe: [PATCH v2 1/3] dt-bindings: display: add new bus-format property for panel-dpi
Quoted 23 lines · Max Krummenacher
From: Max Krummenacher <[email protected]>
The property is used to set the enum
bus_formatand infer the bpc for a panel defined by 'panel-dpi'.
This specifies how the panel is connected to the display interface.Signed-off-by Max Krummenacher <[email protected]>---
Changes in v2:
- Fix errors found bydt_binding_check.../bindings/display/panel/panel-dpi.yaml | 11 +++++++++ .../dt-bindings/display/dt-media-bus-format.h | 23 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 include/dt-bindings/display/dt-media-bus-format.hDocumentation/devicetree/bindings/display/panel/panel-dpi.yaml +0
-0
Documentation/devicetree/bindings/display/panel/panel-dpi.yaml properties: · line 25
Quoted 5 lines
Documentation/devicetree/bindings/display/panel/panel-dpi.yaml +2
-0@@ -21,6 +21,14 @@ properties: - {} - const: panel-dpi + bus-format: + $ref: /schemas/types.yaml#/definitions/uint32
Constraints?
Documentation/devicetree/bindings/display/panel/panel-dpi.yaml properties: · line 30
Quoted 5 lines
Documentation/devicetree/bindings/display/panel/panel-dpi.yaml +5
-0+ description: | + Describes how the display panel is connected to the display interface. + Valid values are defined in <dt-bindings/display/dt-media-bus-format.h>. + The mapping between the color/significance of the panel lines to the + parallel data lines are defined in [1].
Just drop the [1] and use a colon.
Documentation/devicetree/bindings/display/panel/panel-dpi.yaml properties: · line 31
Quoted 1 line
Documentation/devicetree/bindings/display/panel/panel-dpi.yaml +1
-0+ [1] https://www.kernel.org/doc/html/v5.17/userspace-api/media/v4l/subdev-formats.html#packed-rgb-formats
Why not just use the V4L number space rather than invent yet another number space?
Need a blank line here too.
Quoted 5 lines
Documentation/devicetree/bindings/display/panel/panel-dpi.yaml +0
-0backlight: true enable-gpios: true height-mm: true@@ -39,11 +47,14 @@ additionalProperties: false
Documentation/devicetree/bindings/display/panel/panel-dpi.yaml additionalProperties: false · line 57
Quoted 10 lines
Documentation/devicetree/bindings/display/panel/panel-dpi.yaml +3
-0examples: - | + #include <dt-bindings/display/dt-media-bus-format.h> + panel { compatible = "startek,startek-kd050c", "panel-dpi"; label = "osddisplay"; power-supply = <&vcc_supply>; backlight = <&backlight>; + bus-format = <DT_MEDIA_BUS_FMT_RGB888_1X24>;
Other properties describing the interface have been put in the endpoint node. This should too I think.
Quoted 36 lines
Documentation/devicetree/bindings/display/panel/panel-dpi.yaml +0
-0port { lcd_in: endpoint {include/dt-bindings/display/dt-media-bus-format.h new file +23
-0@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0-only OR MIT */ +/* +* Copyright 2022 Max Krummenacher <[email protected]> +*/ + +#ifndef __DT_BINDINGS_DT_MEDIA_BUS_FORMAT_H +#define __DT_BINDINGS_DT_MEDIA_BUS_FORMAT_H + +/* +* Attention: Keep these macro names in sync with +* include/uapi/linux/media-bus-format.h +*/ + +#define DT_MEDIA_BUS_FMT_RGB565_1X16 1 +#define DT_MEDIA_BUS_FMT_RGB666_1X18 2 +#define DT_MEDIA_BUS_FMT_RBG888_1X24 3 +#define DT_MEDIA_BUS_FMT_RGB666_1X24_CPADHI 4 +#define DT_MEDIA_BUS_FMT_BGR888_1X24 5 +#define DT_MEDIA_BUS_FMT_GBR888_1X24 6 +#define DT_MEDIA_BUS_FMT_RGB888_1X24 7 +#define DT_MEDIA_BUS_FMT_RGB888_1X32_PADHI 8 + +#endif /* __DT_BINDINGS_DT_MEDIA_BUS_FORMAT_H */ Signature · 1 line
2.20.1
Re: [PATCH v2 1/3] dt-bindings: display: add new bus-format property for panel-dpi
Hi Rob
Thanks for the feedback.
Quoted 28 lines · Rob Herring
Quoted 26 lines · Max Krummenacher
From: Max Krummenacher <[email protected]>
The property is used to set the enum
bus_formatand infer the bpc for a panel defined by 'panel-dpi'.
This specifies how the panel is connected to the display interface.Signed-off-by Max Krummenacher <[email protected]>---
Changes in v2:
- Fix errors found bydt_binding_check.../bindings/display/panel/panel-dpi.yaml | 11 +++++++++ .../dt-bindings/display/dt-media-bus-format.h | 23 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 include/dt-bindings/display/dt-media-bus-format.hDocumentation/devicetree/bindings/display/panel/panel-dpi.yaml +0
-0@@ -21,6 +21,14 @@ properties: - {} - const: panel-dpi
Quoted 4 lines
Documentation/devicetree/bindings/display/panel/panel-dpi.yaml properties: · line 25
Quoted 2 lines
Documentation/devicetree/bindings/display/panel/panel-dpi.yaml +2
-0+ bus-format: + $ref: /schemas/types.yaml#/definitions/uint32Constraints?
Will limit the range to the one used for RGB formats in v3.
Quoted 8 lines
Documentation/devicetree/bindings/display/panel/panel-dpi.yaml properties: · line 30
Quoted 6 lines
Documentation/devicetree/bindings/display/panel/panel-dpi.yaml +5
-0+ description: | + Describes how the display panel is connected to the display interface. + Valid values are defined in <dt-bindings/display/dt-media-bus-format.h>. + The mapping between the color/significance of the panel lines to the + parallel data lines are defined in [1].Just drop the [1] and use a colon.
Done in v3.
Quoted 5 lines
Documentation/devicetree/bindings/display/panel/panel-dpi.yaml properties: · line 31
Quoted 2 lines
Documentation/devicetree/bindings/display/panel/panel-dpi.yaml +1
-0+ [1] https://www.kernel.org/doc/html/v5.17/userspace-api/media/v4l/subdev-formats.html#packed-rgb-formatsWhy not just use the V4L number space rather than invent yet another number space?
That was a proposal from here:
https://lore.kernel.org/all/20220323155817.xcsqxothziot7ba3@houat/
But probably it makes more sense to use the number space as is, changed in v3.
Quoted 8 lines
Need a blank line here too.
Quoted 5 lines
Documentation/devicetree/bindings/display/panel/panel-dpi.yaml +0
-0backlight: true enable-gpios: true height-mm: true@@ -39,11 +47,14 @@ additionalProperties: false
Quoted 13 lines
Documentation/devicetree/bindings/display/panel/panel-dpi.yaml additionalProperties: false · line 57
Quoted 10 lines
Documentation/devicetree/bindings/display/panel/panel-dpi.yaml +3
-0examples: - | + #include <dt-bindings/display/dt-media-bus-format.h> + panel { compatible = "startek,startek-kd050c", "panel-dpi"; label = "osddisplay"; power-supply = <&vcc_supply>; backlight = <&backlight>; + bus-format = <DT_MEDIA_BUS_FMT_RGB888_1X24>;Other properties describing the interface have been put in the endpoint node. This should too I think.
That makes a lot of sense. Changed to be part of the endpoint node in v3.
Cheers
Max
Quoted 37 lines
Quoted 37 lines
Documentation/devicetree/bindings/display/panel/panel-dpi.yaml +0
-0port { lcd_in: endpoint {include/dt-bindings/display/dt-media-bus-format.h new file +23
-1@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0-only OR MIT */ +/* +* Copyright 2022 Max Krummenacher <[email protected]> +*/ + +#ifndef __DT_BINDINGS_DT_MEDIA_BUS_FORMAT_H +#define __DT_BINDINGS_DT_MEDIA_BUS_FORMAT_H + +/* +* Attention: Keep these macro names in sync with +* include/uapi/linux/media-bus-format.h +*/ + +#define DT_MEDIA_BUS_FMT_RGB565_1X16 1 +#define DT_MEDIA_BUS_FMT_RGB666_1X18 2 +#define DT_MEDIA_BUS_FMT_RBG888_1X24 3 +#define DT_MEDIA_BUS_FMT_RGB666_1X24_CPADHI 4 +#define DT_MEDIA_BUS_FMT_BGR888_1X24 5 +#define DT_MEDIA_BUS_FMT_GBR888_1X24 6 +#define DT_MEDIA_BUS_FMT_RGB888_1X24 7 +#define DT_MEDIA_BUS_FMT_RGB888_1X32_PADHI 8 + +#endif /* __DT_BINDINGS_DT_MEDIA_BUS_FORMAT_H */ --2.20.1
PATCH v2 2/3 dt-bindings: display: startek,startek-kd050c: allow bus-format property
In reply to Max KrummenacherFrom: Max Krummenacher <[email protected]>
Allow to specify the optional bus-format property newly added to panel-dpi.
---
Changes in v2:
- New commit
.../bindings/display/panel/startek,startek-kd050c.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/display/panel/startek,startek-kd050c.yaml +1 -0
@@ -19,6 +19,7 @@ properties: - {} # panel-dpi, but not listed here to avoid false select backlight: true + bus-format: true enable-gpios: true height-mm: true label: true
Signature · 1 line
2.20.1
PATCH v2 3/3 drm/panel: simple: add bus-format support for panel-dpi
In reply to Max KrummenacherFrom: Max Krummenacher <[email protected]>
Evaluate the device tree bus-format property to set bus_format for a 'panel-dpi' panel. Additionally infer the bpc value from the given bus-format.
Valid values for bus-format are found in:
<include/dt-bindings/display/dt-media-bus-format.h>
This completes the addition of panel-dpi to completely specify a panel-simple panel from the device tree.
---
Changes in v2:
None
drivers/gpu/drm/panel/panel-simple.c | 43 ++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)
drivers/gpu/drm/panel/panel-simple.c +43 -0
@@ -21,6 +21,7 @@* DEALINGS IN THE SOFTWARE. */ +#include <dt-bindings/display/dt-media-bus-format.h> #include <linux/delay.h> #include <linux/gpio/consumer.h> #include <linux/module.h>
@@ -453,6 +454,7 @@ static int panel_dpi_probe(struct device *dev,struct panel_desc *desc;unsigned int bus_flags;struct videomode vm; +u32 bus_format;int ret; np = dev->of_node;
@@ -477,6 +479,47 @@ static int panel_dpi_probe(struct device *dev,of_property_read_u32 (np,"width-mm" , &desc->size.width);of_property_read_u32 (np,"height-mm" , &desc->size.height); +if (!of_property_read_u32 (np,"bus-format" , &bus_format)) { +/* infer bpc from bus-format */ +switch (bus_format) { +case DT_MEDIA_BUS_FMT_RGB565_1X16 : + desc->bus_format =MEDIA_BUS_FMT_RGB565_1X16 ; + desc->bpc =6 ; +break ; +case DT_MEDIA_BUS_FMT_RGB666_1X18 : + desc->bus_format =MEDIA_BUS_FMT_RGB666_1X18 ; + desc->bpc =6 ; +break ; +case DT_MEDIA_BUS_FMT_RGB666_1X24_CPADHI : + desc->bus_format =MEDIA_BUS_FMT_RGB666_1X24_CPADHI ; + desc->bpc =6 ; +break ; +case DT_MEDIA_BUS_FMT_BGR888_1X24 : + desc->bus_format =MEDIA_BUS_FMT_BGR888_1X24 ; + desc->bpc =8 ; +break ; +case DT_MEDIA_BUS_FMT_GBR888_1X24 : + desc->bus_format =MEDIA_BUS_FMT_GBR888_1X24 ; + desc->bpc =8 ; +break ; +case DT_MEDIA_BUS_FMT_RBG888_1X24 : + desc->bus_format =MEDIA_BUS_FMT_RBG888_1X24 ; + desc->bpc =8 ; +break ; +case DT_MEDIA_BUS_FMT_RGB888_1X24 : + desc->bus_format =MEDIA_BUS_FMT_RGB888_1X24 ; + desc->bpc =8 ; +break ; +case DT_MEDIA_BUS_FMT_RGB888_1X32_PADHI : + desc->bus_format =MEDIA_BUS_FMT_RGB888_1X32_PADHI ; + desc->bpc =8 ; +break ; +default : +dev_err (dev,"%pOF: unknown bus-format property\n" , np); +return -EINVAL ; + } + } +/* Extract bus_flags from display_timing */ bus_flags =0 ; vm.flags = timing->flags;
Signature · 1 line
2.20.1