Add DSI panel driver for Raydium RM67191
Subsystems (5)
Robert Chiras
maintainerv3 cover Add DSI panel driver for Raydium RM67191
This patch-set contains the DRM panel driver and dt-bindings documentation for the DSI driven panel: Raydium RM67191.
v3:
- Added myself to MAINTAINERS for this driver (sam)
- Removed display-timings property (fabio)
- Fixed dt description (sam)
- Re-arranged calls inside get_modes function (sam)
- Changed ifdefs with _maybe_unused for suspend/resume functions (sam)
- Collected Reviewed-by from Sam
v2:
- Fixed 'reset-gpio' to 'reset-gpios' property naming (fabio)
- Changed the state of the reset gpio to active low and fixed how it is handled in driver (fabio)
- Fixed copyright statement (daniel)
- Reordered includes (sam)
- Added defines for panel specific color formats (fabio)
- Removed unnecessary tests in enable and unprepare (sam)
- Removed the unnecessary backlight write in enable (sam)
Robert Chiras (2):
dt-bindings: display: panel: Add support for Raydium RM67191 panel drm/panel: Add support for Raydium RM67191 panel driver
.../bindings/display/panel/raydium,rm67191.txt | 39 ++ MAINTAINERS | 6 + drivers/gpu/drm/panel/Kconfig | 9 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-raydium-rm67191.c | 690 +++++++++++++++++++++ 5 files changed, 745 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/raydium,rm67191.txt create mode 100644 drivers/gpu/drm/panel/panel-raydium-rm67191.c
Signature · 1 line
2.7.4
Robert Chiras
maintainerPATCH v3 1/2 dt-bindings: display: panel: Add support for Raydium RM67191 panel
Add dt-bindings documentation for Raydium RM67191 DSI panel.
--- .../bindings/display/panel/raydium,rm67191.txt | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/raydium,rm67191.txt
Documentation/devicetree/bindings/display/panel/raydium,rm67191.txt new file +39 -0
@@ -0,0 +1,39 @@ +Raydium RM67171 OLED LCD panel with MIPI-DSI protocol + +Required properties: +- compatible: "raydium,rm67191" +- reg: virtual channel for MIPI-DSI protocol + must be <0> +- dsi-lanes: number of DSI lanes to be used + must be <3> or <4> +- port: input port node with endpoint definition as + defined in Documentation/devicetree/bindings/graph.txt; + the input port should be connected to a MIPI-DSI device + driver + +Optional properties: +- reset-gpios: a GPIO spec for the RST_B GPIO pin +- width-mm: see panel-common.txt +- height-mm: see panel-common.txt +- video-mode: 0 - burst-mode + 1 - non-burst with sync event + 2 - non-burst with sync pulse + +Example: + + panel@0 { + compatible = "raydium,rm67191"; + reg = <0>; + pinctrl-0 = <&pinctrl_mipi_dsi_0_1_en>; + pinctrl-names = "default"; + reset-gpios = <&gpio1 7 GPIO_ACTIVE_LOW>; + dsi-lanes = <4>; + width-mm = <68>; + height-mm = <121>; + + port { + panel_in: endpoint { + remote-endpoint = <&mipi_out>; + }; + }; + };
Signature · 1 line
2.7.4
Re: [PATCH v3 1/2] dt-bindings: display: panel: Add support for Raydium RM67191 panel
Hi Robert,
Quoted 26 lines · Robert Chiras
Add dt-bindings documentation for Raydium RM67191 DSI panel.
Signed-off-by Robert Chiras <[email protected]>Reviewed-by Sam Ravnborg <[email protected]>--- .../bindings/display/panel/raydium,rm67191.txt | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/raydium,rm67191.txtDocumentation/devicetree/bindings/display/panel/raydium,rm67191.txt new file +10
-0@@ -0,0 +1,39 @@ +Raydium RM67171 OLED LCD panel with MIPI-DSI protocol + +Required properties: +- compatible: "raydium,rm67191" +- reg: virtual channel for MIPI-DSI protocol + must be <0> +- dsi-lanes: number of DSI lanes to be used + must be <3> or <4> +- port: input port node with endpoint definition as + defined in Documentation/devicetree/bindings/graph.txt;
Documentation/devicetree/bindings/display/panel/raydium,rm67191.txt line 20
Quoted 10 lines
Documentation/devicetree/bindings/display/panel/raydium,rm67191.txt new file +10
-0+ the input port should be connected to a MIPI-DSI device + driver + +Optional properties: +- reset-gpios: a GPIO spec for the RST_B GPIO pin +- width-mm: see panel-common.txt +- height-mm: see panel-common.txt +- video-mode: 0 - burst-mode + 1 - non-burst with sync event + 2 - non-burst with sync po ulse
No power-supply property?
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Robert Chiras
maintainerRe: [EXT] Re: [PATCH v3 1/2] dt-bindings: display: panel: Add support for Raydium RM67191 panel
Hi Fabio,
Quoted 44 lines · Fabio Estevam
Hi Robert,
On Thu, Jun 20, 2019 at 10:32 AM Robert Chiras <[email protected]
Quoted 41 lines
wrote:
Add dt-bindings documentation for Raydium RM67191 DSI panel.
Signed-off-by Robert Chiras <[email protected]>Reviewed-by Sam Ravnborg <[email protected]>---
.../bindings/display/panel/raydium,rm67191.txt | 39
++++++++++++++++++++++1 file changed, 39 insertions(+)create mode 100644
Documentation/devicetree/bindings/display/panel/raydium,rm67191.txtdiff --git a/Documentation/devicetree/bindings/display/panel/raydium,rm67191.t xt b/Documentation/devicetree/bindings/display/panel/raydium,rm67191.t xt
new file mode 100644
index 0000000..52af272
---/dev/null
+++
b/Documentation/devicetree/bindings/display/panel/raydium,rm67191.t xtDocumentation/devicetree/bindings/display/panel/raydium,rm67191.txt new file +10
-0@@ -0,0 +1,39 @@ +Raydium RM67171 OLED LCD panel with MIPI-DSI protocol + +Required properties: +- compatible: "raydium,rm67191" +- reg: virtual channel for MIPI-DSI protocol + must be <0> +- dsi-lanes: number of DSI lanes to be used + must be <3> or <4> +- port: input port node with endpoint definition as + defined in
Documentation/devicetree/bindings/graph.txt;
+ the input port should be connected to a MIPI-DSI device
+ driver
+
Quoted 8 lines
Quoted 7 lines
+Optional properties:
+- reset-gpios: a GPIO spec for the RST_B GPIO pin +- width-mm: see panel-common.txt +- height-mm: see panel-common.txt +- video-mode: 0 - burst-mode+ 1 - non-burst with sync event + 2 - non-burst with sync po ulse
No power-supply property?
From what I've seen in the schematics, the power lines on the DSI port on all the i.MX8 cores are coming from a PMIC providing power for all the peripherals. Since I didn't find a way to cut the power on a single peripheral (like DSI, for example) it doesn't make sense for power- supply property. For now, at least.
Re: [EXT] Re: [PATCH v3 1/2] dt-bindings: display: panel: Add support for Raydium RM67191 panel
Hi Robert,
Quoted 5 lines · Robert Chiras
From what I've seen in the schematics, the power lines on the DSI port on all the i.MX8 cores are coming from a PMIC providing power for all the peripherals. Since I didn't find a way to cut the power on a single peripheral (like DSI, for example) it doesn't make sense for power- supply property. For now, at least.
This panel driver is not supposed to only work with i.MX8 NXP reference boards.
The dt-bindings should be as accurate as possible from day one, so describing the power-supply is important.
Please look at the panel datasheet and describe the required power supplies accordingly.
Thanks
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Robert Chiras
maintainerRe: [EXT] Re: [PATCH v3 1/2] dt-bindings: display: panel: Add support for Raydium RM67191 panel
Quoted 16 lines · Fabio Estevam
Caution: EXT Email
Hi Robert,
On Fri, Jun 21, 2019 at 11:16 AM Robert Chiras <[email protected]
Quoted 11 lines
wrote:
From what I've seen in the schematics, the power lines on the DSI port
on all the i.MX8 cores are coming from a PMIC providing power for all
the peripherals. Since I didn't find a way to cut the power on a single
peripheral (like DSI, for example) it doesn't make sense for power- supply property. For now, at least.
Quoted 8 lines
This panel driver is not supposed to only work with i.MX8 NXP reference boards.
The dt-bindings should be as accurate as possible from day one, so describing the power-supply is important.
Please look at the panel datasheet and describe the required power supplies accordingly.
OK, I will add the power regulators as they are described in panel datasheet. I just won't be able to test them.
Quoted 2 lines
Thanks
Robert Chiras
maintainerPATCH v3 2/2 drm/panel: Add support for Raydium RM67191 panel driver
In reply to Robert ChirasThis patch adds Raydium RM67191 TFT LCD panel driver (MIPI-DSI protocol).
--- MAINTAINERS | 6 + drivers/gpu/drm/panel/Kconfig | 9 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-raydium-rm67191.c | 690 ++++++++++++++++++++++++++ 4 files changed, 706 insertions(+) create mode 100644 drivers/gpu/drm/panel/panel-raydium-rm67191.c
MAINTAINERS +6 -0
@@ -5089,6 +5089,12 @@ S: Maintained F: drivers/gpu/drm/qxl/ F: include/uapi/drm/qxl_drm.h +DRM DRIVER FOR RAYDIUM RM67191 PANELS +M: Robert Chiras <[email protected]> +S: Maintained +F: drivers/gpu/drm/panel/panel-raydium-rm67191.c +F: Documentation/devicetree/bindings/display/panel/raydium,rm67191.txt + DRM DRIVER FOR RAGE 128 VIDEO CARDS S: Orphan / Obsolete F: drivers/gpu/drm/r128/
drivers/gpu/drm/panel/Kconfig +9 -0
@@ -159,6 +159,15 @@ config DRM_PANEL_RASPBERRYPI_TOUCHSCREEN Pi 7" Touchscreen. To compile this driver as a module, choose M here. +config DRM_PANEL_RAYDIUM_RM67191 + tristate "Raydium RM67191 FHD 1080x1920 DSI video mode panel" + depends on OF + depends on DRM_MIPI_DSI + depends on BACKLIGHT_CLASS_DEVICE + help + Say Y here if you want to enable support for Raydium RM67191 FHD + (1080x1920) DSI panel. + config DRM_PANEL_RAYDIUM_RM68200 tristate "Raydium RM68200 720x1280 DSI video mode panel" depends on OF
drivers/gpu/drm/panel/Makefile +1 -0
@@ -14,6 +14,7 @@ obj-$(CONFIG_DRM_PANEL_ORISETECH_OTM8009A) += panel-orisetech-otm8009a.o obj-$(CONFIG_DRM_PANEL_OSD_OSD101T2587_53TS) += panel-osd-osd101t2587-53ts.o obj-$(CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00) += panel-panasonic-vvx10f034n00.o obj-$(CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN) += panel-raspberrypi-touchscreen.o +obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM67191) += panel-raydium-rm67191.o obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM68200) += panel-raydium-rm68200.o obj-$(CONFIG_DRM_PANEL_ROCKTECH_JH057N00900) += panel-rocktech-jh057n00900.o obj-$(CONFIG_DRM_PANEL_RONBO_RB070D30) += panel-ronbo-rb070d30.o
drivers/gpu/drm/panel/panel-raydium-rm67191.c new file +690 -0
690 lines not on this page · raw message
Signature · 1 line
2.7.4
Re: [PATCH v3 2/2] drm/panel: Add support for Raydium RM67191 panel driver
Hi Robert,
drivers/gpu/drm/panel/panel-raydium-rm67191.c line 371
Quoted 3 lines · Robert Chiras
drivers/gpu/drm/panel/panel-raydium-rm67191.c new file +3
-0+fail: +if (rad->reset) +gpiod_set_value_cansleep (rad->reset,1 );
gpiod_set_value_cansleep() can handle NULL, so no need for the if() check.
drivers/gpu/drm/panel/panel-raydium-rm67191.c line 508
Quoted 2 lines
drivers/gpu/drm/panel/panel-raydium-rm67191.c new file +2
-0+static const struct display_timing rad_default_timing = { + .pixelclock = {132000000 ,132000000 ,132000000 },
Having the same information listed three times does not seem useful.
You could use a drm_display_mode structure with a single entry instead.
drivers/gpu/drm/panel/panel-raydium-rm67191.c line 575
Quoted 6 lines
drivers/gpu/drm/panel/panel-raydium-rm67191.c new file +6
-0+videomode_from_timing (&rad_default_timing, &panel->vm); + +of_property_read_u32 (np,"width-mm" , &panel->width_mm); +of_property_read_u32 (np,"height-mm" , &panel->height_mm); + + panel->reset =devm_gpiod_get (dev,"reset" ,GPIOD_OUT_LOW );
Since this is optional it would be better to usedevm_gpiod_get_optional() instead.
drivers/gpu/drm/panel/panel-raydium-rm67191.c line 580
Quoted 5 lines
drivers/gpu/drm/panel/panel-raydium-rm67191.c new file +5
-0+ +if (IS_ERR (panel->reset)) + panel->reset =NULL ; +else +gpiod_set_value_cansleep (panel->reset,1 );
This is not handling defer probing, so it would be better to do like this:
panel->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(panel->reset))
return PTR_ERR(panel->reset);
drivers/gpu/drm/panel/panel-raydium-rm67191.c line 590
Quoted 9 lines
drivers/gpu/drm/panel/panel-raydium-rm67191.c new file +9
-0+memset (&bl_props,0 ,sizeof (bl_props)); + bl_props.type =BACKLIGHT_RAW ; + bl_props.brightness =255 ; + bl_props.max_brightness =255 ; + + panel->backlight =devm_backlight_device_register (dev,dev_name (dev), + dev, dsi, + &rad_bl_ops, + &bl_props);
Could you put more parameters into the same line?
Using 4 lines seems excessive.
drivers/gpu/drm/panel/panel-raydium-rm67191.c line 603
Quoted 13 lines
drivers/gpu/drm/panel/panel-raydium-rm67191.c new file +13
-0+if (IS_ERR (panel->backlight)) { + ret =PTR_ERR (panel->backlight); +dev_err (dev,"Failed to register backlight (%d)\n" , ret); +return ret; + } + +drm_panel_init (&panel->panel); + panel->panel.funcs = &rad_panel_funcs; + panel->panel.dev = dev; +dev_set_drvdata (dev, panel); + + ret =drm_panel_add (&panel->panel); +
Unneeded blank line
drivers/gpu/drm/panel/panel-raydium-rm67191.c line 611
Quoted 8 lines
drivers/gpu/drm/panel/panel-raydium-rm67191.c new file +8
-0+if (ret <0 ) +return ret; + + ret =mipi_dsi_attach (dsi); +if (ret <0 ) +drm_panel_remove (&panel->panel); + +return ret;
You did not handle the "power" regulator.
Quoted 11 lines
drivers/gpu/drm/panel/panel-raydium-rm67191.c new file +11
-0+static int __maybe_unused rad_panel_suspend (struct device *dev) +{ +struct rad_panel *rad =dev_get_drvdata (dev); + +if (!rad->reset) +return 0 ; + +devm_gpiod_put (dev, rad->reset); + rad->reset =NULL ; + +return 0 ;
drivers/gpu/drm/panel/panel-raydium-rm67191.c line 658
Quoted 10 lines
drivers/gpu/drm/panel/panel-raydium-rm67191.c new file +10
-0+} + +static int __maybe_unused rad_panel_resume (struct device *dev) +{ +struct rad_panel *rad =dev_get_drvdata (dev); + +if (rad->reset) +return 0 ; + + rad->reset =devm_gpiod_get (dev,"reset" ,GPIOD_OUT_LOW );
Why do you call devm_gpiod_get() once again?
I am having a hard time to understand the need for this suspend/resume hooks.
Can't you simply remove them?
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Robert Chiras
maintainerRe: [EXT] Re: [PATCH v3 2/2] drm/panel: Add support for Raydium RM67191 panel driver
Hi Fabio,
Thanks for your feedback. I will handle them all, but for the pm_ops I have some comments. See inline.
Quoted 79 lines · Fabio Estevam
Hi Robert,
On Thu, Jun 20, 2019 at 10:31 AM Robert Chiras <[email protected]
Quoted 6 lines
wrote:
+fail:
+ if (rad->reset)
+ gpiod_set_value_cansleep(rad->reset, 1);
gpiod_set_value_cansleep()can handle NULL, so no need for theif()check.Quoted 3 lines
+static const struct
display_timingrad_default_timing= { + .pixelclock = { 132000000, 132000000, 132000000 },Having the same information listed three times does not seem useful.
You could use a
drm_display_modestructure with a single entry instead.drivers/gpu/drm/panel/panel-raydium-rm67191.c line 575
Quoted 7 lines
+ videomode_from_timing(&rad_default_timing,
&panel->vm);drivers/gpu/drm/panel/panel-raydium-rm67191.c new file +5
-0+ + of_property_read_u32(np, "width-mm", &panel->width_mm); + of_property_read_u32(np, "height-mm", &panel->height_mm); + + panel->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);Since this is optional it would be better to use
devm_gpiod_get_optional()instead.Quoted 6 lines
+
+ if (IS_ERR(panel->reset))
+ panel->reset = NULL;
+ else
+ gpiod_set_value_cansleep(panel->reset, 1);This is not handling defer probing, so it would be better to do like this:
panel->reset=devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(panel->reset))
return PTR_ERR(panel->reset);Quoted 13 lines
+ memset(&bl_props, 0,
sizeof(bl_props));
+ bl_props.type =BACKLIGHT_RAW;
+ bl_props.brightness = 255;
+ bl_props.max_brightness = 255;
+
+ panel->backlight = devm_backlight_device_register(dev,dev_name(dev),
+ dev, dsi, + &rad_bl_o ps,
+ &bl_props );Could you put more parameters into the same line?
Using 4 lines seems excessive.
Quoted 7 lines
+ if (
IS_ERR(panel->backlight)) {
+ ret =PTR_ERR(panel->backlight);
+ dev_err(dev, "Failed to register backlight (%d)\n", ret);
+ return ret;
+ }drivers/gpu/drm/panel/panel-raydium-rm67191.c line 603
Quoted 8 lines
drivers/gpu/drm/panel/panel-raydium-rm67191.c new file +8
-0+ + drm_panel_init(&panel->panel); + panel->panel.funcs = &rad_panel_funcs; + panel->panel.dev = dev; + dev_set_drvdata(dev, panel); + + ret = drm_panel_add(&panel->panel); +Unneeded blank line
Quoted 1 line
Quoted 9 lines
drivers/gpu/drm/panel/panel-raydium-rm67191.c line 611
Quoted 8 lines
+ if (ret < 0)
+ return ret;drivers/gpu/drm/panel/panel-raydium-rm67191.c new file +6
-0+ + ret = mipi_dsi_attach(dsi); + if (ret < 0) + drm_panel_remove(&panel->panel); + + return ret;You did not handle the "power" regulator.
There is no need for a power regulator.
Quoted 25 lines
Quoted 13 lines
drivers/gpu/drm/panel/panel-raydium-rm67191.c new file +11
-0+static int __maybe_unused rad_panel_suspend (struct device *dev) +{ + struct rad_panel *rad = dev_get_drvdata(dev); + + if (!rad->reset) + return 0; + + devm_gpiod_put(dev, rad->reset); + rad->reset = NULL; + + return 0;drivers/gpu/drm/panel/panel-raydium-rm67191.c line 658
Quoted 10 lines
drivers/gpu/drm/panel/panel-raydium-rm67191.c new file +10
-0+} + +static int __maybe_unused rad_panel_resume (struct device *dev) +{ + struct rad_panel *rad = dev_get_drvdata(dev); + + if (rad->reset) + return 0; + + rad->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);Why do you call
devm_gpiod_get()once again?
Quoted 4 lines
I am having a hard time to understand the need for this suspend/resume hooks.
Can't you simply remove them?
The reset gpio pin is shared between the DSI display controller and touch controller, both found on the same panel. Since, the touch driver also acceses this gpio pin, in some cases the display can be put to sleep, but the touch is still active. This is why, during suspend I release the gpio resource, and I have to take it back in resume. Without this release/acquire mechanism during suspend/resume, stress- tests showed some failures: the resume freezes completly.
Re: [EXT] Re: [PATCH v3 2/2] drm/panel: Add support for Raydium RM67191 panel driver
Hi Robert,
Quoted 2 lines · Robert Chiras
Quoted 1 line
You did not handle the "power" regulator.
There is no need for a power regulator.
I am sure the panel requires power to be applied so that it can work :-)
Quoted 2 lines
Quoted 1 line
Can't you simply remove them?
The reset gpio pin is shared between the DSI display controller and
Looking at the imx8mq-evk schematics it is not clear for me what pin in shared between the OLED display and touch screen.
Could you please clarify which pin you are referring to?
Quoted 6 lines
touch controller, both found on the same panel. Since, the touch driver also acceses this gpio pin, in some cases the display can be put to sleep, but the touch is still active. This is why, during suspend I release the gpio resource, and I have to take it back in resume. Without this release/acquire mechanism during suspend/resume, stress- tests showed some failures: the resume freezes completly.
Looking at the imx8mq-evk dts from the vendor tree I see that the touchscreen is not supported in mainline yet.
Maybe there is a better way to solve this, so what if you don't introduce the suspend/resume hooks for now and then we revisit this after the touchscreen driver is added?
Robert Chiras
maintainerRe: [EXT] Re: [PATCH v3 2/2] drm/panel: Add support for Raydium RM67191 panel driver
Quoted 9 lines · Fabio Estevam
Caution: EXT Email
Hi Robert,
Quoted 2 lines · Robert Chiras
Quoted 2 lines
Quoted 4 lines
Quoted 2 lines
Quoted 1 line
You did not handle the "power" regulator.
There is no need for a power regulator.
I am sure the panel requires power to be applied so that it can work :-)
Yes, of course there are power lines to the panel. I will add them to the next revision.
Quoted 9 lines
Quoted 5 lines
Quoted 4 lines
Can't you simply remove them?
The reset gpio pin is shared between the DSI display controller and
Looking at the imx8mq-evk schematics it is not clear for me what pin in shared between the OLED display and touch screen.
Could you please clarify which pin you are referring to?
It's about the DSI_EN pin on the DSI LCD IF physical port J1501. This goes into RST_B_1V8 on the panel port which is used for both display and touch resets.
Quoted 10 lines
Quoted 10 lines
touch controller, both found on the same panel. Since, the touch driver
also acceses this gpio pin, in some cases the display can be put to sleep, but the touch is still active. This is why, during suspend I release the gpio resource, and I have to take it back in resume. Without this release/acquire mechanism during suspend/resume, stress-
tests showed some failures: the resume freezes completly.
Quoted 6 lines
Looking at the imx8mq-evk dts from the vendor tree I see that the touchscreen is not supported in mainline yet.
Maybe there is a better way to solve this, so what if you don't introduce the suspend/resume hooks for now and then we revisit this after the touchscreen driver is added?
You are right. We can do this too. I will remove it for now.