diff options
author | Dave Airlie <airlied@redhat.com> | 2017-12-04 05:38:52 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2017-12-04 05:42:49 +1000 |
commit | 2c1c55cb75a9c72f9726fabb8c3607947711a8df (patch) | |
tree | fa835b954149545970eaa256107876d9a24bbf28 /drivers/gpu/drm/stm/ltdc.c | |
parent | ae64f9bd1d3621b5e60d7363bc20afb46aede215 (diff) | |
parent | 2f51be0945b9e0b9baafe47289c802be6d4c7980 (diff) |
Merge tag 'drm-misc-next-2017-11-30' of git://anongit.freedesktop.org/drm/drm-misc into drm-next
Cross-subsystem Changes:
- device tree doc for the Mitsubishi AA070MC01 and Tianma TM070RVHG71
panels (Lukasz Majewski) and for a 2nd endpoint on stm32 (Philippe Cornu)
Core Changes:
The most important changes are:
- Add drm_driver .last_close and .output_poll_changed helpers to reduce
fbdev emulation footprint in drivers (Noralf)
- Fix plane clipping in core and for vmwgfx (Ville)
Then we have a bunch of of improvement for print and debug such as the
addition of a framebuffer debugfs file. ELD connector, HDMI and
improvements. And a bunch of misc improvements, clean ups and style
changes and doc updates
[airlied: drop eld bits from amdgpu_dm]
Driver Changes:
- sii8620: filter unsupported modes and add DVI mode support (Maciej Purski)
- rockchip: analogix_dp: Remove unnecessary init code (Jeffy Chen)
- virtio, cirrus: add fb create_handle support to enable screenshots(Lepton Wu)
- virtio: replace reference/unreference with get/put (Aastha Gupta)
- vc4, gma500: Convert timers to use timer_setup() (Kees Cook)
- vc4: Reject HDMI modes with too high of clocks (Eric)
- vc4: Add support for more pixel formats (Dave Stevenson)
- stm: dsi: Rename driver name to "stm32-display-dsi" (Philippe Cornu)
- stm: ltdc: add a 2nd endpoint (Philippe Cornu)
- via: use monotonic time for VIA_WAIT_IRQ (Arnd Bergmann)
* tag 'drm-misc-next-2017-11-30' of git://anongit.freedesktop.org/drm/drm-misc: (96 commits)
drm/bridge: tc358767: add copyright lines
MAINTAINERS: change maintainer for Rockchip drm drivers
drm/vblank: Fix vblank timestamp debugs
drm/via: use monotonic time for VIA_WAIT_IRQ
dma-buf: Fix ifnullfree.cocci warnings
drm/printer: Add drm_vprintf()
drm/edid: Allow HDMI infoframe without VIC or S3D
video/hdmi: Allow "empty" HDMI infoframes
dma-buf/fence: Fix lock inversion within dma-fence-array
drm/sti: Handle return value of platform_get_irq_byname
drm/vc4: Add support for NV21 and NV61.
drm/vc4: Use .pixel_order instead of custom .flip_cbcr
drm/vc4: Add support for DRM_FORMAT_RGB888 and DRM_FORMAT_BGR888
drm: Move drm_plane_helper_check_state() into drm_atomic_helper.c
drm: Check crtc_state->enable rather than crtc->enabled in drm_plane_helper_check_state()
drm/vmwgfx: Try to fix plane clipping
drm/vmwgfx: Use drm_plane_helper_check_state()
drm/vmwgfx: Remove bogus crtc coords vs fb size check
gpu: gma500: remove unneeded DRIVER_LICENSE #define
drm: don't link DP aux i2c adapter to the hardware device node
...
Diffstat (limited to 'drivers/gpu/drm/stm/ltdc.c')
-rw-r--r-- | drivers/gpu/drm/stm/ltdc.c | 66 |
1 files changed, 46 insertions, 20 deletions
diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c index 735c9081202a..35e884239f60 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 @@ -556,7 +558,7 @@ static int ltdc_plane_atomic_check(struct drm_plane *plane, src_h = state->src_h >> 16; /* Reject scaling */ - if ((src_w != state->crtc_w) || (src_h != state->crtc_h)) { + if (src_w != state->crtc_w || src_h != state->crtc_h) { DRM_ERROR("Scaling is not supported"); return -EINVAL; } @@ -856,18 +858,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); @@ -928,19 +945,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); @@ -968,7 +991,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); @@ -978,10 +1002,12 @@ err: 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); } |