drm/sun4i: dsi: Add bridge support
Subsystems (7)
Jagan Teki
maintainerPATCH v2 3/6 drm/sun4i: dsi: Add bridge support
Some display panels would come up with a non-DSI output which can have an option to connect DSI interface by means of bridge converter.
This DSI to non-DSI bridge converter would require a bridge driver that would communicate the DSI controller for bridge functionalities.
So, add support for bridge functionalities in Allwinner DSI controller.
--- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 60 +++++++++++++++++++------- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 1 + 2 files changed, 45 insertions(+), 16 deletions(-)
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +44 -16
@@ -775,6 +775,9 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder)if (!IS_ERR (dsi->panel))drm_panel_prepare (dsi->panel); +if (!IS_ERR (dsi->bridge)) +drm_bridge_pre_enable (dsi->bridge); +/* * FIXME: This should be moved after the switch to HS mode. *
@@ -790,6 +793,9 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder)if (!IS_ERR (dsi->panel))drm_panel_enable (dsi->panel); +if (!IS_ERR (dsi->bridge)) +drm_bridge_enable (dsi->bridge); +sun6i_dsi_start (dsi,DSI_START_HSC );udelay (1000 );
@@ -806,6 +812,9 @@ static void sun6i_dsi_encoder_disable(struct drm_encoder *encoder)if (!IS_ERR (dsi->panel)) {drm_panel_disable (dsi->panel);drm_panel_unprepare (dsi->panel); + }else if (!IS_ERR (dsi->bridge)) { +drm_bridge_disable (dsi->bridge); +drm_bridge_post_disable (dsi->bridge); }phy_power_off (dsi->dphy);
@@ -969,11 +978,12 @@ static int sun6i_dsi_attach(struct mipi_dsi_host *host, dsi->device = device; ret =drm_of_find_panel_or_bridge (host->dev->of_node,0 ,0 , - &dsi->panel,NULL ); + &dsi->panel, &dsi->bridge);if (ret)return ret; -dev_info (host->dev,"Attached device %s\n" , device->name); +dev_info (host->dev,"Attached %s %s\n" , + dsi->bridge ?"bridge" :"panel" , device->name);return 0 ; }
@@ -983,7 +993,10 @@ static int sun6i_dsi_detach(struct mipi_dsi_host *host, {struct sun6i_dsi *dsi =host_to_sun6i_dsi (host); - dsi->panel =NULL ; +if (dsi->panel) + dsi->panel =NULL ; +else if (dsi->bridge) + dsi->bridge =NULL ; dsi->device =NULL ;return 0 ;
@@ -1055,8 +1068,10 @@ static int sun6i_dsi_bind(struct device *dev, struct device *master,struct sun4i_tcon *tcon0 =sun4i_get_tcon0 (drm);int ret; -if (!dsi->panel) +if (!(dsi->panel || dsi->bridge)) { +dev_info (drm->dev,"No panel or bridge found... DSI output disabled\n" );return -EPROBE_DEFER ; + } dsi->drv = drv;
@@ -1078,19 +1093,29 @@ static int sun6i_dsi_bind(struct device *dev, struct device *master, } dsi->encoder.possible_crtcs =BIT (0 ); -drm_connector_helper_add (&dsi->connector, - &sun6i_dsi_connector_helper_funcs); - ret =drm_connector_init (drm, &dsi->connector, - &sun6i_dsi_connector_funcs, -DRM_MODE_CONNECTOR_DSI ); -if (ret) { -dev_err (dsi->dev, -"Couldn't initialise the DSI connector\n" ); - goto err_cleanup_connector; +if (dsi->panel) { +drm_connector_helper_add (&dsi->connector, + &sun6i_dsi_connector_helper_funcs); + ret =drm_connector_init (drm, &dsi->connector, + &sun6i_dsi_connector_funcs, +DRM_MODE_CONNECTOR_DSI ); +if (ret) { +dev_err (dsi->dev, +"Couldn't initialise the DSI connector\n" ); + goto err_cleanup_connector; + } + +drm_connector_attach_encoder (&dsi->connector, &dsi->encoder); +drm_panel_attach (dsi->panel, &dsi->connector); } -drm_connector_attach_encoder (&dsi->connector, &dsi->encoder); -drm_panel_attach (dsi->panel, &dsi->connector); +if (dsi->bridge) { + ret =drm_bridge_attach (&dsi->encoder, dsi->bridge,NULL ); +if (ret) { +dev_err (dsi->dev,"Couldn't attach the DSI bridge\n" ); + goto err_cleanup_connector; + } + }return 0 ;
@@ -1104,7 +1129,10 @@ static void sun6i_dsi_unbind(struct device *dev, struct device *master, {struct sun6i_dsi *dsi =dev_get_drvdata (dev); -drm_panel_detach (dsi->panel); +if (dsi->panel) +drm_panel_detach (dsi->panel); +else if (dsi->bridge->funcs->detach) + dsi->bridge->funcs->detach (dsi->bridge); }static const struct component_ops sun6i_dsi_ops = {
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h +1 -0
@@ -32,6 +32,7 @@ struct sun6i_dsi {struct sun4i_tcon *tcon;struct mipi_dsi_device *device;struct drm_panel *panel; +struct drm_bridge *bridge; };static inline struct sun6i_dsi *host_to_sun6i_dsi (struct mipi_dsi_host *host)
Signature · 1 line
2.18.0.321.gffc6fa0e3
Jagan Teki
maintainerPATCH v2 4/6 dt-bindings: display: bridge: Add ICN6211 MIPI-DSI to RGB converter bridge
ICN6211 is MIPI-DSI/RGB converter bridge from chipone. It has a flexible configuration of MIPI DSI signal input and produce RGB565, RGB666, RGB888 output format.
Add dt-bingings for it.
--- .../display/bridge/chipone,icn6211.txt | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/chipone,icn6211.txt
Documentation/devicetree/bindings/display/bridge/chipone,icn6211.txt new file +78 -0
@@ -0,0 +1,78 @@ +Chipone ICN6211 MIPI-DSI to RGB Converter Bridge + +ICN6211 is MIPI-DSI/RGB converter bridge from chipone. +It has a flexible configuration of MIPI DSI signal input +and produce RGB565, RGB666, RGB888 output format. + +Required properties for RGB: +- compatible: must be "chipone,icn6211" +- reg: the virtual channel number of a DSI peripheral +- reset-gpios: a GPIO phandle for the reset pin + +The device node can contain following 'port' child nodes, +according to the OF graph bindings defined in [1]: + 0: DSI Input, not required, if the bridge is DSI controlled + 1: RGB Output, mandatory + +[1]: Documentation/devicetree/bindings/media/video-interfaces.txt + +Example: + + panel { + compatible = "bananapi,s070wv20-ct16", "simple-panel"; + enable-gpios = <&pio 1 7 GPIO_ACTIVE_HIGH>; /* LCD-PWR-EN: PB7 */ + backlight = <&backlight>; + + port { + panel_out_bridge: endpoint { + remote-endpoint = <&bridge_out_panel>; + }; + }; + }; + +&dsi { + vcc-dsi-supply = <®_dcdc1>; /* VCC-DSI */ + status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + dsi_out: port@0 { + reg = <0>; + + dsi_out_bridge: endpoint { + remote-endpoint = <&bridge_out_dsi>; + }; + }; + }; + + bridge@0 { + compatible = "chipone,icn6211"; + reg = <0>; + reset-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>; /* LCD-RST: PL5 */ + #address-cells = <1>; + #size-cells = <0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + bridge_in: port@0 { + reg = <0>; + + bridge_out_dsi: endpoint { + remote-endpoint = <&dsi_out_bridge>; + }; + }; + + bridge_out: port@1 { + reg = <1>; + + bridge_out_panel: endpoint { + remote-endpoint = <&panel_out_bridge>; + }; + }; + }; + }; +};
Signature · 1 line
2.18.0.321.gffc6fa0e3
Rob Herring
maintainerRe: [PATCH v2 4/6] dt-bindings: display: bridge: Add ICN6211 MIPI-DSI to RGB converter bridge
Quoted 30 lines · Jagan Teki
ICN6211 is MIPI-DSI/RGB converter bridge from chipone. It has a flexible configuration of MIPI DSI signal input and produce RGB565, RGB666, RGB888 output format.
Add dt-bingings for it.
--- .../display/bridge/chipone,icn6211.txt | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/chipone,icn6211.txtDocumentation/devicetree/bindings/display/bridge/chipone,icn6211.txt new file +12
-0@@ -0,0 +1,78 @@ +Chipone ICN6211 MIPI-DSI to RGB Converter Bridge + +ICN6211 is MIPI-DSI/RGB converter bridge from chipone. +It has a flexible configuration of MIPI DSI signal input +and produce RGB565, RGB666, RGB888 output format. + +Required properties for RGB: +- compatible: must be "chipone,icn6211" +- reg: the virtual channel number of a DSI peripheral +- reset-gpios: a GPIO phandle for the reset pin + +The device node can contain following 'port' child nodes,
Documentation/devicetree/bindings/display/bridge/chipone,icn6211.txt line 22
Quoted 10 lines
Documentation/devicetree/bindings/display/bridge/chipone,icn6211.txt new file +10
-0+according to the OF graph bindings defined in [1]: + 0: DSI Input, not required, if the bridge is DSI controlled + 1: RGB Output, mandatory + +[1]: Documentation/devicetree/bindings/media/video-interfaces.txt + +Example: + + panel { + compatible = "bananapi,s070wv20-ct16", "simple-panel";
'simple-panel' is not a valid compatible string.
Quoted 59 lines
Documentation/devicetree/bindings/display/bridge/chipone,icn6211.txt new file +56
-0+ enable-gpios = <&pio 1 7 GPIO_ACTIVE_HIGH>; /* LCD-PWR-EN: PB7 */ + backlight = <&backlight>; + + port { + panel_out_bridge: endpoint { + remote-endpoint = <&bridge_out_panel>; + }; + }; + }; + +&dsi { + vcc-dsi-supply = <®_dcdc1>; /* VCC-DSI */ + status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + dsi_out: port@0 { + reg = <0>; + + dsi_out_bridge: endpoint { + remote-endpoint = <&bridge_out_dsi>; + }; + }; + }; + + bridge@0 { + compatible = "chipone,icn6211"; + reg = <0>; + reset-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>; /* LCD-RST: PL5 */ + #address-cells = <1>; + #size-cells = <0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + bridge_in: port@0 { + reg = <0>; + + bridge_out_dsi: endpoint { + remote-endpoint = <&dsi_out_bridge>; + }; + }; + + bridge_out: port@1 { + reg = <1>; + + bridge_out_panel: endpoint { + remote-endpoint = <&panel_out_bridge>; + }; + }; + }; + }; +};Signature · 1 line
2.18.0.321.gffc6fa0e3
Jagan Teki
maintainerPATCH v2 5/6 drm/bridge: Add Chipone ICN6211 MIPI-DSI/RGB converter bridge
In reply to Jagan TekiICN6211 is MIPI-DSI/RGB converter bridge from chipone. It has a flexible configuration of MIPI DSI signal input and produce RGB565, RGB666, RGB888 output format.
Add bridge driver for it.
---
Note:
- drm_panel_bridge_add seems not working or incompatible as per driver setup. any inputs on this would be great.
MAINTAINERS | 6 + drivers/gpu/drm/bridge/Kconfig | 10 + drivers/gpu/drm/bridge/Makefile | 1 + drivers/gpu/drm/bridge/chipone-icn6211.c | 344 +++++++++++++++++++++++ 4 files changed, 361 insertions(+) create mode 100644 drivers/gpu/drm/bridge/chipone-icn6211.c
MAINTAINERS +6 -0
@@ -4991,6 +4991,12 @@ T: git git://anongit.freedesktop.org/drm/drm-misc S: Maintained F: drivers/gpu/drm/bochs/ +DRM DRIVER FOR CHIPONE ICN6211 MIPI-DSI to RGB CONVERTOR BRIDGE +M: Jagan Teki <[email protected]> +S: Maintained +F: drivers/gpu/drm/bridge/chipone-icn6211.c +F: Documentation/devicetree/bindings/display/bridge/chipone,icn6211.txt + DRM DRIVER FOR FARADAY TVE200 TV ENCODER M: Linus Walleij <[email protected]> T: git git://anongit.freedesktop.org/drm/drm-misc
drivers/gpu/drm/bridge/Kconfig +10 -0
@@ -36,6 +36,16 @@ config DRM_CDNS_DSI Support Cadence DPI to DSI bridge. This is an internal bridge and is meant to be directly embedded in a SoC. +config DRM_CHIPONE_ICN6211 + tristate "Chipone ICN6211 MIPI-DSI/RGB converter bridge" + depends on DRM && DRM_PANEL + depends on OF + select DRM_MIPI_DSI + help + ICN6211 is MIPI-DSI/RGB converter bridge from chipone. + It has a flexible configuration of MIPI DSI signal input + and produce RGB565, RGB666, RGB888 output format. + config DRM_DUMB_VGA_DAC tristate "Dumb VGA DAC Bridge support" depends on OF
drivers/gpu/drm/bridge/Makefile +1 -0
@@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o +obj-$(CONFIG_DRM_CHIPONE_ICN6211) += chipone-icn6211.o obj-$(CONFIG_DRM_DUMB_VGA_DAC) += dumb-vga-dac.o obj-$(CONFIG_DRM_LVDS_ENCODER) += lvds-encoder.o obj-$(CONFIG_DRM_MEGACHIPS_STDPXXXX_GE_B850V3_FW) += megachips-stdpxxxx-ge-b850v3-fw.o
drivers/gpu/drm/bridge/chipone-icn6211.c new file +344 -0
344 lines not on this page · raw message
Signature · 1 line
2.18.0.321.gffc6fa0e3
Jagan Teki
maintainerPATCH v2 6/6 ARM: dts: sun8i: bananapi-m2m: Enable Bananapi S070WV20-CT16 DSI panel
In reply to Jagan TekiThis patch add support for Bananapi S070WV20-CT16 DSI panel to BPI-M2M board.
Bananapi S070WV20-CT16 is a pure RGB output panel with ICN6211 DSI/RGB convertor bridge, so enable bridge along with associated panel.
DSI panel connected via board DSI port with,
- DCDC1 as VCC-DSI supply
- PL5 gpio for bridge reset gpio pin
- PB7 gpio for lcd enable gpio pin
- PL4 gpio for backlight enable pin
--- arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts | 86 ++++++++++++++++++++ 1 file changed, 86 insertions(+)
arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts +86 -0
@@ -44,6 +44,7 @@ #include "sun8i-a33.dtsi" #include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/pwm/pwm.h> / { model = "BananaPi M2 Magic";
@@ -61,6 +62,14 @@ stdout-path = "serial0:115200n8"; }; + backlight: backlight { + compatible = "pwm-backlight"; + pwms = <&pwm 0 50000 PWM_POLARITY_INVERTED>; + brightness-levels = <1 2 4 8 16 32 64 128 255>; + default-brightness-level = <8>; + enable-gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* LCD-BL-EN: PL4 */ + }; + leds { compatible = "gpio-leds";
@@ -81,6 +90,18 @@ }; }; + panel { + compatible = "bananapi,s070wv20-ct16", "simple-panel"; + enable-gpios = <&pio 1 7 GPIO_ACTIVE_HIGH>; /* LCD-PWR-EN: PB7 */ + backlight = <&backlight>; + + port { + panel_out_bridge: endpoint { + remote-endpoint = <&bridge_out_panel>; + }; + }; + }; + reg_vcc5v0: vcc5v0 { compatible = "regulator-fixed"; regulator-name = "vcc5v0";
@@ -122,6 +143,61 @@ status = "okay"; }; +&de { + status = "okay"; +}; + +&dphy { + status = "okay"; +}; + +&dsi { + vcc-dsi-supply = <®_dcdc1>; /* VCC-DSI */ + status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + dsi_out: port@0 { + reg = <0>; + + dsi_out_bridge: endpoint { + remote-endpoint = <&bridge_out_dsi>; + }; + }; + }; + + bridge@0 { + compatible = "chipone,icn6211"; + reg = <0>; + reset-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>; /* LCD-RST: PL5 */ + #address-cells = <1>; + #size-cells = <0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + bridge_in: port@0 { + reg = <0>; + + bridge_out_dsi: endpoint { + remote-endpoint = <&dsi_out_bridge>; + }; + }; + + bridge_out: port@1 { + reg = <1>; + + bridge_out_panel: endpoint { + remote-endpoint = <&panel_out_bridge>; + }; + }; + }; + }; +}; + &ehci0 { status = "okay"; };
@@ -157,6 +233,12 @@ status = "okay"; }; +&pwm { + pinctrl-names = "default"; + pinctrl-0 = <&pwm0_pin>; + status = "okay"; +}; + &r_rsb { status = "okay";
@@ -269,6 +351,10 @@ status = "okay"; }; +&tcon0 { + status = "okay"; +}; + &uart0 { pinctrl-names = "default"; pinctrl-0 = <&uart0_pb_pins>;
Signature · 1 line
2.18.0.321.gffc6fa0e3
Hi,
Quoted 22 lines · Jagan Teki
Some display panels would come up with a non-DSI output which can have an option to connect DSI interface by means of bridge converter.
This DSI to non-DSI bridge converter would require a bridge driver that would communicate the DSI controller for bridge functionalities.
So, add support for bridge functionalities in Allwinner DSI controller.
--- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 60 +++++++++++++++++++------- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 1 + 2 files changed, 45 insertions(+), 16 deletions(-)drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +0
-0
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder) · line 780
Quoted 6 lines
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +3
-0@@ -775,6 +775,9 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder)if (!IS_ERR (dsi->panel))drm_panel_prepare (dsi->panel); +if (!IS_ERR (dsi->bridge)) +drm_bridge_pre_enable (dsi->bridge); +
drm_panel_bridge provides what's needed to deal with both a panel and a bridge, I guess it would make sense to use this instead of duplicating everything.
Maxime
--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com