path: root/drivers/gpu/drm/msm/dsi/dsi_manager.c
AgeCommit message (Collapse)AuthorFilesLines
2020-08-08drm: Remove unnecessary drm_panel_attach and drm_panel_detachJoe Perches1-1/+0
These functions are now empty and no longer useful so remove the functions and their uses. Signed-off-by: Joe Perches <> Cc: Bernard Zhao <> Cc: Maarten Lankhorst <> Cc: Maxime Ripard <>, Cc: Thomas Zimmermann <> Cc: Thierry Reding <> Cc: David Airlie <> Cc: Daniel Vetter <> Cc: Linus Walleij <> Cc: Icenowy Zheng <>, Cc: Jagan Teki <> Cc: Laurent Pinchart <> Cc: Robert Chiras <> Cc:, Cc: Cc: Signed-off-by: Sam Ravnborg <> # Fixed build and a few warnings Link:
2020-03-11Merge v5.6-rc5 into drm-nextDave Airlie1-1/+6
Requested my mripard for some misc patches that need this as a base. Signed-off-by: Dave Airlie <>
2020-02-26drm/bridge: Extend bridge API to disable connector creationLaurent Pinchart1-2/+2
Most bridge drivers create a DRM connector to model the connector at the output of the bridge. This model is historical and has worked pretty well so far, but causes several issues: - It prevents supporting more complex display pipelines where DRM connector operations are split over multiple components. For instance a pipeline with a bridge connected to the DDC signals to read EDID data, and another one connected to the HPD signal to detect connection and disconnection, will not be possible to support through this model. - It requires every bridge driver to implement similar connector handling code, resulting in code duplication. - It assumes that a bridge will either be wired to a connector or to another bridge, but doesn't support bridges that can be used in both positions very well (although there is some ad-hoc support for this in the analogix_dp bridge driver). In order to solve these issues, ownership of the connector should be moved to the display controller driver (where it can be implemented using helpers provided by the core). Extend the bridge API to allow disabling connector creation in bridge drivers as a first step towards the new model. The new flags argument to the bridge .attach() operation allows instructing the bridge driver to skip creating a connector. Unconditionally set the new flags argument to 0 for now to keep the existing behaviour, and modify all existing bridge drivers to return an error when connector creation is not requested as they don't support this feature yet. The change is based on the following semantic patch, with manual review and edits. @ rule1 @ identifier funcs; identifier fn; @@ struct drm_bridge_funcs funcs = { ..., .attach = fn }; @ depends on rule1 @ identifier rule1.fn; identifier bridge; statement S, S1; @@ int fn( struct drm_bridge *bridge + , enum drm_bridge_attach_flags flags ) { ... when != S + if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR) { + DRM_ERROR("Fix bridge driver to make connector optional!"); + return -EINVAL; + } + S1 ... } @ depends on rule1 @ identifier rule1.fn; identifier bridge, flags; expression E1, E2, E3; @@ int fn( struct drm_bridge *bridge, enum drm_bridge_attach_flags flags ) { <... drm_bridge_attach(E1, E2, E3 + , flags ) ...> } @@ expression E1, E2, E3; @@ drm_bridge_attach(E1, E2, E3 + , 0 ) Signed-off-by: Laurent Pinchart <> Reviewed-by: Boris Brezillon <> Acked-by: Sam Ravnborg <> Reviewed-by: Tomi Valkeinen <> Tested-by: Sebastian Reichel <> Reviewed-by: Sebastian Reichel <> Acked-by: Daniel Vetter <> Signed-off-by: Tomi Valkeinen <> Link:
2020-02-13drm/msm/dsi: save pll state before dsi host is powered offHarigovindan P1-0/+5
Save pll state before dsi host is powered off. Without this change some register values gets resetted. Signed-off-by: Harigovindan P <> Signed-off-by: Rob Clark <>
2020-02-11drm: msm: Fix return type of dsi_mgr_connector_mode_valid for kCFIJohn Stultz1-1/+1
I was hitting kCFI crashes when building with clang, and after some digging finally narrowed it down to the dsi_mgr_connector_mode_valid() function being implemented as returning an int, instead of an enum drm_mode_status. This patch fixes it, and appeases the opaque word of the kCFI gods (seriously, clang inlining everything makes the kCFI backtraces only really rough estimates of where things went wrong). Thanks as always to Sami for his help narrowing this down. Cc: Rob Clark <> Cc: Sean Paul <> Cc: Sami Tolvanen <> Cc: Todd Kjos <> Cc: Alistair Delva <> Cc: Amit Pundir <> Cc: Sumit Semwal <> Cc: Cc: Signed-off-by: John Stultz <> Reviewed-by: Nick Desaulniers <> Tested-by: Amit Pundir <> Signed-off-by: Rob Clark <>
2020-01-20Merge tag 'drm-msm-next-2020-01-14' of ↵Dave Airlie1-21/+41 into drm-next + sc7180 display + DSI support + a618 (sc7180) support + more UBWC (bandwidth compression) support + various cleanups to handle devices that use vs don't use zap fw, etc + usual random cleanups and fixes Signed-off-by: Dave Airlie <> From: Rob Clark <> Link: <
2020-01-02drm/msm/dsi: Delay drm_panel_enable() until dsi_mgr_bridge_enable()Stephan Gerhold1-21/+41
At the moment, the MSM DSI driver calls drm_panel_enable() rather early from the DSI bridge pre_enable() function. At this point, the encoder (e.g. MDP5) is not enabled, so we have not started transmitting video data. However, the drm_panel_funcs documentation states that enable() should be called on the panel *after* video data is being transmitted: The .prepare() function is typically called before the display controller starts to transmit video data. [...] After the display controller has started transmitting video data, it's safe to call the .enable() function. This will typically enable the backlight to make the image on screen visible. Calling drm_panel_enable() too early causes problems for some panels: The TFT LCD panel used in the Samsung Galaxy Tab A 9.7 (2015) (APQ8016) uses the MIPI_DCS_SET_DISPLAY_BRIGHTNESS command to control backlight/brightness of the screen. The enable sequence is therefore: drm_panel_enable() drm_panel_funcs.enable(): backlight_enable() backlight_ops.update_status(): mipi_dsi_dcs_set_display_brightness(dsi, bl->props.brightness); The panel seems to silently ignore the MIPI_DCS_SET_DISPLAY_BRIGHTNESS command if it is sent too early. This prevents setting the initial brightness, causing the display to be enabled with minimum brightness instead. Adding various delays in the panel initialization code does not result in any difference. On the other hand, moving drm_panel_enable() to dsi_mgr_bridge_enable() fixes the problem, indicating that the panel requires the video stream to be active before the brightness command is accepted. Therefore: Move drm_panel_enable() to dsi_mgr_bridge_enable() to delay calling it until video data is being transmitted. Move drm_panel_disable() to dsi_mgr_bridge_disable() for similar reasons. (This is not strictly required for the panel affected above...) Tested-by: Jasper Korten <> Signed-off-by: Stephan Gerhold <> Tested-by: Jeffrey Hugo <> Reviewed-by: Jeffrey Hugo <> Signed-off-by: Rob Clark <>
2019-12-09drm/panel: decouple connector from drm_panelSam Ravnborg1-1/+1
To facilitate moving connector creation to display drivers, decouple the drm_connector from drm_panel. This patch adds a connector argument to drm_panel_get_modes(). All users of drm_panel_get_modes() already had the connector available, so updating users was trivial. With this patch drm_panel no longer keeps a reference to the drm_connector. Signed-off-by: Sam Ravnborg <> Reviewed-by: Laurent Pinchart <> Reviewed-by: Linus Walleij <> Acked-by: Jeffrey Hugo <> Cc: Thierry Reding <> Cc: Laurent Pinchart <> Cc: Sam Ravnborg <> Cc: Andrzej Hajda <> Cc: Neil Armstrong <> Cc: Jonas Karlman <> Cc: Jernej Skrabec <> Cc: Maarten Lankhorst <> Cc: Maxime Ripard <> Cc: David Airlie <> Cc: Daniel Vetter <> Cc: Inki Dae <> Cc: Joonyoung Shim <> Cc: Seung-Woo Kim <> Cc: Kyungmin Park <> Cc: Kukjin Kim <> Cc: Krzysztof Kozlowski <> Cc: Stefan Agner <> Cc: Alison Wang <> Cc: Philipp Zabel <> Cc: Shawn Guo <> Cc: Sascha Hauer <> Cc: Pengutronix Kernel Team <> Cc: Fabio Estevam <> Cc: NXP Linux Team <> Cc: CK Hu <> Cc: Matthias Brugger <> Cc: Marek Vasut <> Cc: Tomi Valkeinen <> Cc: Kieran Bingham <> Cc: Sandy Huang <> Cc: "Heiko Stübner" <> Cc: Benjamin Gaignard <> Cc: Vincent Abriou <> Cc: Chen-Yu Tsai <> Cc: Jonathan Hunter <> Cc: Torsten Duwe <> Cc: Vasily Khoruzhick <> Cc: Icenowy Zheng <> Cc: Sean Paul <> Cc: Linus Walleij <> Cc: Boris Brezillon <> Cc: Hariprasad Kelam <> Cc: Alexios Zavras <> Cc: Brian Masney <> Cc: Rob Clark <> Cc: Thomas Gleixner <> Cc: Allison Randal <> Cc: Shayenne Moura <> Cc: Abhinav Kumar <> Cc: Cc: Cc: Cc: Cc: Cc: Link:
2019-06-28Merge tag 'drm-msm-next-2019-06-25' of ↵Dave Airlie1-76/+73 into drm-next + usual progress on cleanups + dsi vs EPROBE_DEFER fixes + msm8998 (snapdragon 835 support) + a540 gpu support (mesa support already landed) + dsi, dsi-phy support + mdp5 and dpu interconnect (bus/memory scaling) support + initial prep work for per-context pagetables (at least the parts that don't have external dependencies like iommu/arm-smmu) There is one more patch for fixing DSI cmd mode panels (part of a set of patches to get things working on nexus5), but it would be conflicty with 1cff7440a86e04a613665803b42034 in drm-next without rebasing or back-merge, and since it doesn't conflict with anything in msm-next, I think it best if Sean merges that through drm-mix-fixes instead. (In other news, I've been making some progress w/ getting efifb working properly on sdm850 laptop without horrible hacks, and drm/msm + clk stuff not totally falling over when bootloader enables display and things are already running when driver probes.. but not quite ready yet, hopefully we can post some of that for 5.4.. should help for both the sdm835 and sdm850 laptops.) Signed-off-by: Dave Airlie <> From: Rob Clark <> Link:
2019-06-20drm/msm/dsi: Move setup_encoder to modeset_initSean Paul1-35/+2
Now that the panel probe/setup is in the modeset path, we can call dsi_manager_setup_encoder() in a common place for both internal and external bridge setups. Reviewed-by: Rob Clark <> Signed-off-by: Sean Paul <> Link:
2019-06-20drm/msm/dsi: Move dsi panel init into modeset init pathSean Paul1-7/+10
Since deferred probe from the modeset init path now works, we can move the panel initialization from detect() into connector init. This avoids doing work in detect() and hopefully will result in a more deterministic boot sequence between devices with a dsi panel, and those with an external bridge. Reviewed-by: Rob Clark <> Signed-off-by: Sean Paul <> Link:
2019-06-20drm/msm/dsi: Use the new setup_encoder function in attach_dsi_deviceSean Paul1-13/+2
Now that we have a function to call set_encoder_mode() for us, use it. Reviewed-by: Rob Clark <> Signed-off-by: Sean Paul <> Link:
2019-06-20drm/msm/dsi: Simplify the logic in msm_dsi_manager_panel_init()Sean Paul1-41/+59
This patch moves things around a bit to be a little more readable and pulls out the set_encoder_mode() call into its own function for later use. Reviewed-by: Rob Clark <> Signed-off-by: Sean Paul <> Link:
2019-06-20drm/msm/dsi: Pull out panel init code into functionSean Paul1-4/+12
Pull all of the panel init code out of detect() and put it in its own function. This will be useful in future patches where it's moved from detect(). Reviewed-by: Rob Clark <> Signed-off-by: Sean Paul <> Link:
2019-06-20drm/msm/dsi: Don't store dsi host mode_flags in msm_dsiSean Paul1-8/+9
It's a bit dangerous to store the flags in msm_dsi since there's no way to tell when they're populated. Fortunately the only place that uses them is the same place that fills them. So just use a local variable and delete the struct member. Reviewed-by: Rob Clark <> Signed-off-by: Sean Paul <> Link:
2019-06-20drm/msm/dsi: Split mode_flags out of msm_dsi_host_get_panel()Sean Paul1-3/+4
We use the flags in more places than just get_panel, so split them out into a separate function. Reviewed-by: Rob Clark <> Signed-off-by: Sean Paul <> Link:
2019-06-18drm/msm/dsi: add protection against NULL dsi deviceAbhinav Kumar1-1/+11
When panel probe happens after DSI probe, the DSI probe is deferred as per current design. In the probe defer path dsi device is destroyed. This NULL dsi device could be deferenced by the panel probe in the mipi_dsi_attach path. Check for NULL dsi device before accessing it. Changes in v2: - Add more comments on how this NULL pointer situation will be hit Reported-by: Jeffrey Hugo <> Tested-by: Jeffrey Hugo <> Signed-off-by: Abhinav Kumar <> Signed-off-by: Rob Clark <>
2019-06-05treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 284Thomas Gleixner1-9/+1
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 and only version 2 as published by the free software foundation this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 294 file(s). Signed-off-by: Thomas Gleixner <> Reviewed-by: Allison Randal <> Reviewed-by: Alexios Zavras <> Cc: Link: Signed-off-by: Greg Kroah-Hartman <>
2019-01-18Merge tag 'drm-misc-next-2019-01-16' of ↵Dave Airlie1-8/+1
git:// into drm-next drm-misc-next for 5.1: UAPI Changes: - New fourcc identifier for ARM Framebuffer Compression v1.3 Cross-subsystem Changes: Core Changes: - Reorganisation of drm_device and drm_framebuffer headers - Cleanup of the drmP inclusion - Fix leaks in the fb-helpers - Allow for depth different from bpp in fb-helper fbdev emulation - Remove drm_mode_object from drm_display_mode Driver Changes: - Add reflection properties to rockchip - a bunch of fixes for virtio - a bunch of fixes for dp_mst and drivers using it, and introduction of a new refcounting scheme - Convertion of bochs to atomic and generic fbdev emulation - Allow meson to remove the firmware framebuffers [airlied: patch rcar-du to add drm_modes.h] Signed-off-by: Dave Airlie <> From: Maxime Ripard <> Link:
2019-01-14drm: bridge: Constify mode arguments to bridge .mode_set() operationLaurent Pinchart1-2/+2
The mode and ajusted_mode passed to the bridge .mode_set() operation should never be modified by the bridge (and are not in any of the existing bridge drivers). Make them const to make this clear. Signed-off-by: Laurent Pinchart <> Reviewed-by: Daniel Vetter <>
2019-01-10drm: msm: Cleanup drm_display_mode print strShayenne Moura1-8/+1
This patch adjust the print string of drm_display_mode object to remove drm_mode_object dependency in msm files. Reported-by: kbuild test robot <> Signed-off-by: Shayenne Moura <> Signed-off-by: Daniel Vetter <> Link:
2018-10-03drm/msm: dsi: Initialize msm_dsi->id to -1Sean Paul1-1/+3
Currently msm_dsi->id is initialized to 0 during kzalloc. If bind fails for a secondary dsi device before its id can be properly set (such as during dt parsing), the id will point to the primary dsi device, causing its reference to be removed from dsi_manager's global (msm_dsim_glb) array. This patch initializes the id to -1 and checks for negative in the manager cleanup. Cc: Doug Anderson <> Reviewed-by: Abhinav Kumar <> Signed-off-by: Sean Paul <> Signed-off-by: Rob Clark <>
2018-07-26drm/msm/dsi: set encoder mode for DRM bridge explicitlyAbhinav Kumar1-2/+4
Currently, DRM bridge for DPU relies on the default video mode setting to set the encoder mode. Add an explicit call to set the encoder mode for bridges. Changes in v3: - None Reviewed-by: Archit Taneja <> Signed-off-by: Abhinav Kumar <> Signed-off-by: Sean Paul <> Signed-off-by: Rob Clark <>
2018-07-26drm/msm/dsi: Use one connector for dual DSI modeChandan Uddaraju1-86/+26
Current DSI driver uses two connectors for dual DSI case even though we only have one panel. Fix this by implementing one connector/bridge for dual DSI use case. Use master DSI controllers to register one connector/bridge. Changes in v3: - None Reviewed-by: Archit Taneja <> Signed-off-by: Chandan Uddaraju <> [seanpaul removed unused local var causing a build warning] Signed-off-by: Sean Paul <> Signed-off-by: Rob Clark <>
2018-07-26drm/msm/dsi: adjust dsi timing for dual dsi modeChandan Uddaraju1-3/+4
For dual dsi mode, the horizontal timing needs to be divided by half since both the dsi controllers will be driving this panel. Adjust the pixel clock and DSI timing accordingly. Changes in v3: - Added Archit's R-b - Rebase on dsi cleanup set in msm-next Cc: Sibi Sankar <> Reviewed-by: Archit Taneja <> Signed-off-by: Chandan Uddaraju <> Signed-off-by: Sean Paul <> Signed-off-by: Rob Clark <>
2018-07-13drm: drop _mode_ from remaining connector functionsDaniel Vetter1-1/+1
Since there's very few callers of these I've decided to do them all in one patch. With this the unecessarily long drm_mode_connector_ prefix is gone from the codebase! The only exception being struct drm_mode_connector_set_property, which is part of the uapi so can't be renamed. Again done with sed+some manual fixups for indent issues. Reviewed-by: Sean Paul <> Signed-off-by: Daniel Vetter <> Link:
2018-07-13drm: drop _mode_ from drm_mode_connector_attach_encoderDaniel Vetter1-1/+1
Again to align with the usual prefix of just drm_connector_. Again done with sed + manual fixup for indent issues. Reviewed-by: Sean Paul <> Signed-off-by: Daniel Vetter <> Link:
2018-07-05drm/msm: Use drm_connector_has_possible_encoder()Ville Syrjälä1-6/+2
Use drm_connector_has_possible_encoder() for checking whether the encoder has an associated connector. v2: Replace the drm_for_each_connector_encoder_ids() loop with a simple drm_connector_has_possible_encoder() call Cc: Rob Clark <> Cc: Cc: Signed-off-by: Ville Syrjälä <> Link: Reviewed-by: Alex Deucher <>
2018-02-20drm/msm/dsi: correct DSI id bounds check during registrationLloyd Atkinson1-1/+1
Check DSI instance id argument against the proper boundary size to protect against invalid configuration of the DSI id. Signed-off-by: Lloyd Atkinson <> Signed-off-by: Rob Clark <>
2018-02-20drm/msm/dsi: check for failure on retrieving pll in dsi managerLloyd Atkinson1-0/+4
Make msm_dsi_pll_init consistently return an error code instead of NULL when pll initialization fails so that later pll retrieval can check against an error code. Add checks for these failures after retrieval of src_pll to avoid invalid pointer dereferences later in msm_dsi_pll_get_clk_provider. Signed-off-by: Lloyd Atkinson <> Signed-off-by: Rob Clark <>
2017-08-08drm: Nuke drm_atomic_helper_connector_dpmsDaniel Vetter1-1/+0
It's dead code, the core handles all this directly now. The only special case is nouveau and tda988x which used one function for both legacy modeset code and -nv50 atomic world instead of 2 vtables. But amounts to exactly the same. v2: Rebase over the panel/brideg refactorings in stm/ltdc. Signed-off-by: Daniel Vetter <> Cc: Archit Taneja <> Cc: Andrzej Hajda <> Cc: Laurent Pinchart <> Cc: Peter Senna Tschudin <> Cc: Martin Donnelly <> Cc: Martyn Welch <> Cc: Daniel Vetter <> Cc: Jani Nikula <> Cc: Sean Paul <> Cc: David Airlie <> Cc: Inki Dae <> Cc: Joonyoung Shim <> Cc: Seung-Woo Kim <> Cc: Kyungmin Park <> Cc: Kukjin Kim <> Cc: Krzysztof Kozlowski <> Cc: Stefan Agner <> Cc: Alison Wang <> Cc: Russell King <> Cc: Philipp Zabel <> Cc: CK Hu <> Cc: Matthias Brugger <> Cc: Neil Armstrong <> Cc: Carlo Caione <> Cc: Kevin Hilman <> Cc: Marek Vasut <> Cc: Ben Skeggs <> Cc: Tomi Valkeinen <> Cc: Eric Anholt <> Cc: Mark Yao <> Cc: Heiko Stuebner <> Cc: Benjamin Gaignard <> Cc: Vincent Abriou <> Cc: Yannick Fertre <> Cc: Philippe Cornu <> Cc: Maxime Ripard <> Cc: Chen-Yu Tsai <> Cc: Thierry Reding <> Cc: Jonathan Hunter <> Cc: Jyri Sarha <> Cc: Gerd Hoffmann <> Cc: Shawn Guo <> Cc: John Stultz <> Cc: Lars-Peter Clausen <> Cc: Sergei Shtylyov <> Cc: Jeffy Chen <> Cc: Tomeu Vizoso <> Cc: Yakir Yang <> Cc: Marek Szyprowski <> Cc: Jose Abreu <> Cc: Romain Perier <> Cc: Kieran Bingham <> Cc: Xinliang Liu <> Cc: Alexey Brodkin <> Cc: Alex Deucher <> Cc: Rongrong Zou <> Cc: Rob Clark <> Cc: Hai Li <> Cc: "Noralf Trønnes" <> Cc: Cc: Cc: Cc: Cc: Cc: Cc: Cc: Cc: Cc: Cc: zain wang <> Cc: Baoyou Xie <> Cc: Boris Brezillon <> Reviewed-by: Maarten Lankhorst <> Link: Acked-by: Neil Armstrong <> Reviewed-by: Neil Armstrong <> Acked-by: Philipp Zabel <> Acked-by: Archit Taneja <> Tested-by: Philippe Cornu <> (on stm) Reviewed-by: Laurent Pinchart <> Acked-by: Shawn Guo <> Acked-by: Shawn Guo <> Acked-by: Noralf Trønnes <> Acked-by: Vincent Abriou <>
2017-04-03drm/msm/dsi: Fix bug in dsi_mgr_phy_enableArchit Taneja1-1/+1
A recent commit introduces a bug in dsi_mgr_phy_enable. In the non dual DSI mode, we reset the mdsi (master DSI) PHY. This isn't right since master and slave DSI exist only in dual DSI mode. For the normal mode of operation, we should simply reset the PHY of the DSI device (i.e. msm_dsi) corresponding to the current bridge. Usage of the wrong DSI pointer also resulted in a static checker warning. That too is resolved with this fix. Fixes: b62aa70a98c5 (drm/msm/dsi: Move PHY operations out of host) Reported-by: Dan Carpenter <> Signed-off-by: Archit Taneja <> Reviewed-by: Rob Clark <> Signed-off-by: Rob Clark <>
2017-02-06drm/msm/dsi: Move PHY operations out of hostHai Li1-73/+105
Since DSI PHY has been a separate platform device, it should not depend on the resources in host to be functional. This change is to trigger PHY operations in manager, instead of host, so that host and PHY can be completely separated. Signed-off-by: Hai Li <> Signed-off-by: Archit Taneja <> Signed-off-by: Rob Clark <>
2017-02-06drm/msm/dsi: Reset both PHYs before clock operation for dual DSIArchit Taneja1-3/+29
In case of dual DSI, some registers in PHY1 have been programmed during PLL0 clock's set_rate. The PHY1 reset called by host1 later will silently reset those PHY1 registers. This change is to reset and enable both PHYs before any PLL clock operation. [Originally worked on by Hai Li <>. Fixed up by Archit Taneja <>] Signed-off-by: Archit Taneja <> Signed-off-by: Rob Clark <>
2017-02-06drm/msm/dsi: Pass down use case to PHYHai Li1-29/+14
For some new types of DSI PHY, more settings depend on use cases controlled by DSI manager. This change allows DSI manager to setup PHY with a use case. Signed-off-by: Hai Li <> Signed-off-by: Archit Taneja <> Signed-off-by: Rob Clark <>
2017-02-06drm/msm/dsi: Return more timings from PHY to hostHai Li1-2/+2
The DSI host is required to configure more timings calculated in PHY. By introducing a shared structure, this change allows more timing information passed from PHY to host. Signed-off-by: Hai Li <> Signed-off-by: Archit Taneja <> Signed-off-by: Rob Clark <>
2017-02-06drm/msm: Set encoder's mode of operation using a kms funcArchit Taneja1-0/+37
The mdp5 kms driver currently sets up multiple encoders per interface (INTF), one for each kind of mode of operation it supports. We create 2 drm_encoders for DSI, one for Video Mode and the other for Command Mode operation. The reason behind this approach could have been that we aren't aware of the DSI device's mode of operation when we create the encoders. This makes things a bit complicated, since these encoders have to be further attached to the same DSI bridge. The easier way out is to create a single encoder, and make the DSI driver set its mode of operation when we know what the DSI device's mode flags are. Start with providing a way to set the mdp5_intf_mode using a kms func that sets the encoder's mode of operation. When constructing a DSI encoder, we set the mode of operation to Video Mode as default. When the DSI device is attached to the host, we probe the DSI mode flags and set the corresponding mode of operation. Signed-off-by: Archit Taneja <> Signed-off-by: Rob Clark <>
2017-02-06drm/msm: Construct only one encoder for DSIArchit Taneja1-18/+4
We currently create 2 encoders for DSI interfaces, one for command mode and other for video mode operation. This isn't needed as we can't really use both the encoders at the same time. It also makes connecting bridges harder. Switch to creating a single encoder. For now, we assume that the encoder is configured only in video mode. Later, the same encoder would be usable in both modes. Signed-off-by: Archit Taneja <> Signed-off-by: Rob Clark <>
2016-12-18drm: bridge: Link encoder and bridge in core codeLaurent Pinchart1-6/+11
Instead of linking encoders and bridges in every driver (and getting it wrong half of the time, as many drivers forget to set the drm_bridge encoder pointer), do so in core code. The drm_bridge_attach() function needs the encoder and optional previous bridge to perform that task, update all the callers. Signed-off-by: Laurent Pinchart <> Acked-by: Stefan Agner <> # For DCU Acked-by: Boris Brezillon <> # For atmel-hlcdc Acked-by: Vincent Abriou <> # For STI Acked-by: Maxime Ripard <> # For sun4i Acked-by: Xinliang Liu <> # For hisilicon Acked-by: Jyri Sarha <> # For tilcdc Reviewed-by: Daniel Vetter <> Signed-off-by: Archit Taneja <> Link:
2016-05-08drm/msm: Centralize connector registration/unregistrationArchit Taneja1-18/+9
Move the drm_connector registration from the encoder(HDMI/DSI etc) drivers to the msm platform driver. This will simplify the task of ensuring that the connectors are registered only after the drm_device itself is registered. The connectors' destroy ops are made to use kzalloc instead of devm_kzalloc to ensure that that the connectors can be successfully unregistered when the msm driver module is removed. The memory for the connectors is unallocated when drm_mode_config_cleanup() is called during either during an error or during driver remove. Signed-off-by: Archit Taneja <> Signed-off-by: Rob Clark <>
2015-12-14drm/msm/dsi: Don't use iommu for command TX buffer for DSIv2Archit Taneja1-3/+3
We currently use iommu allocated DMA buffers for sending DSI commands. DSIv2 doesn't have a port connected to the MDP iommu. Therefore, it can't use iommu allocated buffers to fetch DSI commands. Use a regular contiguous DMA buffer if we are DSIv2. Signed-off-by: Archit Taneja <> Signed-off-by: Rob Clark <>
2015-08-15drm/msm/dsi: Modify dsi manager bridge ops to work with external bridgesArchit Taneja1-15/+28
The dsi bridge ops call drm_panel functions to set up the connected drm_panel. Add checks to make sure these aren't called when we're connected to an external bridge. Signed-off-by: Archit Taneja <> Signed-off-by: Rob Clark <>
2015-08-15drm/msm/dsi: Allow dsi to connect to an external bridgeArchit Taneja1-1/+48
There are platforms where the DSI output can be connected to another encoder bridge chip (DSI to HDMI, DSI to LVDS etc). Add support for external bridge support to the dsi driver. We assume that the external bridge chip would be of the type drm_bridge. The dsi driver's internal drm_bridge (msm_dsi->bridge) is linked to the external bridge's drm_bridge struct. In the case we're connected to an external bridge, we don't need to create and manage a connector within our driver, it's the bridge driver's responsibility to create one. v2: - Move the external bridge attaching stuff to dsi manager to make things cleaner. - Force the bridge to connect to a video mode encoder for now (the dsi mode flags may have not been populated by modeset_init) Signed-off-by: Archit Taneja <> Signed-off-by: Rob Clark <>
2015-08-15drm/msm/dsi: Create a helper to check if there is a connected deviceArchit Taneja1-2/+4
Create a helper msm_dsi_device_connected() which checks whether we have a device connected to the dsi host or not. This check gets messy when we have support external bridges too. Having an inline function makes it more legible. For now, the check only consists of msm_dsi->panel being non-NULL. Later, this will check if we have an external bridge or not. This helper isn't used in dsi_connector related code as that's specific to only when a drm_panel is connected. Signed-off-by: Archit Taneja <> Signed-off-by: Rob Clark <>
2015-08-15drm/msm/dsi: Refer to connected device as 'device' instead of 'panel'Archit Taneja1-2/+2
We currently support only panels connected to dsi output. We're going to also support external bridge chips now. Change 'panel_node' to 'device_node' in the struct msm_dsi_host and 'panel_flags' to 'device_flags' in msm_dsi. This makes things sound a bit more generic. Signed-off-by: Archit Taneja <> Signed-off-by: Rob Clark <>
2015-08-15drm/msm/dsi: Save/Restore PLL status across PHY resetHai Li1-0/+21
Reset DSI PHY silently changes its PLL registers to reset status, which will make cached status in clock driver invalid and result in wrong output rate of link clocks. The current restore mechanism in DSI PLL does not cover all the cases. This change is to recover PLL status after PHY reset to match HW status with cached status in clock driver. Signed-off-by: Hai Li <> Signed-off-by: Rob Clark <>
2015-08-15drm/msm/dsi: Rename *dual panel* to *dual DSI*Hai Li1-42/+42
The current term of *dual panel* in DSI driver code causes confusion. It is supposed to indicate the panel using two DSI links. Rename it to *dual DSI*. Signed-off-by: Hai Li <> Signed-off-by: Rob Clark <>
2015-08-15drm/msm/dsi: Update source PLL selection in DSI PHYHai Li1-1/+14
The source PLL to be used by each DSI PHY should be decided by DSI manager based on dual DSI information, while the register programming to select PLL is different from one type of PHY to another. This change adds the H/W difference to PHY configuration and updates the interface between DSI manager and PHY. With this change, PLL selection can be supported on different targets. Signed-off-by: Hai Li <> Signed-off-by: Rob Clark <>
2015-06-11drm/msm/dsi: Enable PLL driver in MSM DSIHai Li1-22/+57
This change activates PLL driver for DSI to work with common clock framework. Signed-off-by: Hai Li <> Signed-off-by: Rob Clark <>
2015-05-14drm/msm: Attach assigned encoder to eDP and DSI connectorsHai Li1-1/+5
drm_mode_connector_attach_encoder() function call is missing during eDP and DSI connector initialization. As a result, no encoder is returned by DRM_IOCTL_MODE_GETCONNECTOR system call. This change is to fix this issue. Signed-off-by: Hai Li <>