drm/tiny: Add MIPI DBI compatible SPI driver
Subsystems (5)
v5 cover drm/tiny: Add MIPI DBI compatible SPI driver
Hi,
This patchset adds a driver that will work with most MIPI DBI compatible SPI panels out there.
It can replace the SPI interface support in these drivers:
$ grep -lr MIPI_DCS drivers/staging/fbtft/ | grep -v "-" | uniq | sort drivers/staging/fbtft/fb_hx8340bn.c drivers/staging/fbtft/fb_hx8353d.c drivers/staging/fbtft/fb_hx8357d.c drivers/staging/fbtft/fb_ili9163.c drivers/staging/fbtft/fb_ili9340.c drivers/staging/fbtft/fb_ili9341.c drivers/staging/fbtft/fb_ili9481.c drivers/staging/fbtft/fb_ili9486.c drivers/staging/fbtft/fb_s6d02a1.c drivers/staging/fbtft/fb_st7735r.c drivers/staging/fbtft/fb_st7789v.c drivers/staging/fbtft/fb_tinylcd.c
Note that the MIPI DBI parallel interface supported by fbtft does not yet exist in DRM.
Maxime gave[1] a good overview of the situation with these displays and proposed to make a driver that works with all MIPI DBI compatible controllers and use a firmware file to provide the controller setup for a particular panel.
Changes since version 4:
- Add sainsmart18 to compatible items (Rob)
- Expand write-only description (Sam)
- kconfig: s/DRM_KMS_CMA_HELPER/DRM_GEM_CMA_HELPER/ (Sam)
- kconfig: Add select VIDEOMODE_HELPERS (Sam)
- kconfig: Add wiki url in the description (Sam)
- Split out and use of_get_drm_panel_display_mode()(Sam)
- Only use the first compatible to look for a firmware file since the binding mandates 2 compatibles.
- Make having a firmware file mandatory so we can print an error message if it's missing to improve the user experience. It's very unlikely that a controller doesn't need to be initialized and if it doesn't, it's possible to have a firmware file containing only a DCS NOP.
See wiki[2] for a script to make command firmware files.
Noralf.
[1] https://lore.kernel.org/dri-devel/20211129093946.xhp22mvdut3m67sc@houat/
[2] https://github.com/notro/panel-mipi-dbi/wiki
Noralf Trønnes (5):
dt-bindings: display: add bindings for MIPI DBI compatible SPI panels drm/modes: Remove trailing whitespace
drm/modes: Add of_get_drm_panel_display_mode() drm/mipi-dbi: Add driver_private member to struct mipi_dbi_dev drm/tiny: Add MIPI DBI compatible SPI driver
.../display/panel/panel-mipi-dbi-spi.yaml | 127 ++++++ MAINTAINERS | 8 + drivers/gpu/drm/drm_modes.c | 51 ++- drivers/gpu/drm/tiny/Kconfig | 15 + drivers/gpu/drm/tiny/Makefile | 1 + drivers/gpu/drm/tiny/panel-mipi-dbi.c | 398 ++++++++++++++++++ include/drm/drm_mipi_dbi.h | 8 + include/drm/drm_modes.h | 8 + 8 files changed, 615 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/display/panel/panel-mipi-dbi-spi.yaml create mode 100644 drivers/gpu/drm/tiny/panel-mipi-dbi.c
Signature · 1 line
2.33.0
PATCH v5 1/5 dt-bindings: display: add bindings for MIPI DBI compatible SPI panels
Add binding for MIPI DBI compatible SPI panels.
v5:
- Add sainsmart18 to compatible items (Rob)
- Expand write-only description (Sam)
v4:
- There should only be two compatible (Maxime)
- s/panel-dbi-spi/panel-mipi-dbi-spi/in compatible
v3:
- Move properties to Device Tree (Maxime)
- Use contains for compatible (Maxime)
- Add backlight property to example
- Flesh out description
v2:
- Fix path for panel-common.yaml
- Use unevaluatedProperties
- Drop properties which are in the allOf section
- Drop model property (Rob)
--- .../display/panel/panel-mipi-dbi-spi.yaml | 127 ++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/panel-mipi-dbi-spi.yaml
Documentation/devicetree/bindings/display/panel/panel-mipi-dbi-spi.yaml new file +127 -0
@@ -0,0 +1,127 @@ +# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/panel/panel-mipi-dbi-spi.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: MIPI DBI SPI Panel + +maintainers: + - Noralf Trønnes <[email protected]> + +description: | + This binding is for display panels using a MIPI DBI compatible controller + in SPI mode. + + The MIPI Alliance Standard for Display Bus Interface defines the electrical + and logical interfaces for display controllers historically used in mobile + phones. The standard defines 4 display architecture types and this binding is + for type 1 which has full frame memory. There are 3 interface types in the + standard and type C is the serial interface. + + The standard defines the following interface signals for type C: + - Power: + - Vdd: Power supply for display module + - Vddi: Logic level supply for interface signals + Combined into one in this binding called: power-supply + - Interface: + - CSx: Chip select + - SCL: Serial clock + - Dout: Serial out + - Din: Serial in + - SDA: Bidrectional in/out + - D/CX: Data/command selection, high=data, low=command + Called dc-gpios in this binding. + - RESX: Reset when low + Called reset-gpios in this binding. + + The type C interface has 3 options: + + - Option 1: 9-bit mode and D/CX as the 9th bit + | Command | the next command or following data | + |<0><D7><D6><D5><D4><D3><D2><D1><D0>|<D/CX><D7><D6><D5><D4><D3><D2><D1><D0>| + + - Option 2: 16-bit mode and D/CX as a 9th bit + | Command or data | + |<X><X><X><X><X><X><X><D/CX><D7><D6><D5><D4><D3><D2><D1><D0>| + + - Option 3: 8-bit mode and D/CX as a separate interface line + | Command or data | + |<D7><D6><D5><D4><D3><D2><D1><D0>| + + The panel resolution is specified using the panel-timing node properties + hactive (width) and vactive (height). The other mandatory panel-timing + properties should be set to zero except clock-frequency which can be + optionally set to inform about the actual pixel clock frequency. + + If the panel is wired to the controller at an offset specify this using + hback-porch (x-offset) and vback-porch (y-offset). + +allOf: + - $ref: panel-common.yaml# + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +properties: + compatible: + items: + - enum: + - sainsmart18 + - const: panel-mipi-dbi-spi + + write-only: + type: boolean + description: + Controller is not readable (ie. Din (MISO on the SPI interface) is not + wired up). + + dc-gpios: + maxItems: 1 + description: | + Controller data/command selection (D/CX) in 4-line SPI mode. + If not set, the controller is in 3-line SPI mode. + +required: + - compatible + - reg + - panel-timing + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + + spi { + #address-cells = <1>; + #size-cells = <0>; + + display@0{ + compatible = "sainsmart18", "panel-mipi-dbi-spi"; + reg = <0>; + spi-max-frequency = <40000000>; + + dc-gpios = <&gpio 24 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpio 25 GPIO_ACTIVE_HIGH>; + write-only; + + backlight = <&backlight>; + + width-mm = <35>; + height-mm = <28>; + + panel-timing { + hactive = <160>; + vactive = <128>; + hback-porch = <0>; + vback-porch = <0>; + + clock-frequency = <0>; + hfront-porch = <0>; + hsync-len = <0>; + vfront-porch = <0>; + vsync-len = <0>; + }; + }; + }; + +...
Signature · 1 line
2.33.0
Rob Herring
maintainerRe: [PATCH v5 1/5] dt-bindings: display: add bindings for MIPI DBI compatible SPI panels
Quoted 22 lines · Noralf Trønnes
Add binding for MIPI DBI compatible SPI panels.
v5:
- Add sainsmart18 to compatible items (Rob)
- Expand write-only description (Sam)v4:
- There should only be two compatible (Maxime)
- s/panel-dbi-spi/panel-mipi-dbi-spi/in compatiblev3:
- Move properties to Device Tree (Maxime)
- Use contains for compatible (Maxime)
- Add backlight property to example
- Flesh out descriptionv2:
- Fix path forpanel-common.yaml
- Use unevaluatedProperties
- Drop properties which are in the allOf section
- Drop model property (Rob)
Quoted 8 lines
Acked-by Maxime Ripard <[email protected]>Acked-by Sam Ravnborg <[email protected]>Signed-off-by Noralf Trønnes <[email protected]>--- .../display/panel/panel-mipi-dbi-spi.yaml | 127 ++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/panel-mipi-dbi-spi.yaml
My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):
yamllint warnings/errors:./Documentation/devicetree/bindings/display/panel/panel-mipi-dbi-spi.yaml:68:9: [warning] wrong indentation: expected 10 but found 8 (indentation)
dtschema/dtc warnings/errors:
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/patch/1597203
This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit.
Re: [PATCH v5 1/5] dt-bindings: display: add bindings for MIPI DBI compatible SPI panels
In reply to Noralf TrønnesQuoted 139 lines · Noralf Trønnes
Add binding for MIPI DBI compatible SPI panels.
v5:
- Add sainsmart18 to compatible items (Rob)
- Expand write-only description (Sam)v4:
- There should only be two compatible (Maxime)
- s/panel-dbi-spi/panel-mipi-dbi-spi/in compatiblev3:
- Move properties to Device Tree (Maxime)
- Use contains for compatible (Maxime)
- Add backlight property to example
- Flesh out descriptionv2:
- Fix path forpanel-common.yaml
- Use unevaluatedProperties
- Drop properties which are in the allOf section
- Drop model property (Rob)Acked-by Maxime Ripard <[email protected]>Acked-by Sam Ravnborg <[email protected]>Signed-off-by Noralf Trønnes <[email protected]>--- .../display/panel/panel-mipi-dbi-spi.yaml | 127 ++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/panel-mipi-dbi-spi.yamlDocumentation/devicetree/bindings/display/panel/panel-mipi-dbi-spi.yaml new file +103
-0@@ -0,0 +1,127 @@ +# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/panel/panel-mipi-dbi-spi.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: MIPI DBI SPI Panel + +maintainers: + - Noralf Trønnes <[email protected]> + +description: | + This binding is for display panels using a MIPI DBI compatible controller + in SPI mode. + + The MIPI Alliance Standard for Display Bus Interface defines the electrical + and logical interfaces for display controllers historically used in mobile + phones. The standard defines 4 display architecture types and this binding is + for type 1 which has full frame memory. There are 3 interface types in the + standard and type C is the serial interface. + + The standard defines the following interface signals for type C: + - Power: + - Vdd: Power supply for display module + - Vddi: Logic level supply for interface signals + Combined into one in this binding called: power-supply + - Interface: + - CSx: Chip select + - SCL: Serial clock + - Dout: Serial out + - Din: Serial in + - SDA: Bidrectional in/out + - D/CX: Data/command selection, high=data, low=command + Called dc-gpios in this binding. + - RESX: Reset when low + Called reset-gpios in this binding. + + The type C interface has 3 options: + + - Option 1: 9-bit mode and D/CX as the 9th bit + | Command | the next command or following data | + |<0><D7><D6><D5><D4><D3><D2><D1><D0>|<D/CX><D7><D6><D5><D4><D3><D2><D1><D0>| + + - Option 2: 16-bit mode and D/CX as a 9th bit + | Command or data | + |<X><X><X><X><X><X><X><D/CX><D7><D6><D5><D4><D3><D2><D1><D0>| + + - Option 3: 8-bit mode and D/CX as a separate interface line + | Command or data | + |<D7><D6><D5><D4><D3><D2><D1><D0>| + + The panel resolution is specified using the panel-timing node properties + hactive (width) and vactive (height). The other mandatory panel-timing + properties should be set to zero except clock-frequency which can be + optionally set to inform about the actual pixel clock frequency. + + If the panel is wired to the controller at an offset specify this using + hback-porch (x-offset) and vback-porch (y-offset). + +allOf: + - $ref: panel-common.yaml# + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +properties: + compatible: + items: + - enum: + - sainsmart18 + - const: panel-mipi-dbi-spi + + write-only: + type: boolean + description: + Controller is not readable (ie. Din (MISO on the SPI interface) is not + wired up). + + dc-gpios: + maxItems: 1 + description: | + Controller data/command selection (D/CX) in 4-line SPI mode. + If not set, the controller is in 3-line SPI mode. + +required: + - compatible + - reg + - panel-timing + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + + spi { + #address-cells = <1>; + #size-cells = <0>; + + display@0{ + compatible = "sainsmart18", "panel-mipi-dbi-spi"; + reg = <0>; + spi-max-frequency = <40000000>; + + dc-gpios = <&gpio 24 GPIO_ACTIVE_HIGH>;
Documentation/devicetree/bindings/display/panel/panel-mipi-dbi-spi.yaml line 113
Quoted 10 lines
Documentation/devicetree/bindings/display/panel/panel-mipi-dbi-spi.yaml new file +10
-0+ reset-gpios = <&gpio 25 GPIO_ACTIVE_HIGH>; + write-only; + + backlight = <&backlight>; + + width-mm = <35>; + height-mm = <28>; + + panel-timing { + hactive = <160>;
The indentation is inconsistent here. I'd suggest using 4 spaces for each level.
With that and yamllint fix,
Documentation/devicetree/bindings/display/panel/panel-mipi-dbi-spi.yaml line 122
Quoted 9 lines
Documentation/devicetree/bindings/display/panel/panel-mipi-dbi-spi.yaml new file +9
-0+ vactive = <128>; + hback-porch = <0>; + vback-porch = <0>; + + clock-frequency = <0>; + hfront-porch = <0>; + hsync-len = <0>; + vfront-porch = <0>; + vsync-len = <0>;
0 doesn't make much sense here.
If most of this is n/a and just populated to satisfy the schema, we should probably make all these optional. Anyway, that's a separate issue to address.
Rob
PATCH v5 2/5 drm/modes: Remove trailing whitespace
In reply to Noralf TrønnesRemove trailing whitespace from a comment.
--- drivers/gpu/drm/drm_modes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_modes.c +1 -1
@@ -127,7 +127,7 @@ EXPORT_SYMBOL(drm_mode_probed_add);* according to the hdisplay, vdisplay, vrefresh. * It is based from the VESA(TM) Coordinated Video Timing Generator by * Graham Loveridge April 9, 2003 available at -* http://www.elo.utfsm.cl/~elo212/docs/CVTd6r1.xls +* http://www.elo.utfsm.cl/~elo212/docs/CVTd6r1.xls * * And it is copied from xf86CVTmode in xserver/hw/xfree86/modes/xf86cvt.c. * What I have done is to translate it by using integer calculation.
Signature · 1 line
2.33.0
Re: [PATCH v5 2/5] drm/modes: Remove trailing whitespace
Quoted 3 lines · Noralf Trønnes
Remove trailing whitespace from a comment.
Signed-off-by Noralf Trønnes <[email protected]>
Quoted 19 lines
--- drivers/gpu/drm/drm_modes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/drm_modes.c +1
-1@@ -127,7 +127,7 @@ EXPORT_SYMBOL(drm_mode_probed_add);* according to the hdisplay, vdisplay, vrefresh. * It is based from the VESA(TM) Coordinated Video Timing Generator by * Graham Loveridge April 9, 2003 available at -* http://www.elo.utfsm.cl/~elo212/docs/CVTd6r1.xls +* http://www.elo.utfsm.cl/~elo212/docs/CVTd6r1.xls * * And it is copied from xf86CVTmode in xserver/hw/xfree86/modes/xf86cvt.c. * What I have done is to translate it by using integer calculation. Signature · 1 line
2.33.0
PATCH v5 3/5 drm/modes: Add of_get_drm_panel_display_mode()
In reply to Noralf TrønnesAdd a function to get a drm_display_mode from a panel-timing device tree subnode.
--- drivers/gpu/drm/drm_modes.c | 49 +++++++++++++++++++++++++++++++++++++ include/drm/drm_modes.h | 8 ++++++ 2 files changed, 57 insertions(+)
drivers/gpu/drm/drm_modes.c +49 -0
@@ -35,6 +35,7 @@#include <linux/list_sort.h> #include <linux/export.h> +#include <video/of_display_timing.h> #include <video/of_videomode.h> #include <video/videomode.h>
@@ -727,6 +728,54 @@ int of_get_drm_display_mode(struct device_node *np,return 0 ; }EXPORT_SYMBOL_GPL (of_get_drm_display_mode); + +/** +* of_get_drm_panel_display_mode - get a panel-timing drm_display_mode from devicetree +* @np: device_node with the panel-timing specification +* @dmode: will be set to the return value +* @bus_flags: information about pixelclk, sync and DE polarity +* +* The Device Tree properties width-mm and height-mm will be read and set on +* the display mode if they are present. +* +* Returns: +* Zero on success, negative error code on failure. +*/ +int of_get_drm_panel_display_mode (struct device_node *np, +struct drm_display_mode *dmode,u32 *bus_flags) +{ +u32 width_mm =0 , height_mm =0 ; +struct display_timing timing; +struct videomode vm; +int ret; + + ret =of_get_display_timing (np,"panel-timing" , &timing); +if (ret) +return ret; + +videomode_from_timing (&timing, &vm); + +memset (dmode,0 ,sizeof (*dmode)); +drm_display_mode_from_videomode (&vm, dmode); +if (bus_flags) +drm_bus_flags_from_videomode (&vm, bus_flags); + + ret =of_property_read_u32 (np,"width-mm" , &width_mm); +if (ret && ret != -EINVAL ) +return ret; + + ret =of_property_read_u32 (np,"height-mm" , &height_mm); +if (ret && ret != -EINVAL ) +return ret; + + dmode->width_mm = width_mm; + dmode->height_mm = height_mm; + +drm_mode_debug_printmodeline (dmode); + +return 0 ; +} +EXPORT_SYMBOL_GPL (of_get_drm_panel_display_mode);#endif /* CONFIG_OF */ #endif /* CONFIG_VIDEOMODE_HELPERS */
include/drm/drm_modes.h +8 -0
@@ -466,6 +466,8 @@ void drm_bus_flags_from_videomode(const struct videomode *vm, u32 *bus_flags);int of_get_drm_display_mode (struct device_node *np,struct drm_display_mode *dmode,u32 *bus_flags,int index); +int of_get_drm_panel_display_mode (struct device_node *np, +struct drm_display_mode *dmode,u32 *bus_flags);#else static inline int of_get_drm_display_mode(struct device_node *np, struct drm_display_mode *dmode,
@@ -473,6 +475,12 @@ static inline int of_get_drm_display_mode(struct device_node *np, {return -EINVAL ; } + +static inline int of_get_drm_panel_display_mode (struct device_node *np, +struct drm_display_mode *dmode,u32 *bus_flags) +{ +return -EINVAL ; +}#endif void drm_mode_set_name (struct drm_display_mode *mode);
Signature · 1 line
2.33.0
Re: [PATCH v5 3/5] drm/modes: Add of_get_drm_panel_display_mode()
Quoted 2 lines · Noralf Trønnes
Add a function to get a
drm_display_modefrom a panel-timing device tree subnode.
Thanks for implementing this!
Quoted 3 lines
Suggested-by Sam Ravnborg <[email protected]>Signed-off-by Noralf Trønnes <[email protected]>
PATCH v5 4/5 drm/mipi-dbi: Add driver_private member to struct mipi_dbi_dev
In reply to Noralf Trønnesdevm_drm_dev_alloc() can't allocate structures that embed a structure which then again embeds drm_device. Workaround this by adding a driver_private pointer to struct mipi_dbi_dev which the driver can use for its additional state.
v3:
- Add documentation
--- include/drm/drm_mipi_dbi.h | 8 ++++++++ 1 file changed, 8 insertions(+)
include/drm/drm_mipi_dbi.h +8 -0
@@ -130,6 +130,14 @@ struct mipi_dbi_dev {* @dbi: MIPI DBI interface */ struct mipi_dbi dbi; + +/** +* @driver_private: Driver private data. +* Necessary for drivers with private data since devm_drm_dev_alloc() +* can't allocate structures that embed a structure which then again +* embeds drm_device. +*/ +void *driver_private; };static inline struct mipi_dbi_dev *drm_to_mipi_dbi_dev (struct drm_device *drm)
Signature · 1 line
2.33.0
PATCH v5 5/5 drm/tiny: Add MIPI DBI compatible SPI driver
In reply to Noralf TrønnesAdd a driver that will work with most MIPI DBI compatible SPI panels. This avoids adding a driver for every new MIPI DBI compatible controller that is to be used by Linux. The 'compatible' Device Tree property with a '.bin' suffix will be used to load a firmware file that contains the controller configuration.
Example (driver will load sainsmart18.bin):
display@0 {
compatible = "sainsmart18", "panel-mipi-dbi-spi";...
};
v5:
- kconfig: s/DRM_KMS_CMA_HELPER/DRM_GEM_CMA_HELPER/ (Sam)
- kconfig: Add select VIDEOMODE_HELPERS (Sam)
- kconfig: Add wiki url in the description (Sam)
- Split out and use of_get_drm_panel_display_mode()(Sam)
- Only use the first compatible to look for a firmware file since the binding mandates 2 compatibles.
- Make having a firmware file mandatory so we can print an error message if it's missing to improve the user experience. It's very unlikely that a controller doesn't need to be initialized and if it doesn't, it's possible to have a firmware file containing only a DCS NOP.
v4:
- Move driver to drm/tiny where the other drivers of its kind are located. The driver module will not be shared with a future DPI driver after all.
v3:
- Move properties to DT (Maxime)
- The MIPI DPI spec has optional support for DPI where the controller is configured over DBI. Rework the command functions so they can be moved to drm_mipi_dbi and shared with a future panel-mipi-dpi-spi driver
v2:
- Drop model property and use compatible instead (Rob)
- Add wiki entry in MAINTAINERS
--- MAINTAINERS | 8 + drivers/gpu/drm/tiny/Kconfig | 15 + drivers/gpu/drm/tiny/Makefile | 1 + drivers/gpu/drm/tiny/panel-mipi-dbi.c | 398 ++++++++++++++++++++++++++ 4 files changed, 422 insertions(+) create mode 100644 drivers/gpu/drm/tiny/panel-mipi-dbi.c
MAINTAINERS +8 -0
@@ -6107,6 +6107,14 @@ T: git git://anongit.freedesktop.org/drm/drm-misc F: Documentation/devicetree/bindings/display/multi-inno,mi0283qt.txt F: drivers/gpu/drm/tiny/mi0283qt.c +DRM DRIVER FOR MIPI DBI compatible panels +M: Noralf Trønnes <[email protected]> +S: Maintained +W: https://github.com/notro/panel-mipi-dbi/wiki +T: git git://anongit.freedesktop.org/drm/drm-misc +F: Documentation/devicetree/bindings/display/panel/panel-mipi-dbi-spi.yaml +F: drivers/gpu/drm/tiny/panel-mipi-dbi.c + DRM DRIVER FOR MSM ADRENO GPU M: Rob Clark <[email protected]> M: Sean Paul <[email protected]>
drivers/gpu/drm/tiny/Kconfig +15 -0
@@ -51,6 +51,21 @@ config DRM_GM12U320 This is a KMS driver for projectors which use the GM12U320 chipset for video transfer over USB2/3, such as the Acer C120 mini projector. +config DRM_PANEL_MIPI_DBI + tristate "DRM support for MIPI DBI compatible panels" + depends on DRM && SPI + select DRM_KMS_HELPER + select DRM_GEM_CMA_HELPER + select DRM_MIPI_DBI + select BACKLIGHT_CLASS_DEVICE + select VIDEOMODE_HELPERS + help + Say Y here if you want to enable support for MIPI DBI compatible + panels. The controller command setup can be provided using a + firmware file. For more information see + https://github.com/notro/panel-mipi-dbi/wiki. + To compile this driver as a module, choose M here. + config DRM_SIMPLEDRM tristate "Simple framebuffer driver" depends on DRM && MMU
drivers/gpu/drm/tiny/Makefile +1 -0
@@ -4,6 +4,7 @@ obj-$(CONFIG_DRM_ARCPGU) += arcpgu.o obj-$(CONFIG_DRM_BOCHS) += bochs.o obj-$(CONFIG_DRM_CIRRUS_QEMU) += cirrus.o obj-$(CONFIG_DRM_GM12U320) += gm12u320.o +obj-$(CONFIG_DRM_PANEL_MIPI_DBI) += panel-mipi-dbi.o obj-$(CONFIG_DRM_SIMPLEDRM) += simpledrm.o obj-$(CONFIG_TINYDRM_HX8357D) += hx8357d.o obj-$(CONFIG_TINYDRM_ILI9163) += ili9163.o
drivers/gpu/drm/tiny/panel-mipi-dbi.c new file +398 -0
398 lines not on this page · raw message
Signature · 1 line
2.33.0
Hi Noralf,
Quoted 36 lines · Noralf Trønnes
Add a driver that will work with most MIPI DBI compatible SPI panels. This avoids adding a driver for every new MIPI DBI compatible controller that is to be used by Linux. The 'compatible' Device Tree property with a '.bin' suffix will be used to load a firmware file that contains the controller configuration.
Example (driver will load sainsmart18.bin):
display@0 { compatible = "sainsmart18", "panel-mipi-dbi-spi";...
};v5:
- kconfig: s/DRM_KMS_CMA_HELPER/DRM_GEM_CMA_HELPER/ (Sam)
- kconfig: Add selectVIDEOMODE_HELPERS(Sam)
- kconfig: Add wiki url in the description (Sam)
- Split out and use of_get_drm_panel_display_mode()(Sam)
- Only use the first compatible to look for a firmware file since the binding mandates 2 compatibles.
- Make having a firmware file mandatory so we can print an error message if it's missing to improve the user experience. It's very unlikely that a controller doesn't need to be initialized and if it doesn't, it's possible to have a firmware file containing only a DCS NOP.v4:
- Move driver to drm/tiny where the other drivers of its kind are located. The driver module will not be shared with a future DPI driver after all.v3:
- Move properties to DT (Maxime)
- The MIPI DPI spec has optional support for DPI where the controller is configured over DBI. Rework the command functions so they can be moved todrm_mipi_dbiand shared with a future panel-mipi-dpi-spi driver
Quoted 6 lines
v2:
- Drop model property and use compatible instead (Rob)
- Add wiki entry inMAINTAINERSAcked-by Maxime Ripard <[email protected]>Signed-off-by Noralf Trønnes <[email protected]>
Looks good.