summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/vc4/vc4_dsi.c
AgeCommit message (Collapse)AuthorFilesLines
2019-04-03drm/vc4: Use common helpers for debugfs setup by the driver components.Eric Anholt1-19/+5
The global list of all debugfs entries for the driver was painful: the list couldn't see into the components' structs, so each component had its own debugs show function to find the component, then find the regset and dump it. The components also had to be careful to check that they were actually registered in vc4 before dereferencing themselves, in case they weren't probed on a particular platform. They routinely failed at that. Instead, we can have the components add their debugfs callbacks to a little list in vc4 to be registered at drm_dev_register() time, which gets vc4_debugfs.c out of the business of knowing the whole list of components. Thanks to this change, dsi0 (if it existed) would register its node. v2: Rebase on hvs_underrun addition. v3: whitespace fixup Signed-off-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/20190401183559.3823-1-eric@anholt.net Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
2019-04-01drm/vc4: Use drm_print_regset32() for our debug register dumping.Eric Anholt1-90/+65
This removes a bunch of duplicated boilerplate for the debugfs vs runtime printk debug dumping. Signed-off-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/20190220210343.28157-2-eric@anholt.net Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
2019-01-24drm: Split out drm_probe_helper.hDaniel Vetter1-1/+1
Having the probe helper stuff (which pretty much everyone needs) in the drm_crtc_helper.h file (which atomic drivers should never need) is confusing. Split them out. To make sure I actually achieved the goal here I went through all drivers. And indeed, all atomic drivers are now free of drm_crtc_helper.h includes. v2: Make it compile. There was so much compile fail on arm drivers that I figured I'll better not include any of the acks on v1. v3: Massive rebase because i915 has lost a lot of drmP.h includes, but not all: Through drm_crtc_helper.h > drm_modeset_helper.h -> drmP.h there was still one, which this patch largely removes. Which means rolling out lots more includes all over. This will also conflict with ongoing drmP.h cleanup by others I expect. v3: Rebase on top of atomic bochs. v4: Review from Laurent for bridge/rcar/omap/shmob/core bits: - (re)move some of the added includes, use the better include files in other places (all suggested from Laurent adopted unchanged). - sort alphabetically v5: Actually try to sort them, and while at it, sort all the ones I touch. v6: Rebase onto i915 changes. v7: Rebase once more. Acked-by: Harry Wentland <harry.wentland@amd.com> Acked-by: Sam Ravnborg <sam@ravnborg.org> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Jani Nikula <jani.nikula@linux.intel.com> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Acked-by: Benjamin Gaignard <benjamin.gaignard@linaro.org> Acked-by: Jani Nikula <jani.nikula@intel.com> Acked-by: Neil Armstrong <narmstrong@baylibre.com> Acked-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com> Acked-by: CK Hu <ck.hu@mediatek.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Acked-by: Sam Ravnborg <sam@ravnborg.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Liviu Dudau <liviu.dudau@arm.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: linux-arm-kernel@lists.infradead.org Cc: virtualization@lists.linux-foundation.org Cc: etnaviv@lists.freedesktop.org Cc: linux-samsung-soc@vger.kernel.org Cc: intel-gfx@lists.freedesktop.org Cc: linux-mediatek@lists.infradead.org Cc: linux-amlogic@lists.infradead.org Cc: linux-arm-msm@vger.kernel.org Cc: freedreno@lists.freedesktop.org Cc: nouveau@lists.freedesktop.org Cc: spice-devel@lists.freedesktop.org Cc: amd-gfx@lists.freedesktop.org Cc: linux-renesas-soc@vger.kernel.org Cc: linux-rockchip@lists.infradead.org Cc: linux-stm32@st-md-mailman.stormreply.com Cc: linux-tegra@vger.kernel.org Cc: xen-devel@lists.xen.org Link: https://patchwork.freedesktop.org/patch/msgid/20190117210334.13234-1-daniel.vetter@ffwll.ch
2018-07-10drm/vc4: Support the case where the DSI device is disabledBoris Brezillon1-2/+13
Having a device with a status property != "okay" in the DT is a valid use case, and we should not prevent the registration of the DRM device when the DSI device connected to the DSI controller is disabled. Consider the ENODEV return code as a valid result and do not expose the DSI encoder/connector when it happens. Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com> Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Thierry Reding <treding@nvidia.com> Link: https://patchwork.freedesktop.org/patch/msgid/20180509130042.9435-5-boris.brezillon@bootlin.com
2018-06-29drm/vc4: Make DSI call into the bridge after the DSI link is enabled.Eric Anholt1-15/+27
This allows panels or bridges that need to send DSI commands during pre_enable() to successfully send them. We delay DISP0 (aka the actual display) enabling until after pre_enable so that pixels aren't streaming before then. v2: Just clear out the encoder->bridge value to disable the midlayer calls (idea by Andrzej Hajda). Signed-off-by: Eric Anholt <eric@anholt.net> Cc: Andrzej Hajda <a.hajda@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20180621231759.29604-1-eric@anholt.net Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
2018-04-30drm/vc4: Skip ULPS latching when we're in that ULPS state already.Eric Anholt1-0/+5
It seems that trying to go from unlatched to unlatched will time out waiting for STOP, and we can just skip that. Signed-off-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/20171031193258.17373-1-eric@anholt.net Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>
2017-10-19drm/vc4: Fix sleeps during the IRQ handler for DSI transactions.Eric Anholt1-2/+30
VC4's DSI1 has a bug where the AXI connection is broken for 32-bit writes from the CPU, so we use the DMA engine to DMA 32-bit values into registers instead. That sleeps, so we can't do it from the top half. As a solution, use an interrupt thread so that all our writes happen when sleeping is is allowed. v2: Use IRQF_ONESHOT (suggested by Boris) v3: Style nitpicks. Signed-off-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/20171014001255.32005-1-eric@anholt.net Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com> (v2)
2017-10-14drm/vc4: Move the DSI clock divider workaround closer to the clock call.Eric Anholt1-6/+6
We want the adjusted_mode->clock to be the actual clock we're expecting to program, so that consumers see the right values for clock and vrefresh. Signed-off-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/20170815234722.20700-1-eric@anholt.net Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
2017-09-27drm/vc4: Set up the DSI host at pdev probe time, not component bind.Eric Anholt1-40/+57
We need the following things to happen in sequence: DSI host creation DSI device creation in the panel driver (needs DSI host) DSI device attach from panel to host. DSI drm_panel_add() DSI encoder creation DSI encoder's DRM panel/bridge attach Unless we allow device creation while the host isn't up yet, we need to break the -EPROBE_DEFER deadlock between the panel driver looking up the host and the host driver looking up the panel. We can do so by moving the DSI host creation outside of the component bind loop, and the panel/bridge lookup/attach into the component bind process. Signed-off-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/20170815234722.20700-3-eric@anholt.net Reviewed-by: Archit Taneja <architt@codeaurora.org>
2017-09-27drm/vc4: Avoid using vrefresh==0 mode in DSI htotal math.Eric Anholt1-1/+2
The incoming mode might have a missing vrefresh field if it came from drmModeSetCrtc(), which the kernel is supposed to calculate using drm_mode_vrefresh(). We could either use that or the adjusted_mode's original vrefresh value. However, we can maintain a more exact vrefresh value (not just the integer approximation), by scaling by the ratio of our clocks. v2: Use math suggested by Andrzej Hajda instead. v3: Simplify math now that adjusted_mode->clock isn't padded. v4: Drop some parens. Signed-off-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/20170815234722.20700-2-eric@anholt.net Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
2017-08-08drm/vc4: Fix errant drm_bridge_remove() in DSI.Eric Anholt1-1/+0
drm_bridge_remove() is for unregistering a bridge driver, not for detaching a bridge from its consumer. Fixes: 656fa22f9cea ("drm/vc4: Switch DSI to the panel-bridge layer, and support bridges.") Signed-off-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/20170802203242.12815-3-eric@anholt.net Acked-by: Noralf Trønnes <noralf@tronnes.org> Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
2017-08-08drm/vc4: Don't disable DSI clocks on component unload.Eric Anholt1-3/+0
The clocks are enabled/disabled at encoder enable/disable time, not at component load. Fixes a WARN_ON at boot if V3D fails to probe. Fixes: 4078f5757144 ("drm/vc4: Add DSI driver") Signed-off-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/20170802203242.12815-2-eric@anholt.net Acked-by: Noralf Trønnes <noralf@tronnes.org> Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
2017-07-15drm/vc4: Fix misleading name of the continuous flag.Eric Anholt1-4/+4
The logic was all right in the end, the name was just backwards. Signed-off-by: Eric Anholt <eric@anholt.net> Link: http://patchwork.freedesktop.org/patch/msgid/20170627195839.3338-3-eric@anholt.net Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
2017-07-15drm/vc4: Fix DSI T_INIT timing.Eric Anholt1-1/+11
The DPHY spec requires a much larger T_INIT than I was specifying before. In the absence of clear specs from the slave of what their timing is, just use the value that the firmware was using. Signed-off-by: Eric Anholt <eric@anholt.net> Link: http://patchwork.freedesktop.org/patch/msgid/20170627195839.3338-2-eric@anholt.net Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
2017-06-05drm/vc4: Switch DSI to the panel-bridge layer, and support bridges.Eric Anholt1-134/+20
The newer version of the RPi panel driver is going to be a combination of a bridge and a panel, but we should also support panels without a bridge, so the panel-bridge layer lets us do that cleanly. v2: Drop "dev" argument. Signed-off-by: Eric Anholt <eric@anholt.net> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Archit Taneja <architt@codeaurora.org> Link: http://patchwork.freedesktop.org/patch/msgid/20170511183128.25085-2-eric@anholt.net
2017-05-22drm/vc4: fix include notation and remove -Iinclude/drm flagMasahiro Yamada1-14/+14
Include <drm/*.h> instead of relative path from include/drm, then remove the -Iinclude/drm compiler flag. While we are here, use <...> instead of "..." for include/linux/*.h and include/sound/*.h headers too. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1495081793-9707-2-git-send-email-yamada.masahiro@socionext.com
2017-05-16drm/vc4: Adjust modes in DSI to work around the integer PLL divider.Eric Anholt1-26/+86
BCM2835's PLLD_DSI1 divider doesn't give us many choices for our pixel clocks, so to support panels on the Raspberry Pi we need to set a higher pixel clock rate than requested and adjust the mode we program to extend out the HFP so that the refresh rate matches. v2: Drop an unfinished comment (caught by Noralf) Signed-off-by: Eric Anholt <eric@anholt.net> Link: http://patchwork.freedesktop.org/patch/msgid/20170511235625.22427-2-eric@anholt.net Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2017-02-28drm/vc4: Convert existing documentation to actual kerneldoc.Eric Anholt1-2/+3
I'm going to hook vc4 up to the sphinx build, so clean up its comments to not generate warnings when we do. Signed-off-by: Eric Anholt <eric@anholt.net> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/20170227201144.10970-2-eric@anholt.net
2017-02-08drm/vc4: simplify exit path of a failed allocation of dsi_connectorColin Ian King1-12/+4
If dsi_connector fails to allocate, the exit path via label 'fail' checks if connector is null, which it always is, so the cleanup that destroys connector is never going to be called. Hence the failure path can be more optimally performed by removing this and just returning ERR_PTR(-ENOMEM). This also removes the need to initialize connector to NULL, and we can also remove ret too. Detected by CoverityScan, CID#1399504 ("Logicall Dead Code") Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.com> Link: http://patchwork.freedesktop.org/patch/msgid/20170203195624.7189-1-colin.king@canonical.com
2017-02-01drm/vc4: Add DSI driverEric Anholt1-0/+1725
The DSI0 and DSI1 blocks on the 2835 are related hardware blocks. Some registers move around, and the featureset is slightly different, as DSI1 (the 4-lane DSI) is a later version of the hardware block. This driver doesn't yet enable DSI0, since we don't have any hardware to test against, but it does put a lot of the register definitions and code in place. v2: Use the clk_hw interfaces, don't set CLK_IS_BASIC (from review by Stephen Boyd) Signed-off-by: Eric Anholt <eric@anholt.net> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> (v1) Link: http://patchwork.freedesktop.org/patch/msgid/20170131192912.11316-1-eric@anholt.net