* [PATCH v1 0/2] drm/stm: ltdc: add a 2nd endpoint @ 2017-10-26 11:48 Philippe Cornu 2017-10-26 11:48 ` [PATCH v1 1/2] dt-bindings: display: stm32: " Philippe Cornu 2017-10-26 11:48 ` [PATCH v1 2/2] drm/stm: ltdc: " Philippe Cornu 0 siblings, 2 replies; 6+ messages in thread From: Philippe Cornu @ 2017-10-26 11:48 UTC (permalink / raw) To: Rob Herring, Arnd Bergmann, Russell King, Mark Rutland, Yannick Fertre, Philippe Cornu, Benjamin Gaignard, Vincent Abriou, David Airlie, devicetree, linux-arm-kernel, dri-devel, linux-kernel Cc: Fabien Dessenne, Mickael Reulier, Gabriel Fernandez, Ludovic Barre, Alexandre Torgue, Maxime Coquelin Version 1: - Initial commit The purpose of this set of patches is to offer the possibility to use up to 2 endpoints for the ltdc dpi video port. Philippe Cornu (2): dt-bindings: display: stm32: add a 2nd endpoint drm/stm: ltdc: add a 2nd endpoint .../devicetree/bindings/display/st,stm32-ltdc.txt | 6 +- drivers/gpu/drm/stm/ltdc.c | 64 +++++++++++++++------- 2 files changed, 50 insertions(+), 20 deletions(-) -- 1.9.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v1 1/2] dt-bindings: display: stm32: add a 2nd endpoint 2017-10-26 11:48 [PATCH v1 0/2] drm/stm: ltdc: add a 2nd endpoint Philippe Cornu @ 2017-10-26 11:48 ` Philippe Cornu 2017-10-27 14:38 ` Rob Herring 2017-10-26 11:48 ` [PATCH v1 2/2] drm/stm: ltdc: " Philippe Cornu 1 sibling, 1 reply; 6+ messages in thread From: Philippe Cornu @ 2017-10-26 11:48 UTC (permalink / raw) To: Rob Herring, Arnd Bergmann, Russell King, Mark Rutland, Yannick Fertre, Philippe Cornu, Benjamin Gaignard, Vincent Abriou, David Airlie, devicetree, linux-arm-kernel, dri-devel, linux-kernel Cc: Fabien Dessenne, Mickael Reulier, Gabriel Fernandez, Ludovic Barre, Alexandre Torgue, Maxime Coquelin ltdc can have up to 2 endpoints: - dpi external gpios: for rgb panels or external bridge ICs. - dpi internal ios: connected internally to dsi. Note: Refer to the reference manual to know if the dsi is present on your device. Signed-off-by: Philippe Cornu <philippe.cornu@st.com> --- Documentation/devicetree/bindings/display/st,stm32-ltdc.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/display/st,stm32-ltdc.txt b/Documentation/devicetree/bindings/display/st,stm32-ltdc.txt index 74b5ac7..0292522 100644 --- a/Documentation/devicetree/bindings/display/st,stm32-ltdc.txt +++ b/Documentation/devicetree/bindings/display/st,stm32-ltdc.txt @@ -10,7 +10,11 @@ - "lcd" for the clock feeding the output pixel clock & IP clock. - resets: reset to be used by the device (defined by use of RCC macro). Required nodes: - - Video port for RGB output. + - Video port for DPI RGB output: ltdc has one video port with up to 2 + endpoints: + - for external dpi rgb panel or bridge, using gpios. + - for internal dpi input of the MIPI DSI host controller. + Note: These 2 endpoints cannot be activated simultaneously. * STMicroelectronics STM32 DSI controller specific extensions to Synopsys DesignWare MIPI DSI host controller -- 1.9.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v1 1/2] dt-bindings: display: stm32: add a 2nd endpoint 2017-10-26 11:48 ` [PATCH v1 1/2] dt-bindings: display: stm32: " Philippe Cornu @ 2017-10-27 14:38 ` Rob Herring 2017-11-07 13:58 ` Benjamin Gaignard 0 siblings, 1 reply; 6+ messages in thread From: Rob Herring @ 2017-10-27 14:38 UTC (permalink / raw) To: Philippe Cornu Cc: Arnd Bergmann, Russell King, Mark Rutland, Yannick Fertre, Benjamin Gaignard, Vincent Abriou, David Airlie, devicetree, linux-arm-kernel, dri-devel, linux-kernel, Fabien Dessenne, Mickael Reulier, Gabriel Fernandez, Ludovic Barre, Alexandre Torgue, Maxime Coquelin On Thu, Oct 26, 2017 at 01:48:08PM +0200, Philippe Cornu wrote: > ltdc can have up to 2 endpoints: > - dpi external gpios: for rgb panels or external bridge ICs. > - dpi internal ios: connected internally to dsi. > > Note: Refer to the reference manual to know if the dsi is > present on your device. > > Signed-off-by: Philippe Cornu <philippe.cornu@st.com> > --- > Documentation/devicetree/bindings/display/st,stm32-ltdc.txt | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) Acked-by: Rob Herring <robh@kernel.org> ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1 1/2] dt-bindings: display: stm32: add a 2nd endpoint 2017-10-27 14:38 ` Rob Herring @ 2017-11-07 13:58 ` Benjamin Gaignard 0 siblings, 0 replies; 6+ messages in thread From: Benjamin Gaignard @ 2017-11-07 13:58 UTC (permalink / raw) To: Rob Herring Cc: Philippe Cornu, Arnd Bergmann, Russell King, Mark Rutland, Yannick Fertre, Vincent Abriou, David Airlie, devicetree, Linux ARM, dri-devel, Linux Kernel Mailing List, Fabien Dessenne, Mickael Reulier, Gabriel Fernandez, Ludovic Barre, Alexandre Torgue, Maxime Coquelin 2017-10-27 16:38 GMT+02:00 Rob Herring <robh@kernel.org>: > On Thu, Oct 26, 2017 at 01:48:08PM +0200, Philippe Cornu wrote: >> ltdc can have up to 2 endpoints: >> - dpi external gpios: for rgb panels or external bridge ICs. >> - dpi internal ios: connected internally to dsi. >> >> Note: Refer to the reference manual to know if the dsi is >> present on your device. >> >> Signed-off-by: Philippe Cornu <philippe.cornu@st.com> >> --- >> Documentation/devicetree/bindings/display/st,stm32-ltdc.txt | 6 +++++- >> 1 file changed, 5 insertions(+), 1 deletion(-) > > Acked-by: Rob Herring <robh@kernel.org> > Applied on drm-misc-next Thanks Benjamin ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v1 2/2] drm/stm: ltdc: add a 2nd endpoint 2017-10-26 11:48 [PATCH v1 0/2] drm/stm: ltdc: add a 2nd endpoint Philippe Cornu 2017-10-26 11:48 ` [PATCH v1 1/2] dt-bindings: display: stm32: " Philippe Cornu @ 2017-10-26 11:48 ` Philippe Cornu 2017-11-07 13:58 ` Benjamin Gaignard 1 sibling, 1 reply; 6+ messages in thread From: Philippe Cornu @ 2017-10-26 11:48 UTC (permalink / raw) To: Rob Herring, Arnd Bergmann, Russell King, Mark Rutland, Yannick Fertre, Philippe Cornu, Benjamin Gaignard, Vincent Abriou, David Airlie, devicetree, linux-arm-kernel, dri-devel, linux-kernel Cc: Fabien Dessenne, Mickael Reulier, Gabriel Fernandez, Ludovic Barre, Alexandre Torgue, Maxime Coquelin ltdc can have up to 2 endpoints: - dpi external gpios: for rgb panels or external bridge ICs. - dpi internal ios: connected internally to dsi. Note: Refer to the reference manual to know if the dsi is present on your device. Signed-off-by: Philippe Cornu <philippe.cornu@st.com> --- drivers/gpu/drm/stm/ltdc.c | 64 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c index d5c8a42..38a6739 100644 --- a/drivers/gpu/drm/stm/ltdc.c +++ b/drivers/gpu/drm/stm/ltdc.c @@ -33,6 +33,8 @@ #define MAX_IRQ 4 +#define MAX_ENDPOINTS 2 + #define HWVER_10200 0x010200 #define HWVER_10300 0x010300 #define HWVER_20101 0x020101 @@ -886,18 +888,33 @@ int ltdc_load(struct drm_device *ddev) struct ltdc_device *ldev = ddev->dev_private; struct device *dev = ddev->dev; struct device_node *np = dev->of_node; - struct drm_bridge *bridge; - struct drm_panel *panel; + struct drm_bridge *bridge[MAX_ENDPOINTS] = {NULL}; + struct drm_panel *panel[MAX_ENDPOINTS] = {NULL}; struct drm_crtc *crtc; struct reset_control *rstc; struct resource *res; - int irq, ret, i; + int irq, ret, i, endpoint_not_ready = -ENODEV; DRM_DEBUG_DRIVER("\n"); - ret = drm_of_find_panel_or_bridge(np, 0, 0, &panel, &bridge); - if (ret) - return ret; + /* Get endpoints if any */ + for (i = 0; i < MAX_ENDPOINTS; i++) { + ret = drm_of_find_panel_or_bridge(np, 0, i, &panel[i], + &bridge[i]); + + /* + * If at least one endpoint is ready, continue probing, + * else if at least one endpoint is -EPROBE_DEFER and + * there is no previous ready endpoints, defer probing. + */ + if (!ret) + endpoint_not_ready = 0; + else if (ret == -EPROBE_DEFER && endpoint_not_ready) + endpoint_not_ready = -EPROBE_DEFER; + } + + if (endpoint_not_ready) + return endpoint_not_ready; rstc = devm_reset_control_get_exclusive(dev, NULL); @@ -958,19 +975,25 @@ int ltdc_load(struct drm_device *ddev) DRM_INFO("ltdc hw version 0x%08x - ready\n", ldev->caps.hw_version); - if (panel) { - bridge = drm_panel_bridge_add(panel, DRM_MODE_CONNECTOR_DPI); - if (IS_ERR(bridge)) { - DRM_ERROR("Failed to create panel-bridge\n"); - ret = PTR_ERR(bridge); - goto err; + /* Add endpoints panels or bridges if any */ + for (i = 0; i < MAX_ENDPOINTS; i++) { + if (panel[i]) { + bridge[i] = drm_panel_bridge_add(panel[i], + DRM_MODE_CONNECTOR_DPI); + if (IS_ERR(bridge[i])) { + DRM_ERROR("panel-bridge endpoint %d\n", i); + ret = PTR_ERR(bridge[i]); + goto err; + } } - } - ret = ltdc_encoder_init(ddev, bridge); - if (ret) { - DRM_ERROR("Failed to init encoder\n"); - goto err; + if (bridge[i]) { + ret = ltdc_encoder_init(ddev, bridge[i]); + if (ret) { + DRM_ERROR("init encoder endpoint %d\n", i); + goto err; + } + } } crtc = devm_kzalloc(dev, sizeof(*crtc), GFP_KERNEL); @@ -998,7 +1021,8 @@ int ltdc_load(struct drm_device *ddev) return 0; err: - drm_panel_bridge_remove(bridge); + for (i = 0; i < MAX_ENDPOINTS; i++) + drm_panel_bridge_remove(bridge[i]); clk_disable_unprepare(ldev->pixel_clk); @@ -1008,10 +1032,12 @@ int ltdc_load(struct drm_device *ddev) void ltdc_unload(struct drm_device *ddev) { struct ltdc_device *ldev = ddev->dev_private; + int i; DRM_DEBUG_DRIVER("\n"); - drm_of_panel_bridge_remove(ddev->dev->of_node, 0, 0); + for (i = 0; i < MAX_ENDPOINTS; i++) + drm_of_panel_bridge_remove(ddev->dev->of_node, 0, i); clk_disable_unprepare(ldev->pixel_clk); } -- 1.9.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v1 2/2] drm/stm: ltdc: add a 2nd endpoint 2017-10-26 11:48 ` [PATCH v1 2/2] drm/stm: ltdc: " Philippe Cornu @ 2017-11-07 13:58 ` Benjamin Gaignard 0 siblings, 0 replies; 6+ messages in thread From: Benjamin Gaignard @ 2017-11-07 13:58 UTC (permalink / raw) To: Philippe Cornu Cc: Rob Herring, Arnd Bergmann, Russell King, Mark Rutland, Yannick Fertre, Vincent Abriou, David Airlie, devicetree, Linux ARM, dri-devel, Linux Kernel Mailing List, Fabien Dessenne, Mickael Reulier, Gabriel Fernandez, Ludovic Barre, Alexandre Torgue, Maxime Coquelin 2017-10-26 13:48 GMT+02:00 Philippe Cornu <philippe.cornu@st.com>: > ltdc can have up to 2 endpoints: > - dpi external gpios: for rgb panels or external bridge ICs. > - dpi internal ios: connected internally to dsi. > > Note: Refer to the reference manual to know if the dsi is > present on your device. Applied on drm-misc-next Thanks Benjamin > Signed-off-by: Philippe Cornu <philippe.cornu@st.com> > --- > drivers/gpu/drm/stm/ltdc.c | 64 ++++++++++++++++++++++++++++++++-------------- > 1 file changed, 45 insertions(+), 19 deletions(-) > > diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c > index d5c8a42..38a6739 100644 > --- a/drivers/gpu/drm/stm/ltdc.c > +++ b/drivers/gpu/drm/stm/ltdc.c > @@ -33,6 +33,8 @@ > > #define MAX_IRQ 4 > > +#define MAX_ENDPOINTS 2 > + > #define HWVER_10200 0x010200 > #define HWVER_10300 0x010300 > #define HWVER_20101 0x020101 > @@ -886,18 +888,33 @@ int ltdc_load(struct drm_device *ddev) > struct ltdc_device *ldev = ddev->dev_private; > struct device *dev = ddev->dev; > struct device_node *np = dev->of_node; > - struct drm_bridge *bridge; > - struct drm_panel *panel; > + struct drm_bridge *bridge[MAX_ENDPOINTS] = {NULL}; > + struct drm_panel *panel[MAX_ENDPOINTS] = {NULL}; > struct drm_crtc *crtc; > struct reset_control *rstc; > struct resource *res; > - int irq, ret, i; > + int irq, ret, i, endpoint_not_ready = -ENODEV; > > DRM_DEBUG_DRIVER("\n"); > > - ret = drm_of_find_panel_or_bridge(np, 0, 0, &panel, &bridge); > - if (ret) > - return ret; > + /* Get endpoints if any */ > + for (i = 0; i < MAX_ENDPOINTS; i++) { > + ret = drm_of_find_panel_or_bridge(np, 0, i, &panel[i], > + &bridge[i]); > + > + /* > + * If at least one endpoint is ready, continue probing, > + * else if at least one endpoint is -EPROBE_DEFER and > + * there is no previous ready endpoints, defer probing. > + */ > + if (!ret) > + endpoint_not_ready = 0; > + else if (ret == -EPROBE_DEFER && endpoint_not_ready) > + endpoint_not_ready = -EPROBE_DEFER; > + } > + > + if (endpoint_not_ready) > + return endpoint_not_ready; > > rstc = devm_reset_control_get_exclusive(dev, NULL); > > @@ -958,19 +975,25 @@ int ltdc_load(struct drm_device *ddev) > > DRM_INFO("ltdc hw version 0x%08x - ready\n", ldev->caps.hw_version); > > - if (panel) { > - bridge = drm_panel_bridge_add(panel, DRM_MODE_CONNECTOR_DPI); > - if (IS_ERR(bridge)) { > - DRM_ERROR("Failed to create panel-bridge\n"); > - ret = PTR_ERR(bridge); > - goto err; > + /* Add endpoints panels or bridges if any */ > + for (i = 0; i < MAX_ENDPOINTS; i++) { > + if (panel[i]) { > + bridge[i] = drm_panel_bridge_add(panel[i], > + DRM_MODE_CONNECTOR_DPI); > + if (IS_ERR(bridge[i])) { > + DRM_ERROR("panel-bridge endpoint %d\n", i); > + ret = PTR_ERR(bridge[i]); > + goto err; > + } > } > - } > > - ret = ltdc_encoder_init(ddev, bridge); > - if (ret) { > - DRM_ERROR("Failed to init encoder\n"); > - goto err; > + if (bridge[i]) { > + ret = ltdc_encoder_init(ddev, bridge[i]); > + if (ret) { > + DRM_ERROR("init encoder endpoint %d\n", i); > + goto err; > + } > + } > } > > crtc = devm_kzalloc(dev, sizeof(*crtc), GFP_KERNEL); > @@ -998,7 +1021,8 @@ int ltdc_load(struct drm_device *ddev) > return 0; > > err: > - drm_panel_bridge_remove(bridge); > + for (i = 0; i < MAX_ENDPOINTS; i++) > + drm_panel_bridge_remove(bridge[i]); > > clk_disable_unprepare(ldev->pixel_clk); > > @@ -1008,10 +1032,12 @@ int ltdc_load(struct drm_device *ddev) > void ltdc_unload(struct drm_device *ddev) > { > struct ltdc_device *ldev = ddev->dev_private; > + int i; > > DRM_DEBUG_DRIVER("\n"); > > - drm_of_panel_bridge_remove(ddev->dev->of_node, 0, 0); > + for (i = 0; i < MAX_ENDPOINTS; i++) > + drm_of_panel_bridge_remove(ddev->dev->of_node, 0, i); > > clk_disable_unprepare(ldev->pixel_clk); > } > -- > 1.9.1 > ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-11-07 13:58 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-10-26 11:48 [PATCH v1 0/2] drm/stm: ltdc: add a 2nd endpoint Philippe Cornu 2017-10-26 11:48 ` [PATCH v1 1/2] dt-bindings: display: stm32: " Philippe Cornu 2017-10-27 14:38 ` Rob Herring 2017-11-07 13:58 ` Benjamin Gaignard 2017-10-26 11:48 ` [PATCH v1 2/2] drm/stm: ltdc: " Philippe Cornu 2017-11-07 13:58 ` Benjamin Gaignard
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).