linux-drm-fsl-dcu.git
7 years agodrm/fsl-dcu: check for clk_prepare_enable() error drm-fsl-dcu-for-v4.11
Fabio Estevam [Wed, 28 Dec 2016 16:48:48 +0000 (14:48 -0200)]
drm/fsl-dcu: check for clk_prepare_enable() error

clk_prepare_enable() may fail, so we should better check its return
value.

Also place the of_node_put() function right after clk_prepare_enable(),
in order to avoid calling of_node_put() twice in case clk_prepare_enable()
fails.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Stefan Agner <stefan@agner.ch>
7 years agodrm/fsl-dcu: remove unneeded 'ret' assignment
Fabio Estevam [Wed, 28 Dec 2016 16:48:47 +0000 (14:48 -0200)]
drm/fsl-dcu: remove unneeded 'ret' assignment

When devm_kzalloc() fails there is no need to assign an error code
to the 'ret' variable as it will not be used after jumping to the
'err_node_put' label, so just remove the assignment.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Signed-off-by: Stefan Agner <stefan@agner.ch>
7 years agoMerge branch 'drm-rockchip-next-2017-02-07' of https://github.com/markyzq/kernel...
Dave Airlie [Wed, 8 Feb 2017 01:28:19 +0000 (11:28 +1000)]
Merge branch 'drm-rockchip-next-2017-02-07' of https://github.com/markyzq/kernel-drm-rockchip into drm-next

Single compile fix.

* 'drm-rockchip-next-2017-02-07' of https://github.com/markyzq/kernel-drm-rockchip:
  drm/rockchip: cdn-dp: fix cdn-dp complie warning

7 years agodrm/rockchip: cdn-dp: fix cdn-dp complie warning
Mark Yao [Sun, 5 Feb 2017 09:10:57 +0000 (17:10 +0800)]
drm/rockchip: cdn-dp: fix cdn-dp complie warning

fix warning:

drivers/gpu/drm/rockchip/cdn-dp-reg.c:632:24: warning:
  'val[1]' may be used uninitialized in this function [-Wmaybe-uninitialized]
  msa_misc = 2 * val[0] + 32 * val[1] +

Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agoMerge branch 'msm-next' of git://people.freedesktop.org/~robclark/linux into drm...
Dave Airlie [Tue, 7 Feb 2017 01:05:42 +0000 (11:05 +1000)]
Merge branch 'msm-next' of git://people.freedesktop.org/~robclark/linux into drm-next

The big things this time around are:
1) support for hw cursor on newer mdp5 devices (snapdragon 820+,
tested on db820c)
2) dsi encoder cleanup
3) gpu dt bindings cleanup so we can get the gpu nodes merged upstream

* 'msm-next' of git://people.freedesktop.org/~robclark/linux: (32 commits)
  drm/msm: return -EFAULT if copy_from_user() fails
  drm/msm/dsi: Add PHY/PLL for 8x96
  drm/msm/dsi: Add new method to calculate 14nm PHY timings
  drm/msm/dsi: Move PHY operations out of host
  drm/msm/dsi: Reset both PHYs before clock operation for dual DSI
  drm/msm/dsi: Pass down use case to PHY
  drm/msm/dsi: Return more timings from PHY to host
  drm/msm/dsi: Add a PHY op that initializes version specific stuff
  drm/msm/dsi: Add 8x96 info in dsi_cfg
  drm/msm/dsi: Don't error if a DSI host doesn't have a device connected
  drm/msm/mdp5: Add support for legacy cursor updates
  drm/msm/mdp5: Refactor mdp5_plane_atomic_check
  drm/msm/mdp5: Add cursor planes
  drm/msm/mdp5: Misc cursor plane bits
  drm/msm/mdp5: Configure COLOR3_OUT propagation
  drm/msm/mdp5: Use plane helpers to configure src/dst rectangles
  drm/msm/mdp5: Prepare CRTC/LM for empty stages
  drm/msm/mdp5: Create only as many CRTCs as we need
  drm/msm/mdp5: cfg: Change count to unsigned int
  drm/msm/mdp5: Create single encoder per interface (INTF)
  ...

7 years agoMerge branch 'drm-rockchip-next-2017-02-05' of https://github.com/markyzq/kernel...
Dave Airlie [Tue, 7 Feb 2017 01:03:30 +0000 (11:03 +1000)]
Merge branch 'drm-rockchip-next-2017-02-05' of https://github.com/markyzq/kernel-drm-rockchip into drm-next

rockchip CDN-DP support.

* 'drm-rockchip-next-2017-02-05' of https://github.com/markyzq/kernel-drm-rockchip:
  drm/rockchip: cdn-dp: don't configure hardware in mode_set
  drm/rockchip: cdn-dp: retry to check sink count
  drm/rockchip: cdn-dp: Move mutex_init to probe
  drm/rockchip: cdn-dp: do not use drm_helper_hpd_irq_event
  drm/rockchip: cdn-dp: Do not run worker while suspended
  drm/rockchip: cdn-dp: Load firmware if no monitor connected
  drm/rockchip: cdn-dp: add cdn DP support for rk3399
  drm/rockchip: return ERR_PTR instead of NULL
  drm/rockchip: vop: make vop register setting take effect

7 years agoMerge tag 'drm-misc-next-2017-02-03' of git://anongit.freedesktop.org/git/drm-misc...
Dave Airlie [Tue, 7 Feb 2017 00:54:12 +0000 (10:54 +1000)]
Merge tag 'drm-misc-next-2017-02-03' of git://anongit.freedesktop.org/git/drm-misc into drm-next

Final 4.11 feature pull request:
- sii8520 bridge update from Andrzej
- ->release callback, maybe somewhen in the future we'll even get
  drm_device lifetimes correct! (Chris Wilson)
- drm_mm search improvements, and good docs for different search
  strategies now (Chris)
- simplify fbdev emulation init parameters (Gabriel)
- bunch of misc things all over

... and the first few patches from our small driver in drm-misc
experiment:
- cleanups for qxl and bochs from a few different people
- dsi support for vc4 (not yet the panel driver, that's under discussion
  still) from Eric
- meson rename to meson-drm to distinguish from other platform drivers
  (Neil Amstrong)

* tag 'drm-misc-next-2017-02-03' of git://anongit.freedesktop.org/git/drm-misc: (47 commits)
  drm: kselftest for drm_mm and bottom-up allocation
  drm: Improve drm_mm search (and fix topdown allocation) with rbtrees
  drm: Fix build when FBDEV_EMULATION is disabled
  drm: Rely on mode_config data for fb_helper initialization
  drm: Provide a driver hook for drm_dev_release()
  drm: meson: rename driver name to meson-drm
  drm: meson: rename module name to meson-drm
  drm/bridge/sii8620: enable interlace modes
  drm/bridge/sii8620: enable MHL3 mode if possible
  drm/bridge/sii8620: add HSIC initialization code
  drm/bridge/sii8620: improve gen2 write burst IRQ routine
  drm/bridge/sii8620: send EMSC features on request
  drm/bridge/sii8620: rewrite hdmi start sequence
  drm/bridge/mhl: add MHL3 infoframe related definitions
  drm/bridge/sii8620: fix disconnect sequence
  drm/bridge/sii8620: split EDID read and write code
  drm/bridge/sii8620: add delay during cbus reset
  drm/bridge/sii8620: do not stop MHL output when TMDS input is stopped
  drm/bridge/sii8620: set gen2 write burst before sending MSC command
  drm/bridge/sii8620: abstract out sink detection code
  ...

7 years agodrm/msm: return -EFAULT if copy_from_user() fails
Dan Carpenter [Mon, 16 Jan 2017 11:58:08 +0000 (14:58 +0300)]
drm/msm: return -EFAULT if copy_from_user() fails

copy_from_user_inatomic() is actually a local function that returns
-EFAULT or positive values on error.  Otherwise copy_from_user() returns
the number of bytes remaining to be copied.  We want to return -EFAULT
here.

I removed an unlikely() because we just did a copy_from_user()
so I don't think it can possibly make a difference.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agodrm/msm/dsi: Add PHY/PLL for 8x96
Archit Taneja [Tue, 3 Jan 2017 14:15:43 +0000 (19:45 +0530)]
drm/msm/dsi: Add PHY/PLL for 8x96

Extend the DSI PHY/PLL drivers to support the DSI 14nm PHY/PLL
found on 8x96.

These are picked up from the downstream driver. The PHY part is similar
to the other DSI PHYs. The PLL driver requires some trickery so that
one DSI PLL can drive both the DSIs (i.e, dual DSI mode).

In the case of dual DSI mode. One DSI instance becomes the clock master,
and other the clock slave. The master PLL's output (Byte and Pixel clock)
is fed to both the DSI hosts/PHYs.

When the DSIs are configured in dual DSI mode, the PHY driver communicates
to the PLL driver using msm_dsi_pll_set_usecase() which instance is the
master and which one is the slave. When setting rate, the master PLL also
configures some of the slave PLL/PHY registers which need to be identical
to the master's for correct dual DSI behaviour.

There are 2 PLL post dividers that should have ideally been modelled as
generic clk_divider clocks, but require some customization for dual DSI.
In particular, when the master PLL's post-diviers are set, the slave PLL's
post-dividers need to be set too. The clk_ops for these use clk_divider's
helper ops and flags internally to prevent redundant code.

Cc: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agodrm/msm/dsi: Add new method to calculate 14nm PHY timings
Hai Li [Tue, 3 Jan 2017 14:01:16 +0000 (19:31 +0530)]
drm/msm/dsi: Add new method to calculate 14nm PHY timings

The 14nm DSI PHY on 8x96 (called PHY v2 downstream) requires a different
set of calculations for computing D-PHY timing params. Create a
timing_calc_v2 func for the newer v2 PHYs.

Signed-off-by: Hai Li <hali@codeaurora.org>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agodrm/msm/dsi: Move PHY operations out of host
Hai Li [Sat, 7 Jan 2017 08:54:38 +0000 (14:24 +0530)]
drm/msm/dsi: Move PHY operations out of host

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 <hali@codeaurora.org>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agodrm/msm/dsi: Reset both PHYs before clock operation for dual DSI
Archit Taneja [Wed, 29 Jul 2015 16:14:12 +0000 (12:14 -0400)]
drm/msm/dsi: Reset both PHYs before clock operation for dual DSI

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 <hali@codeaurora.org>. Fixed up
by Archit Taneja <architt@codeaurora.org>]

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agodrm/msm/dsi: Pass down use case to PHY
Hai Li [Thu, 15 Sep 2016 09:14:22 +0000 (14:44 +0530)]
drm/msm/dsi: Pass down use case to PHY

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 <hali@codeaurora.org>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agodrm/msm/dsi: Return more timings from PHY to host
Hai Li [Thu, 15 Sep 2016 09:04:49 +0000 (14:34 +0530)]
drm/msm/dsi: Return more timings from PHY to host

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 <hali@codeaurora.org>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agodrm/msm/dsi: Add a PHY op that initializes version specific stuff
Archit Taneja [Wed, 14 Sep 2016 06:53:59 +0000 (12:23 +0530)]
drm/msm/dsi: Add a PHY op that initializes version specific stuff

Create an init() op for dsi_phy which sets up things specific to
a given DSI PHY.

The dsi_phy driver probe expects every DSI version to get a
"dsi_phy_regulator" mmio base. This isn't the case for 8x96.
Creating an init() op will allow us to accommodate such
differences.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agodrm/msm/dsi: Add 8x96 info in dsi_cfg
Archit Taneja [Wed, 14 Sep 2016 06:53:07 +0000 (12:23 +0530)]
drm/msm/dsi: Add 8x96 info in dsi_cfg

Add 8x96 DSI data in dsi_cfg. The downstream kernel's dsi_host driver
enables core_mmss_clk. We're seeing some branch clock warnings on
8x96 when enabling this. There doesn't seem to be any negative effect
with not enabling this clock, so use it once we figure out why we
get the warnings.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agodrm/msm/dsi: Don't error if a DSI host doesn't have a device connected
Archit Taneja [Wed, 4 Jan 2017 08:44:58 +0000 (14:14 +0530)]
drm/msm/dsi: Don't error if a DSI host doesn't have a device connected

The driver returns an error if a DSI DT node is populated, but no device
is connected to it or if the data-lane map isn't present. Ideally, such
a DSI node shouldn't be probed at all (i.e, its status should be set to
"disabled in DT"), but there isn't any harm in registering the DSI device
even if it doesn't have a bridge/panel connected to it.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agodrm/msm/mdp5: Add support for legacy cursor updates
Archit Taneja [Fri, 16 Dec 2016 06:29:57 +0000 (11:59 +0530)]
drm/msm/mdp5: Add support for legacy cursor updates

This code has been more or less picked up from the vc4 and intel
implementations of update_plane() funcs for cursor planes.

The update_plane() func is usually the drm_atomic_helper_update_plane
func that will issue an atomic commit with the plane updates. Such
commits are not intended to be done faster than the vsync rate.

The legacy cursor userspace API, on the other hand, expects the kernel
to handle cursor updates immediately.

Create a fast path in update_plane, which updates the cursor registers
and flushes the configuration. The fast path is taken when there is only
a change in the cursor's position in the crtc, or a change in the
cursor's crop co-ordinates. For anything else, we go via the slow path.

We take the slow path even when the fb changes, and when there is
currently no fb tied to the plane. This should hopefully ensure that we
always take a slow path for every new fb. This in turn should ensure that
the fb is pinned/prepared.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agodrm/msm/mdp5: Refactor mdp5_plane_atomic_check
Archit Taneja [Mon, 16 Jan 2017 06:46:34 +0000 (12:16 +0530)]
drm/msm/mdp5: Refactor mdp5_plane_atomic_check

In mdp5_plane_atomic_check, we get crtc_state from drm_plane_state.

Later, for cursor planes, we'll populate the update_plane() func that
takes a fast asynchronous path to implement cursor movements. There, we
would need to call a similar atomic_check func to validate the plane
state, but crtc_state would need to be derived differently.

Refactor mdp5_plane_atomic_check to mdp5_plane_atomic_check_with_state
such that the latter takes crtc_state as an argument.

This is similar to what the intel driver has done for async cursor
updates.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agodrm/msm/mdp5: Add cursor planes
Archit Taneja [Fri, 16 Dec 2016 06:30:30 +0000 (12:00 +0530)]
drm/msm/mdp5: Add cursor planes

Register cursor drm_planes. The loop in modeset_init that inits the
planes and crtcs has to be refactored a bit. We first iterate all the
hwpipes to find the cursor planes. Then, we loop again to create
crtcs.

In msm_atomic_wait_for_commit_done, remove the check which bypasses
waiting for vsyncs if state->legacy_cursor_updates is true.

We will later create a fast path for cursor position changes in the
cursor plane's update_plane func that doesn't go via the regular
atomic commit path. For rest of cursor related updates, we will have
to wait for vsyncs, so ignore the legacy_cursor_updates flag.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agodrm/msm/mdp5: Misc cursor plane bits
Archit Taneja [Mon, 16 Jan 2017 06:27:04 +0000 (11:57 +0530)]
drm/msm/mdp5: Misc cursor plane bits

These are various changes added in preparation for cursor planes:

- Add a pipe_cursor block for 8x96 in mdp5_cfg.
- Add a new pipe CAP called MDP_PIPE_CAP_CURSOR. Use this to ensure we
  assign a cursor SSPP for a drm_plane with type DRM_PLANE_TYPE_CURSOR.
- Update mdp5_ctl_blend_mask/ext_blend_mask funcs to incorporate cursor
  SSPPs.
- In mdp5_ctl_blend, iterate through MAX_STAGES instead of stage_cnt,
  we need to do this because we can now have empty stages in between.
- In mdp5_crtc_atomic_check, make sure that the cursor plane has the
  highest zorder, and stage the cursor plane to the maximum stage #
  present on the HW.
- Create drm_crtc_funcs that doesn't try to implement cursors using the
  older LM cursor HW.
- Pass drm_plane_type in mdp5_plane_init instead of a bool telling
  whether plane is primary or not.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agodrm/msm/mdp5: Configure COLOR3_OUT propagation
Archit Taneja [Mon, 19 Dec 2016 08:04:11 +0000 (13:34 +0530)]
drm/msm/mdp5: Configure COLOR3_OUT propagation

In MDP5 Layer Mixer HW, the blender output is only the blended color
components (i.e R, G and B, or COLOR0/1/2 in MDP5 HW terminology). This
is fed to the BG input of the next blender. We also need to provide an
alpha (COLOR3) value for the BG input at the next stage.

This is configured via using the REG_MDP5_LM_BLEND_COLOR_OUT register.
For each stage, we can propagate either the BG or FG alpha to the next
stage.

The approach taken by the driver is to propagate FG alpha, if the plane
staged on that blender has an alpha. If it doesn't, we try to propagate
the base layer's alpha.

This is borrowed from downstream MDP5 kernel driver. Without this, we
don't see any cursor plane content.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agodrm/msm/mdp5: Use plane helpers to configure src/dst rectangles
Archit Taneja [Mon, 16 Jan 2017 06:16:17 +0000 (11:46 +0530)]
drm/msm/mdp5: Use plane helpers to configure src/dst rectangles

The MDP5 plane's atomic_check ops doesn't perform clipping tests.
This didn't hurt us much in the past, but clipping becomes important
with cursor planes.

Use drm_plane_helper_check_state, the way rockchip/intel/mtk drivers
already do. Use these drivers as reference.

Clipping requires knowledge of the crtc width and height. This requires
us to call drm_atomic_helper_check_modeset before
drm_atomic_helper_check_planes in the driver's atomic_check op, because
check_modetest will populate the mode for the crtc, needed to populate
the clip rectangle.

We update the plane_enabled(state) local helper to use state->visible,
since state->visible and 'state->fb && state->crtc' represent the same
thing.

One issue with the existing code is that we don't have a way to disable
the plane when it's completely clipped out. Until there isn't an update
on the crtc (which would de-stage the plane), we would still see the
plane in its last 'visible' configuration.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agodrm/msm/mdp5: Prepare CRTC/LM for empty stages
Archit Taneja [Mon, 12 Dec 2016 09:47:56 +0000 (15:17 +0530)]
drm/msm/mdp5: Prepare CRTC/LM for empty stages

Use SSPP_NONE in mdp5_plane_pipe() if there is now hwpipe allocated for
the drm_plane. Returning '0' means we are returning VIG0 pipe.

Also, use the mdp5_pipe enum to pass around the stage array. Initialize
the stage to SSPP_NONE by default.

We do the above because 1) Cursor plane has to be staged at the topmost
blender of the LM, which can result in empty stages in between 2) In
the future, when we support multiple LMs per CRTC. We could have stages
which don't have any pipe assigned to them.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agodrm/msm/mdp5: Create only as many CRTCs as we need
Archit Taneja [Tue, 6 Dec 2016 06:45:54 +0000 (12:15 +0530)]
drm/msm/mdp5: Create only as many CRTCs as we need

We currently create CRTCs equaling to the # of Layer Mixer blocks we
have on the MDP5 HW. This number is generally more than the # of encoders
(INTFs) we have in the MDSS HW. The number of encoders connected to
displays on the platform (as described by DT) would be even lesser.

Create only N drm_crtcs, where N is the number of drm_encoders
successfully registered. To do this, we call modeset_init_intf() before
we init the drm_crtcs and drm_planes.

Because of this change, setting encoder->possible_crtcs needs to be moved
from construct_encoder() to a later point when we know how many CRTCs we
have.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agodrm/msm/mdp5: cfg: Change count to unsigned int
Archit Taneja [Tue, 6 Dec 2016 06:42:59 +0000 (12:12 +0530)]
drm/msm/mdp5: cfg: Change count to unsigned int

Count can't be non-zero. Changing to uint will also prevent future
warnings.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agodrm/msm/mdp5: Create single encoder per interface (INTF)
Archit Taneja [Mon, 16 Jan 2017 05:55:38 +0000 (11:25 +0530)]
drm/msm/mdp5: Create single encoder per interface (INTF)

For the DSI interfaces, the mdp5_kms core creates 2 encoders for video
and command modes.

Create only a single encoder per interface. When creating the encoder, set
the interface type to MDP5_INTF_MODE_NONE. It's the bridge (DSI/HDMI/eDP)
driver's responsibility to set a different interface type. It can use the
the kms func op set_encoder_mode to change the mode of operation, which
in turn would configure the interface type for the INTF.

In mdp5_cmd_encoder.c, we remove the redundant code, and make the commmand
mode funcs as helpers that are used in mdp5_encoder.c

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agodrm/msm/mdp5: Prepare for merging video and command encoders
Archit Taneja [Tue, 6 Dec 2016 03:51:21 +0000 (09:21 +0530)]
drm/msm/mdp5: Prepare for merging video and command encoders

Rename the mdp5_encoder_* ops for active displays to
mdp5_vid_encoder_* ops.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agodrm/msm: Set encoder's mode of operation using a kms func
Archit Taneja [Mon, 5 Dec 2016 09:54:53 +0000 (15:24 +0530)]
drm/msm: Set encoder's mode of operation using a kms func

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 <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agodrm/msm: Construct only one encoder for DSI
Archit Taneja [Mon, 16 Jan 2017 04:12:03 +0000 (09:42 +0530)]
drm/msm: Construct only one encoder for DSI

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 <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agodrm/msm/dsi: Set msm_dsi->encoders before initializing bridge
Archit Taneja [Wed, 11 Jan 2017 06:29:56 +0000 (11:59 +0530)]
drm/msm/dsi: Set msm_dsi->encoders before initializing bridge

The commit "drm: bridge: Link encoder and bridge in core code" updated
the drm_bridge_attach() API to also include the drm_encoder pointer
the bridge attaches to.

The func msm_dsi_manager_bridge_init() now relies on the drm_encoder
pointer stored in msm_dsi->encoders to pass the encoder to the bridge
API.

msm_dsi->encoders is unfortunately set after this function is called,
resulting in us passing a NULL pointer to drm_brigde_attach. This
results in an error and the DSI driver probe fails.

Move the initialization of msm_dsi->encoders[] a bit up. Also, don't
try to set the encoder's bridge. That's now managed by the bridge
API.

Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agodrm/msm/dsi: Update generated headers
Archit Taneja [Mon, 16 Jan 2017 06:05:36 +0000 (11:35 +0530)]
drm/msm/dsi: Update generated headers

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agodrm/msm/mdp5: Update generated headers
Archit Taneja [Mon, 16 Jan 2017 06:04:19 +0000 (11:34 +0530)]
drm/msm/mdp5: Update generated headers

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agodrm/msm/mdp5: cfg: Add pipe_cursor block
Archit Taneja [Mon, 12 Dec 2016 09:40:21 +0000 (15:10 +0530)]
drm/msm/mdp5: cfg: Add pipe_cursor block

Define the block in advance so that the generated mdp5.xml.h doesn't
break build.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agodrm/msm: let gpu wire up it's own fault handler
Rob Clark [Wed, 7 Dec 2016 16:13:53 +0000 (11:13 -0500)]
drm/msm: let gpu wire up it's own fault handler

Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agodrm/msm: drop _clk suffix from clk names
Rob Clark [Mon, 30 Jan 2017 16:30:58 +0000 (11:30 -0500)]
drm/msm: drop _clk suffix from clk names

Suggested by Rob Herring.  We still support the old names for
compatibility with downstream android dt files.

Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Acked-by: Rob Herring <robh@kernel.org>
7 years agodrm/msm: drop quirks binding
Rob Clark [Mon, 30 Jan 2017 16:15:14 +0000 (11:15 -0500)]
drm/msm: drop quirks binding

This was never documented or used in upstream dtb.  It is used by
downstream bindings from android device kernels.  But the quirks are
a property of the gpu revision, and as such are redundant to be listed
separately in dt.  Instead, move the quirks to the device table.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agodrm/msm: drop qcom,chipid
Rob Clark [Mon, 30 Jan 2017 16:02:27 +0000 (11:02 -0500)]
drm/msm: drop qcom,chipid

The original way we determined the gpu version was based on downstream
bindings from android kernel.  A cleaner way is to get the version from
the compatible string.

Note that no upstream dtb uses these bindings.  But the code still
supports falling back to the legacy bindings (with a warning), so that
we are still compatible with the gpu dt node from android device
kernels.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Acked-by: Rob Herring <robh@kernel.org>
7 years agodrm/msm: remove qcom,gpu-pwrlevels bindings
Rob Clark [Mon, 30 Jan 2017 15:46:35 +0000 (10:46 -0500)]
drm/msm: remove qcom,gpu-pwrlevels bindings

The plan is to use the OPP bindings.  For now, remove the documentation
for qcom,gpu-pwrlevels, and make the driver fall back to a safe low
clock if the node is not present.

Note that no upstream dtb use this node.  For now we keep compatibility
with this node to avoid breaking compatibility with downstream android
dt files.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Acked-by: Rob Herring <robh@kernel.org>
7 years agodrm/rockchip: cdn-dp: don't configure hardware in mode_set
Chris Zhong [Sun, 5 Feb 2017 07:55:02 +0000 (15:55 +0800)]
drm/rockchip: cdn-dp: don't configure hardware in mode_set

With atomic modesetting the hardware will be powered off when the
mode_set function is called.  We should configure the hardware in the
enable function.

Signed-off-by: Chris Zhong <zyw@rock-chips.com>
7 years agodrm/rockchip: cdn-dp: retry to check sink count
Chris Zhong [Sun, 5 Feb 2017 07:55:01 +0000 (15:55 +0800)]
drm/rockchip: cdn-dp: retry to check sink count

Sometimes the Dock is disconnected, but cdn_dp_encoder_disable is not
triggered by DRM. For example, unplug the Dock in console mode, and
re-plug it again, the cdn_dp_event_work will try to get the sink count
of Dock, since the DP is still active. But the Dock has been powered
down, it need re-power on, and wait for a while until it is ready to
DPCD communication.

Signed-off-by: Chris Zhong <zyw@rock-chips.com>
7 years agodrm/rockchip: cdn-dp: Move mutex_init to probe
Jeffy Chen [Sun, 5 Feb 2017 07:55:00 +0000 (15:55 +0800)]
drm/rockchip: cdn-dp: Move mutex_init to probe

We're trying to lock mutex when cdn-dp shutdown, so we need to make
sure the mutex is inited in cdn-dp's probe.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Chris Zhong <zyw@rock-chips.com>
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
7 years agodrm/rockchip: cdn-dp: do not use drm_helper_hpd_irq_event
Chris Zhong [Sun, 5 Feb 2017 07:54:59 +0000 (15:54 +0800)]
drm/rockchip: cdn-dp: do not use drm_helper_hpd_irq_event

The cdn_dp_pd_event_work is using drm_helper_hpd_irq_event to update the
connector status, this function is used to update all connectors of
drm_device. Therefore, the detect of other connector will be call, when
cdn_dp_pd_event_work is triggered, every time. It is not necessary, and
it may cause system crash. replace drm_helper_hpd_irq_event with
drm_kms_helper_hotplug_event, only update cdn-dp status.

Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Tested-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
7 years agodrm/rockchip: cdn-dp: Do not run worker while suspended
Guenter Roeck [Sun, 5 Feb 2017 07:54:58 +0000 (15:54 +0800)]
drm/rockchip: cdn-dp: Do not run worker while suspended

If the driver is in suspended mode, the dp block may be disabled, and
chip registers may not be accessible. Yet, the worker may be triggered
in this situation by an extcon event. If that happens, the following crash
will be seen.

cdn-dp fec00000.dp: [drm:cdn_dp_pd_event_work] *ERROR* Enable dp failed -19
cdn-dp fec00000.dp: [drm:cdn_dp_pd_event_work] Connected, not enabled. Enabling cdn
Bad mode in Error handler detected, code 0xbf000002 -- SError
CPU: 1 PID: 10357 Comm: kworker/1:2 Not tainted 4.4.21-05903-ge0514ea #1
Hardware name: Google Kevin (DT)
Workqueue: events cdn_dp_pd_event_work
task: ffffffc0cda67080 ti: ffffffc0b9b80000 task.ti: ffffffc0b9b80000
PC is at cdn_dp_clock_reset+0x30/0xa8
LR is at cdn_dp_enable+0x1e0/0x69c
...
Call trace:
[<ffffffc0005a7e24>] cdn_dp_pd_event_work+0x58/0x3f4
[<ffffffc0002397f0>] process_one_work+0x240/0x424
[<ffffffc00023a28c>] worker_thread+0x2fc/0x424
[<ffffffc00023f5fc>] kthread+0x10c/0x114
[<ffffffc000203dd0>] ret_from_fork+0x10/0x40

Problem is two-fold: The worker should not run while suspended, and the
suspend function should not call cdn_dp_disable() while the worker is
running.

Signed-off-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
7 years agodrm/rockchip: cdn-dp: Load firmware if no monitor connected
Guenter Roeck [Sun, 5 Feb 2017 07:54:57 +0000 (15:54 +0800)]
drm/rockchip: cdn-dp: Load firmware if no monitor connected

If no monitor is connected, suspend/resume cycles result in firmware
load errors because the driver attempts to load the firmware while
the system is in suspend state. This results in a kernel warning and
traceback.

Loading the firmware during boot fixes the problem. Note that we can not
just call schedule_work conditionally in cdn_dp_pd_event() if the insertion
status changed. The problem would still be seen if a monitor is connected
for the first time during suspend.

Signed-off-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
7 years agodrm/rockchip: cdn-dp: add cdn DP support for rk3399
Chris Zhong [Sun, 5 Feb 2017 07:54:56 +0000 (15:54 +0800)]
drm/rockchip: cdn-dp: add cdn DP support for rk3399

Add support for cdn DP controller which is embedded in the rk3399
SoCs. The DP is compliant with DisplayPort Specification,
Version 1.3, This IP is compatible with the rockchip type-c PHY IP.
There is a uCPU in DP controller, it need a firmware to work,
please put the firmware file to /lib/firmware/rockchip/dptx.bin. The
uCPU in charge of aux communication and link training, the host use
mailbox to communicate with the ucpu.
The dclk pin_pol of vop must not be invert for DP.

Signed-off-by: Chris Zhong <zyw@rock-chips.com>
[seanpaul fixed up some races between the worker and modeset]
[seanpaul squashed ~15 commits from chromium.org gerrit]
Signed-off-by: Sean Paul <seanpaul@chromium.org>
[groeck fixed compilation errors when building as module]
Signed-off-by: Guenter Roeck <groeck@chromium.org>
7 years agodrm/rockchip: return ERR_PTR instead of NULL
Julia Lawall [Thu, 10 Nov 2016 21:10:56 +0000 (22:10 +0100)]
drm/rockchip: return ERR_PTR instead of NULL

rockchip_drm_framebuffer_init is only used in one case, in
rockchip_drm_fbdev.c, where its return value is tested using IS_ERR.  To
enable propagating the reason for the error, change the definition so that
it returns an ERR_PTR value.

Problem found with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
7 years agodrm/rockchip: vop: make vop register setting take effect
Chris Zhong [Sat, 27 Aug 2016 03:39:38 +0000 (20:39 -0700)]
drm/rockchip: vop: make vop register setting take effect

The setting of vop registers need a reg_done writing to take effect.
In vop_enable the vop return to work by by restoring registers, but the
registers do not take effect immediately, it should a vop_cfg_done
after it. The same thing is needed by windows_disabled in
vop_crtc_disable.

Signed-off-by: Chris Zhong <zyw@rock-chips.com>
7 years agodrm: kselftest for drm_mm and bottom-up allocation
Chris Wilson [Thu, 2 Feb 2017 11:44:34 +0000 (11:44 +0000)]
drm: kselftest for drm_mm and bottom-up allocation

Check that if we request bottom-up allocation from drm_mm_insert_node()
we receive the next available hole from the bottom.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170202114434.3060-2-chris@chris-wilson.co.uk
7 years agodrm: Improve drm_mm search (and fix topdown allocation) with rbtrees
Chris Wilson [Thu, 2 Feb 2017 21:04:38 +0000 (21:04 +0000)]
drm: Improve drm_mm search (and fix topdown allocation) with rbtrees

The drm_mm range manager claimed to support top-down insertion, but it
was neither searching for the top-most hole that could fit the
allocation request nor fitting the request to the hole correctly.

In order to search the range efficiently, we create a secondary index
for the holes using either their size or their address. This index
allows us to find the smallest hole or the hole at the bottom or top of
the range efficiently, whilst keeping the hole stack to rapidly service
evictions.

v2: Search for holes both high and low. Rename flags to mode.
v3: Discover rb_entry_safe() and use it!
v4: Kerneldoc for enum drm_mm_insert_mode.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Russell King <rmk+kernel@armlinux.org.uk>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: Eric Anholt <eric@anholt.net>
Cc: Sinclair Yeh <syeh@vmware.com>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com> # vmwgfx
Reviewed-by: Lucas Stach <l.stach@pengutronix.de> #etnaviv
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170202210438.28702-1-chris@chris-wilson.co.uk
7 years agoMerge remote-tracking branch 'airlied/drm-next' into drm-misc-next
Daniel Vetter [Fri, 3 Feb 2017 10:09:25 +0000 (11:09 +0100)]
Merge remote-tracking branch 'airlied/drm-next' into drm-misc-next

Yet another backmerge to get at latest etnaviv code, which is need for
Chris' drm_mm patch.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
7 years agoMerge branch 'drm-etnaviv-next' of https://git.pengutronix.de/git/lst/linux into...
Dave Airlie [Thu, 2 Feb 2017 19:41:58 +0000 (05:41 +1000)]
Merge branch 'drm-etnaviv-next' of https://git.pengutronix.de/git/lst/linux into drm-next

It includes code cleanups from Bhumika and Liviu, a significant shader
performance fix and additions to the cmdstream validator from Wladimir
and the addition of a cmdbuf suballocator by myself.
The suballocator improves performance on all chips by reducing the CPU
overhead of the kernel driver and side steps the GC3000 FE MMU flush
erratum, now making the workarounds in IOVA allocation we had before
unnecessary, which results in a nice cleanup of the code in that area.

* 'drm-etnaviv-next' of https://git.pengutronix.de/git/lst/linux:
  drm/etnaviv: Remove duplicate header file include
  Revert "drm/etnaviv: trick drm_mm into giving out a low IOVA"
  drm/etnaviv: add cmdbuf suballocator
  drm/etnaviv: get cmdbuf physical address through the cmdbuf abstraction
  drm/etnaviv: wire up iova handling in new cmdbuf abstraction
  drm/etnaviv: move cmdbuf de-/allocation into own file
  drm/etnaviv: always flush MMU TLBs on map/unmap
  drm/etnaviv: constify etnaviv_iommu_ops structures
  drm/etnaviv: set up initial PULSE_EATER register
  drm/etnaviv: add new GC3000 sensitive states

7 years agodrm: Fix build when FBDEV_EMULATION is disabled
Gabriel Krisman Bertazi [Thu, 2 Feb 2017 19:39:00 +0000 (17:39 -0200)]
drm: Fix build when FBDEV_EMULATION is disabled

Commit be7f735cd5ea ("drm: Rely on mode_config data for fb_helper
initialization") broke the build when CONFIG_DRM_FBDEV_EMULATION is
disabled because it didn't update the prototype for drm_fb_helper_init
in that case.

Fixes: be7f735cd5ea ("drm: Rely on mode_config data for fb_helper
 initialization")
Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170202193900.22075-1-krisman@collabora.co.uk
7 years agodrm: Rely on mode_config data for fb_helper initialization
Gabriel Krisman Bertazi [Thu, 2 Feb 2017 16:26:40 +0000 (14:26 -0200)]
drm: Rely on mode_config data for fb_helper initialization

Instead of receiving the num_crts as a parameter, we can read it
directly from the mode_config structure.  I audited the drivers that
invoke this helper and I believe all of them initialize the mode_config
struct accordingly, prior to calling the fb_helper.

I used the following coccinelle hack to make this transformation, except
for the function headers and comment updates.  The first and second
rules are split because I couldn't find a way to remove the unused
temporary variables at the same time I removed the parameter.

// <smpl>
@r@
expression A,B,D,E;
identifier C;
@@
(
- drm_fb_helper_init(A,B,C,D)
+ drm_fb_helper_init(A,B,D)
|
- drm_fbdev_cma_init_with_funcs(A,B,C,D,E)
+ drm_fbdev_cma_init_with_funcs(A,B,D,E)
|
- drm_fbdev_cma_init(A,B,C,D)
+ drm_fbdev_cma_init(A,B,D)
)

@@
expression A,B,C,D,E;
@@
(
- drm_fb_helper_init(A,B,C,D)
+ drm_fb_helper_init(A,B,D)
|
- drm_fbdev_cma_init_with_funcs(A,B,C,D,E)
+ drm_fbdev_cma_init_with_funcs(A,B,D,E)
|
- drm_fbdev_cma_init(A,B,C,D)
+ drm_fbdev_cma_init(A,B,D)
)

@@
identifier r.C;
type T;
expression V;
@@
- T C;
<...
when != C
- C = V;
...>
// </smpl>

Changes since v1:
 - Rebased on top of the tip of drm-misc-next.
 - Remove mention to sti since a proper fix got merged.

Suggested-by: Daniel Vetter <daniel.vetter@intel.com>
Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170202162640.27261-1-krisman@collabora.co.uk
7 years agodrm: Provide a driver hook for drm_dev_release()
Chris Wilson [Thu, 2 Feb 2017 09:36:32 +0000 (09:36 +0000)]
drm: Provide a driver hook for drm_dev_release()

Some state is coupled into the device lifetime outside of the
load/unload timeframe and requires teardown during final unreference
from drm_dev_release(). For example, dmabufs hold both a device and
module reference and may live longer than expected (i.e. the current
pattern of the driver tearing down its state and then releasing a
reference to the drm device) and yet touch driver private state when
destroyed.

v2: Export drm_dev_fini() and move the responsibility for finalizing the
drm_device and freeing it to the release callback. (If no callback is
provided, the core will call drm_dev_fini() and kfree(dev) as before.)
v3: Remember to add drm_dev_fini() to drm_drv.h
v4: Tidy language for kerneldoc
v5: Cross reference from drm_dev_init() to note that driver->release()
allows for arbitrary embedding.
v6: Refer to driver data rather than driver state, as state is now
becoming associated with the struct drm_atomic_state and friends.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[danvet: Use the proper reference for struct members, which is
&drm_driver.release.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170202093632.31017-1-chris@chris-wilson.co.uk
7 years agodrm: meson: rename driver name to meson-drm
Neil Armstrong [Thu, 2 Feb 2017 09:47:44 +0000 (10:47 +0100)]
drm: meson: rename driver name to meson-drm

The platform driver name is currently "meson" which can lead to some
confusion, this patch renames it to "meson-drm" and removes the owner
attribute since is always added by __platform_driver_register called by the
module_platform_driver() macro.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Acked-by: Daniel Vetter <daniel@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1486028864-19622-3-git-send-email-narmstrong@baylibre.com
7 years agodrm: meson: rename module name to meson-drm
Neil Armstrong [Thu, 2 Feb 2017 09:47:43 +0000 (10:47 +0100)]
drm: meson: rename module name to meson-drm

The module is currently named "meson.ko" which can lead to some
confusion, this patches renames it "meson-drm.ko"

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1486028864-19622-2-git-send-email-narmstrong@baylibre.com
7 years agodrm/bridge/sii8620: enable interlace modes
Andrzej Hajda [Wed, 1 Feb 2017 07:47:52 +0000 (08:47 +0100)]
drm/bridge/sii8620: enable interlace modes

Bug in DECON(CRTC) driver prevented interlace modes from proper work.
Since DECON is fixed interlace modes can be enabled in MHL.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1485935272-17337-26-git-send-email-a.hajda@samsung.com
7 years agodrm/bridge/sii8620: enable MHL3 mode if possible
Andrzej Hajda [Wed, 1 Feb 2017 07:47:51 +0000 (08:47 +0100)]
drm/bridge/sii8620: enable MHL3 mode if possible

Since all sub-protocols of MHL3 are already supported MHL3 mode can be
enabled. With this patch it is possible to use packed pixel modes and
clocks up to 300MHz - 1920x1080@60Hz and 4K modes.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1485935272-17337-25-git-send-email-a.hajda@samsung.com
7 years agodrm/bridge/sii8620: add HSIC initialization code
Andrzej Hajda [Wed, 1 Feb 2017 07:47:50 +0000 (08:47 +0100)]
drm/bridge/sii8620: add HSIC initialization code

In case of MHL3 HSIC should be initialized.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1485935272-17337-24-git-send-email-a.hajda@samsung.com
7 years agodrm/bridge/sii8620: improve gen2 write burst IRQ routine
Andrzej Hajda [Wed, 1 Feb 2017 07:47:49 +0000 (08:47 +0100)]
drm/bridge/sii8620: improve gen2 write burst IRQ routine

The patch adds code to report back feature complete IRQ, and code
to read and drop burst writes from peer.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1485935272-17337-23-git-send-email-a.hajda@samsung.com
7 years agodrm/bridge/sii8620: send EMSC features on request
Andrzej Hajda [Wed, 1 Feb 2017 07:47:48 +0000 (08:47 +0100)]
drm/bridge/sii8620: send EMSC features on request

Device should report to the peer which features are really supported.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1485935272-17337-22-git-send-email-a.hajda@samsung.com
7 years agodrm/bridge/sii8620: rewrite hdmi start sequence
Andrzej Hajda [Wed, 1 Feb 2017 07:47:47 +0000 (08:47 +0100)]
drm/bridge/sii8620: rewrite hdmi start sequence

MHL3 protocol requires registry adjustments depending on chosen video mode.
Necessary information is gathered in mode_fixup callback. In case of HDMI
video modes driver should also send special AVI and MHL3 infoframes.
The patch introduces generic helpers for handling MHL3 infoframes, in
case of appearance of other users of MHL3 infoframes these function can
be moved to common library.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1485935272-17337-21-git-send-email-a.hajda@samsung.com
7 years agodrm/bridge/mhl: add MHL3 infoframe related definitions
Andrzej Hajda [Wed, 1 Feb 2017 07:47:46 +0000 (08:47 +0100)]
drm/bridge/mhl: add MHL3 infoframe related definitions

MHL3 protocol uses vendor specific infoframes to transmit additional
information to the sink. This patch adds definitions of structures and
constants used to create such frames.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1485935272-17337-20-git-send-email-a.hajda@samsung.com
7 years agodrm/bridge/sii8620: fix disconnect sequence
Andrzej Hajda [Wed, 1 Feb 2017 07:47:45 +0000 (08:47 +0100)]
drm/bridge/sii8620: fix disconnect sequence

The patch allows to avoid rare cases when discovery fails.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1485935272-17337-19-git-send-email-a.hajda@samsung.com
7 years agodrm/bridge/sii8620: split EDID read and write code
Andrzej Hajda [Wed, 1 Feb 2017 07:47:44 +0000 (08:47 +0100)]
drm/bridge/sii8620: split EDID read and write code

MHL3 requires that after reading EDID from the sink source should ask
peer for features. To make both protocols happy the patch splits the code
accordingly.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1485935272-17337-18-git-send-email-a.hajda@samsung.com
7 years agodrm/bridge/sii8620: add delay during cbus reset
Andrzej Hajda [Wed, 1 Feb 2017 07:47:43 +0000 (08:47 +0100)]
drm/bridge/sii8620: add delay during cbus reset

Without delay CBUS sometimes was not reset properly.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1485935272-17337-17-git-send-email-a.hajda@samsung.com
7 years agodrm/bridge/sii8620: do not stop MHL output when TMDS input is stopped
Andrzej Hajda [Wed, 1 Feb 2017 07:47:42 +0000 (08:47 +0100)]
drm/bridge/sii8620: do not stop MHL output when TMDS input is stopped

Stopping output causes full re-detection of the sink and slows down the
process.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1485935272-17337-16-git-send-email-a.hajda@samsung.com
7 years agodrm/bridge/sii8620: set gen2 write burst before sending MSC command
Andrzej Hajda [Wed, 1 Feb 2017 07:47:41 +0000 (08:47 +0100)]
drm/bridge/sii8620: set gen2 write burst before sending MSC command

Write burst should be enabled for MHL_INT_RC_FEAT_REQ and disabled for
other commands. The patch moves functions up and adds delay setting
for MHL3 burst mode.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1485935272-17337-15-git-send-email-a.hajda@samsung.com
7 years agodrm/bridge/sii8620: abstract out sink detection code
Andrzej Hajda [Wed, 1 Feb 2017 07:47:40 +0000 (08:47 +0100)]
drm/bridge/sii8620: abstract out sink detection code

MHL1 and MHL3 have different initialization paths. To make both protocols
happy sink detection is put into continuation after link mode enablement.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1485935272-17337-14-git-send-email-a.hajda@samsung.com
7 years agodrm/bridge/sii8620: fix initialization sequence for MHL2 receivers
Andrzej Hajda [Wed, 1 Feb 2017 07:47:39 +0000 (08:47 +0100)]
drm/bridge/sii8620: fix initialization sequence for MHL2 receivers

MHL2 receiver require disabling transmitter on initialization.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1485935272-17337-13-git-send-email-a.hajda@samsung.com
7 years agodrm/bridge/sii8620: fix MSC message removal
Andrzej Hajda [Wed, 1 Feb 2017 07:47:38 +0000 (08:47 +0100)]
drm/bridge/sii8620: fix MSC message removal

Messages queue can be cleaned up by message callbacks, to avoid repeated
removal of current message it should be removed from the queue before
calling these callbacks.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1485935272-17337-12-git-send-email-a.hajda@samsung.com
7 years agodrm/bridge/sii8620: remove spare CBUS bring-up sequence
Andrzej Hajda [Wed, 1 Feb 2017 07:47:37 +0000 (08:47 +0100)]
drm/bridge/sii8620: remove spare CBUS bring-up sequence

In case of MHL3 CBUS is bring-up already in sii8620_got_ecbus_speed.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1485935272-17337-11-git-send-email-a.hajda@samsung.com
7 years agodrm/bridge/sii8620: fix peer device capabilities read code
Andrzej Hajda [Wed, 1 Feb 2017 07:47:36 +0000 (08:47 +0100)]
drm/bridge/sii8620: fix peer device capabilities read code

Peer capabilities should be read differently depending on protocol version.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1485935272-17337-10-git-send-email-a.hajda@samsung.com
7 years agodrm/bridge/sii8620: respond to feature requests
Andrzej Hajda [Wed, 1 Feb 2017 07:47:35 +0000 (08:47 +0100)]
drm/bridge/sii8620: respond to feature requests

MHL3 protocol requires device to respond to feature request from peer.
This minimal answer fulfills the requirement and allows to continue
negotiation.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1485935272-17337-9-git-send-email-a.hajda@samsung.com
7 years agodrm/bridge/sii8620: add support for burst eMSC transmissions
Andrzej Hajda [Wed, 1 Feb 2017 07:47:34 +0000 (08:47 +0100)]
drm/bridge/sii8620: add support for burst eMSC transmissions

Burst transmissions are used in MHL3 mode negotiation.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1485935272-17337-8-git-send-email-a.hajda@samsung.com
7 years agodrm/bridge/mhl: add write burst related definitions
Andrzej Hajda [Wed, 1 Feb 2017 07:47:33 +0000 (08:47 +0100)]
drm/bridge/mhl: add write burst related definitions

Burst transmissions are required in MHL3 modes.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1485935272-17337-7-git-send-email-a.hajda@samsung.com
7 years agodrm/bridge/sii8620: initial support for eCBUS-S mode
Andrzej Hajda [Wed, 1 Feb 2017 07:47:32 +0000 (08:47 +0100)]
drm/bridge/sii8620: initial support for eCBUS-S mode

The Single-ended eCBUS Mode (eCBUS-S) mode provides 60 Mb/s full-duplex
bidirectional traffic for three channels:
 - CBUS data (CBUS1 channel),
 - High-bandwidth MHL data (eMSC channel),
 - tunneling data (T-CBUS channel).
It is required to fully support MHL3 dongles.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1485935272-17337-6-git-send-email-a.hajda@samsung.com
7 years agodrm/bridge/sii8620: add continuations to messages
Andrzej Hajda [Wed, 1 Feb 2017 07:47:31 +0000 (08:47 +0100)]
drm/bridge/sii8620: add continuations to messages

Due to asynchronous nature of MHL flow of execution is dispersed.
Logical continuation of some actions happens after response of peer,
i.e in interrupt handler. To simplify coding continuation mechanism
has been added - it is now possible to provide continuation callback,
which will be called after peer responds to given action.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1485935272-17337-5-git-send-email-a.hajda@samsung.com
7 years agodrm/bridge/sii8620: add reading device capability registers
Andrzej Hajda [Wed, 1 Feb 2017 07:47:30 +0000 (08:47 +0100)]
drm/bridge/sii8620: add reading device capability registers

This functionality is necessary to implement MHL3 modes.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1485935272-17337-4-git-send-email-a.hajda@samsung.com
7 years agodrm/bridge/sii8620: add MHL3 mode check helper
Andrzej Hajda [Wed, 1 Feb 2017 07:47:29 +0000 (08:47 +0100)]
drm/bridge/sii8620: add MHL3 mode check helper

MHL3 modes differs significantly from MHL1 mode, this helper will be used
frequently to clearly distinguish them.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1485935272-17337-3-git-send-email-a.hajda@samsung.com
7 years agodrm/bridge/sii8620: simplify MHL3 mode setting
Andrzej Hajda [Wed, 1 Feb 2017 07:47:28 +0000 (08:47 +0100)]
drm/bridge/sii8620: simplify MHL3 mode setting

It is not necessary to set REG_COC_CTL0, REG_MHL_COC_CTL1 registers.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1485935272-17337-2-git-send-email-a.hajda@samsung.com
7 years agodrm/etnaviv: Remove duplicate header file include
Liviu Dudau [Tue, 31 Jan 2017 18:56:20 +0000 (18:56 +0000)]
drm/etnaviv: Remove duplicate header file include

etnaviv_gem.h header gets included twice. Remove duplicate.

Signed-off-by: Liviu Dudau <liviu@dudau.co.uk>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
7 years agoRevert "drm/etnaviv: trick drm_mm into giving out a low IOVA"
Lucas Stach [Tue, 17 Jan 2017 10:04:45 +0000 (11:04 +0100)]
Revert "drm/etnaviv: trick drm_mm into giving out a low IOVA"

Now that commandstreams are handled through the cmdbuf suballocator
the workaround to make the IOVA games work is not needed anymore.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
7 years agodrm/etnaviv: add cmdbuf suballocator
Lucas Stach [Mon, 16 Jan 2017 16:29:57 +0000 (17:29 +0100)]
drm/etnaviv: add cmdbuf suballocator

There are 3 big benefits to suballocating a single big DMA buffer
for command submission:

1. Avoid hammering CMA. The old way of allocating and freeing a DMA
   buffer for each submission was hitting some of the real slow
   pathes in CMA, as this allocator was not designed for a concurrent
   small buffers load.

2. Less TLB flushes on IOMMUv2. If a new command buffer is mapped into
   the GPU address space the MMU TLBs need to be flushed. By having
   one big buffer statically mapped to the GPU, a lot of those flushes
   can be avoided.

3. No funky workarounds for GC3000. The FE TLB flush on GC3000 isn't
   reliable. To work around that we tried to lay out the cmdbufs in
   the GPU address space in a way to avoid this issue. This hasn't
   always worked if the address space is crowded. A single statically
   mapped buffer avoids the erratum completely.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
7 years agodrm/etnaviv: get cmdbuf physical address through the cmdbuf abstraction
Lucas Stach [Mon, 16 Jan 2017 16:00:08 +0000 (17:00 +0100)]
drm/etnaviv: get cmdbuf physical address through the cmdbuf abstraction

Don't allow IOMMUv2 to peek directly into the cmdbuf, but get the
needed PA through a dedicated function.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
7 years agodrm/etnaviv: wire up iova handling in new cmdbuf abstraction
Lucas Stach [Mon, 16 Jan 2017 15:52:44 +0000 (16:52 +0100)]
drm/etnaviv: wire up iova handling in new cmdbuf abstraction

Don't call the IOMMU directly, but go through the new cmdbuf abstraction.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
7 years agodrm/etnaviv: move cmdbuf de-/allocation into own file
Lucas Stach [Mon, 16 Jan 2017 15:09:51 +0000 (16:09 +0100)]
drm/etnaviv: move cmdbuf de-/allocation into own file

This will get more complex with the following changes, so move it
into its own place.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
7 years agodrm/etnaviv: always flush MMU TLBs on map/unmap
Lucas Stach [Tue, 17 Jan 2017 09:59:37 +0000 (10:59 +0100)]
drm/etnaviv: always flush MMU TLBs on map/unmap

This ensures that the GPU isn't able to write into already freed
objects, as doing this in the IOVA reaper isn't enough, as the
gem_free_object path will also cause unmaps to happen.

On MMUv2 this also ensures that stale entries, which may have
been prefetched into the TLB will be purged.

The flush is low overhead, as it gets batched up with the next
user command buffer, so this isn't incuring an overhead for
each buffer map/unmap.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
7 years agodrm/etnaviv: constify etnaviv_iommu_ops structures
Bhumika Goyal [Sun, 15 Jan 2017 18:50:28 +0000 (00:20 +0530)]
drm/etnaviv: constify etnaviv_iommu_ops structures

Declare etnaviv_iommu_ops structure as const as it is only used when
the reference of one of its field is stored in the ops field of a
iommu_domain structure. This ops field is of type const, so
etnaviv_iommu_ops structures having similar properties can be declared
const too.

Done using Coccinelle.
Before and after size details of .o file remains the same after
cross compiling for arm architecture.

lst: Trimmed commit message, apply the same change to iommu_v2.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
7 years agodrm: qxl: Embed drm_device into driver structure
Gabriel Krisman Bertazi [Fri, 27 Jan 2017 01:05:48 +0000 (23:05 -0200)]
drm: qxl: Embed drm_device into driver structure

This is the recommended way to create the drm_device structure,
according to DRM documentation.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20170127010548.27970-4-krisman@collabora.co.uk
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agodrm: qxl: Drop duplicated pci_device pointer attribute
Gabriel Krisman Bertazi [Fri, 27 Jan 2017 01:05:47 +0000 (23:05 -0200)]
drm: qxl: Drop duplicated pci_device pointer attribute

qxl_device duplicates the pointer to struct pci_dev, which is not
needed since we already have it in the drm_device structure.  Clean it
up.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20170127010548.27970-3-krisman@collabora.co.uk
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agodrm: qxl: Drop duplicated device pointer attribute
Gabriel Krisman Bertazi [Fri, 27 Jan 2017 01:05:46 +0000 (23:05 -0200)]
drm: qxl: Drop duplicated device pointer attribute

qxl_device duplicates a pointer to struct device, which is not needed
since we already have it in the drm_device structure.  Clean it up.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20170127010548.27970-2-krisman@collabora.co.uk
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agodrm: qxl: Drop misleading comment
Gabriel Krisman Bertazi [Fri, 27 Jan 2017 01:05:45 +0000 (23:05 -0200)]
drm: qxl: Drop misleading comment

No longer true since commit 07f8d9bdb235 ("drm/qxl: add support for > 1
output").  qxl_num_crtc defaults to 4 and is configurable as a module
parameter.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170127010548.27970-1-krisman@collabora.co.uk
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agodrm/bochs: Implement nomodeset
Max Staudt [Wed, 18 Jan 2017 18:10:12 +0000 (19:10 +0100)]
drm/bochs: Implement nomodeset

Up until now, the bochsdrm driver didn't handle the nomodeset option
at boot, and didn't provide a "modeset" module option either.

This patch implements both.

The new parameter can be used by specifying bochs-drm.modeset=0
at boot time.

Signed-off-by: Max Staudt <mstaudt@suse.de>
Link: http://patchwork.freedesktop.org/patch/msgid/1484763012-17783-1-git-send-email-mstaudt@suse.de
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agodrm/vc4: Add DSI driver
Eric Anholt [Tue, 31 Jan 2017 19:29:11 +0000 (11:29 -0800)]
drm/vc4: Add DSI driver

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
7 years agodt-bindings: Document the VC4 DSI module nodes.
Eric Anholt [Wed, 14 Dec 2016 19:46:16 +0000 (11:46 -0800)]
dt-bindings: Document the VC4 DSI module nodes.

These are part of the vc4 display pipeline.

Signed-off-by: Eric Anholt <eric@anholt.net>
Acked-by: Rob Herring <robh@kernel.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20161214194621.16499-7-eric@anholt.net
7 years agodrm/vc4: Add support for feeding DSI encoders from the pixel valve.
Eric Anholt [Wed, 14 Dec 2016 19:46:15 +0000 (11:46 -0800)]
drm/vc4: Add support for feeding DSI encoders from the pixel valve.

We have to set a different pixel format, which tells the hardware to
use the pix_width field that's fed in sideband from the DSI encoder to
divide the "pixel" clock.

Signed-off-by: Eric Anholt <eric@anholt.net>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20161214194621.16499-6-eric@anholt.net
7 years agodrm/vc4: Set up SCALER_DISPCTRL at boot.
Eric Anholt [Wed, 14 Dec 2016 19:46:14 +0000 (11:46 -0800)]
drm/vc4: Set up SCALER_DISPCTRL at boot.

We want the HVS on, obviously, and we also want DSP3 (PV1's source) to
be muxed from HVS channel 2 like we expect in vc4_crtc.c.  The
firmware wasn't setting the DSP3 mux up when both the LCD and HDMI
were disabled.

Signed-off-by: Eric Anholt <eric@anholt.net>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20161214194621.16499-5-eric@anholt.net
7 years agodrm: Clean up the 1366x768 fixup codes
Takashi Iwai [Tue, 17 Jan 2017 16:43:29 +0000 (17:43 +0100)]
drm: Clean up the 1366x768 fixup codes

This is just a cleanup, no functional change.

The fixup code for 1366x768 in drm_mode_create_from_cmdline_mode() is
basically a copy of the existing code in drm_edid.c.  Make the latter
code public so that it can be called from the former function.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: http://patchwork.freedesktop.org/patch/msgid/20170117164329.10551-1-tiwai@suse.de
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
[vsyrjala: include drm_crtc_internal.h to make sparse happy]
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>