openwrt/staging/blogic.git
6 years agodrm/pl111: Use 64-bit arithmetic instead of 32-bit
Gustavo A. R. Silva [Wed, 4 Jul 2018 14:22:55 +0000 (09:22 -0500)]
drm/pl111: Use 64-bit arithmetic instead of 32-bit

Add suffix ULL to constant 1000 in order to give the compiler complete
information about the proper arithmetic to use.

Notice that such constant is used in a context that expects an
expression of type u64 (64 bits, unsigned) and the following
expression is currently being evaluated using 32-bit arithmetic:

mode->clock * 1000

Addresses-Coverity-ID: 1466139 ("Unintentional integer overflow")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20180704142255.GA8614@embeddedor.com
6 years agodrm/pl111: Replace drm_dev_unref with drm_dev_put
Thomas Zimmermann [Tue, 17 Jul 2018 08:36:57 +0000 (10:36 +0200)]
drm/pl111: Replace drm_dev_unref with drm_dev_put

This patch unifies the naming of DRM functions for reference counting
of struct drm_device. The resulting code is more aligned with the rest
of the Linux kernel interfaces.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20180717083657.16262-1-tzimmermann@suse.de
6 years agodrm/vc4: Replace drm_dev_unref with drm_dev_put
Thomas Zimmermann [Tue, 17 Jul 2018 08:54:28 +0000 (10:54 +0200)]
drm/vc4: Replace drm_dev_unref with drm_dev_put

This patch unifies the naming of DRM functions for reference counting
of struct drm_device. The resulting code is more aligned with the rest
of the Linux kernel interfaces.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20180717085428.18500-1-tzimmermann@suse.de
6 years agodrm/sun4i: sun8i: Avoid clearing blending order at each atomic commit
Paul Kocialkowski [Tue, 17 Jul 2018 12:25:22 +0000 (14:25 +0200)]
drm/sun4i: sun8i: Avoid clearing blending order at each atomic commit

Blending order is set based on the z position of each DRM plane. The
blending order register is currently cleared at each atomic DRM commit,
with the intent that each committed plane will set the appropriate
bits (based on its z-pos) when enabling the plane.

However, it sometimes happens that a particular plane is left unchanged
by an atomic commit and thus will not be configured again. In that
scenario, blending order is cleared and only the bits relevant for the
planes affected by the commit are set. This leaves the planes that did
not change without their blending order set in the register, leading
to that plane not being displayed.

Instead of clearing the blending order register at every atomic commit,
this change moves the register's initial clear at bind time and only
clears the bits for a specific plane when disabling it or changing its
zpos.

This way, planes that are left untouched by a DRM atomic commit are
no longer disabled.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180717122522.11327-1-paul.kocialkowski@bootlin.com
6 years agodrm/sun4i: Replace drm_dev_unref with drm_dev_put
Thomas Zimmermann [Tue, 17 Jul 2018 08:48:14 +0000 (10:48 +0200)]
drm/sun4i: Replace drm_dev_unref with drm_dev_put

This patch unifies the naming of DRM functions for reference counting
of struct drm_device. The resulting code is more aligned with the rest
of the Linux kernel interfaces.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180717084814.18091-1-tzimmermann@suse.de
6 years agodrm/connector: Fix typo in drm_connector_list_iter_next()
Lyude Paul [Mon, 16 Jul 2018 17:17:11 +0000 (13:17 -0400)]
drm/connector: Fix typo in drm_connector_list_iter_next()

Signed-off-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180716171711.413-1-lyude@redhat.com
6 years agodrm/dp_helper: Add DP aux channel tracing
Lyude Paul [Mon, 16 Jul 2018 15:44:32 +0000 (11:44 -0400)]
drm/dp_helper: Add DP aux channel tracing

This is something we've needed for a very long time now, as it makes
debugging issues with faulty MST hubs along with debugging issues
regarding us interfacing with hubs correctly vastly easier to debug.
Currently this can actually be done if you trace the i2c devices for DP
using ftrace but that's significantly less useful for a couple of
reasons:

- Tracing the i2c devices through ftrace means all of the traces are
  going to contain a lot of "garbage" output that we're sending over the
  i2c line. Most of this garbage comes from retrying transactions, DRM's
  helper library adding extra transactions to work around bad hubs, etc.
- Having a user set up ftrace so that they can provide debugging
  information is a lot more difficult then being able to say "just boot
  with drm.debug=0x100"
- We can potentially expand upon this tracing in the future to print
  debugging information in regards to other DP transactions like MST
  sideband transactions

This is inspired by a patch Rob Clark sent to do this a long time back.
Neither of us could find the patch however, so we both assumed it would
probably just be easier to rewrite it anyway.

Cc: Rob Clark <robdclark@gmail.com>
Signed-off-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180716154432.13433-1-lyude@redhat.com
6 years agodrm: writeback: Fix doc that says connector should be disconnected
Alexandru Gheorghe [Fri, 13 Jul 2018 15:10:58 +0000 (16:10 +0100)]
drm: writeback: Fix doc that says connector should be disconnected

During iteration process one of the proposed mechanism for not
breaking existing userspace was to report writeback connectors as
disconnected, however the final version used
DRM_CLIENT_CAP_WRITEBACK_CONNECTORS for that purpose.

Change-Id: I2319d099f7669094c8530f1521abdbca08e76486
Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Acked-by: Liviu Dudau <liviu.dudau@arm.com>
Link: https://patchwork.freedesktop.org/patch/238399/
6 years agodma-buf: Move BUG_ON from _add_shared_fence to _add_shared_inplace
Michel Dänzer [Wed, 4 Jul 2018 15:14:05 +0000 (17:14 +0200)]
dma-buf: Move BUG_ON from _add_shared_fence to _add_shared_inplace

Fixes the BUG_ON spuriously triggering under the following
circumstances:

* reservation_object_reserve_shared is called with shared_count ==
  shared_max - 1, so obj->staged is freed in preparation of an in-place
  update.

* reservation_object_add_shared_fence is called with the first fence,
  after which shared_count == shared_max.

* reservation_object_add_shared_fence is called with a follow-up fence
  from the same context.

In the second reservation_object_add_shared_fence call, the BUG_ON
triggers. However, nothing bad would happen in
reservation_object_add_shared_inplace, since both fences are from the
same context, so they only occupy a single slot.

Prevent this by moving the BUG_ON to where an overflow would actually
happen (e.g. if a buggy caller didn't call
reservation_object_reserve_shared before).

v2:
* Fix description of breaking scenario (Christian König)
* Add bugzilla reference

Cc: stable@vger.kernel.org
Bugzilla: https://bugs.freedesktop.org/106418
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> # v1
Reviewed-by: Christian König <christian.koenig@amd.com> # v1
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180704151405.10357-1-michel@daenzer.net
6 years agodrm/meson: Make DMT timings parameters and pixel clock generic
Neil Armstrong [Mon, 16 Jul 2018 07:40:14 +0000 (09:40 +0200)]
drm/meson: Make DMT timings parameters and pixel clock generic

Remove the modes timings tables for DMT modes and calculate the HW
paremeters from the modes timings.

Switch the DMT modes pixel clock calculation out of the static frequency
list to a generic calculation from a range of possible PLL dividers.

This patch is an intermediate step towards usage of the Common Clock
Framwework for PLL setup, by reworking the code to have common
sel_pll() function called by the CEA (HDMI) freq setup and the generic
DMT frequencies setup, we should be able to simply call clk_set_rate()
on the PLL clock handle in a near future.

The CEA (HDMI) and CVBS modes needs very specific clock paths that CCF will
never be able to determine by itself, so there is still some work to do for
a full handoff to CCF handling the clocks.

This setup permits setting non-CEA modes like :
- 1600x900-60Hz
- 1280x1024-75Hz
- 1280x1024-60Hz
- 1440x900-60Hz
- 1366x768-60Hz
- 1280x800-60Hz
- 1152x864-75Hz
- 1024x768-75Hz
- 1024x768-70Hz
- 1024x768-60Hz
- 832x624-75Hz
- 800x600-75Hz
- 800x600-72Hz
- 800x600-60Hz
- 640x480-75Hz
- 640x480-73Hz
- 640x480-67Hz

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Acked-by: Jerome Brunet <jbrunet@baylibre.com>
[narmstrong: fixed trivial checkpatch issues]
Link: https://patchwork.freedesktop.org/patch/msgid/1531726814-14638-1-git-send-email-narmstrong@baylibre.com
6 years agodrm/doc: use inline kerneldoc style for drm_crtc_state
Daniel Vetter [Mon, 9 Jul 2018 08:40:15 +0000 (10:40 +0200)]
drm/doc: use inline kerneldoc style for drm_crtc_state

Lots of added text here since I think the various control flow bits
are worth explaining a bit better.

v2: Fix conflict with Boris' no_vblank addition.

Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180709084016.23750-15-daniel.vetter@ffwll.ch
6 years agodrm/doc: Include drm_of.c helpers
Daniel Vetter [Mon, 9 Jul 2018 08:40:14 +0000 (10:40 +0200)]
drm/doc: Include drm_of.c helpers

Fixes a dead link I spotted in the struct drm_crtc docs. Comments
themselves are in a surprisingly good state.

v2: Fix subject typo (Sean).

Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180709084016.23750-14-daniel.vetter@ffwll.ch
6 years agodrm/doc: Group the fb gem helpers better
Daniel Vetter [Mon, 9 Jul 2018 08:40:13 +0000 (10:40 +0200)]
drm/doc: Group the fb gem helpers better

Instead of spreading them all over the place.

Cc: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180709084016.23750-13-daniel.vetter@ffwll.ch
6 years agodrm/doc: move struct drm_crtc to in-line comments
Daniel Vetter [Mon, 9 Jul 2018 08:40:12 +0000 (10:40 +0200)]
drm/doc: move struct drm_crtc to in-line comments

And clean them up a bit, as usual.

v2: Fix nits (Sean).

Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180709084016.23750-12-daniel.vetter@ffwll.ch
6 years agodrm: switch drm_plane to inline comments
Daniel Vetter [Mon, 9 Jul 2018 08:40:10 +0000 (10:40 +0200)]
drm: switch drm_plane to inline comments

And use that opportunity to polish the kernel doc all around:
- Beef up some of the documentation.
- Intro text for drm_plane and better links
- Fix all the hyperlinks!

v2: Fix linebreaks.

Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180709084016.23750-10-daniel.vetter@ffwll.ch
6 years agodrm: Switch drm_plane_state to inline kerneldoc style
Daniel Vetter [Mon, 9 Jul 2018 08:40:09 +0000 (10:40 +0200)]
drm: Switch drm_plane_state to inline kerneldoc style

For consistency and to encourage more detailed documentation. While
doing this also beefed up a few of the comments, linking at least to
the setup function. Plus fixed all the hyperlinks.

Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180709084016.23750-9-daniel.vetter@ffwll.ch
6 years agodrm: drop _mode_ from remaining connector functions
Daniel Vetter [Mon, 9 Jul 2018 08:40:08 +0000 (10:40 +0200)]
drm: drop _mode_ from remaining connector functions

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 <seanpaul@chromium.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180709084016.23750-8-daniel.vetter@ffwll.ch
6 years agodrm: drop _mode_ from drm_mode_connector_attach_encoder
Daniel Vetter [Mon, 9 Jul 2018 08:40:07 +0000 (10:40 +0200)]
drm: drop _mode_ from drm_mode_connector_attach_encoder

Again to align with the usual prefix of just drm_connector_. Again
done with sed + manual fixup for indent issues.

Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180709084016.23750-7-daniel.vetter@ffwll.ch
6 years agodrm: drop _mode_ from update_edit_property()
Daniel Vetter [Mon, 9 Jul 2018 08:40:06 +0000 (10:40 +0200)]
drm: drop _mode_ from update_edit_property()

Just makes it longer, and for most things in drm_connector.[hc] we
just use the drm_connector_ prefix. Done with sed + a bit of manual
fixup for the indenting.

Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180709084016.23750-6-daniel.vetter@ffwll.ch
6 years agodrm/doc: polish for sturct drm_connector
Daniel Vetter [Mon, 9 Jul 2018 08:40:05 +0000 (10:40 +0200)]
drm/doc: polish for sturct drm_connector

- switch everything over to inline comments
- add notes about locking, links to functions and other related stuff
- also include a note about Ville's soon-to-be-merged
  drm_connector_for_each_possible_encoder().

Also check that all the hyperlinks in drm_connector.h work and fix
them as needed.

Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180709084016.23750-5-daniel.vetter@ffwll.ch
6 years agodrm/doc: switch drm_connector_state to inline comments
Daniel Vetter [Mon, 9 Jul 2018 08:40:04 +0000 (10:40 +0200)]
drm/doc: switch drm_connector_state to inline comments

For consistency. Also spelled out the docs for ->best_encoder a bit
more while at it.

Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180709084016.23750-4-daniel.vetter@ffwll.ch
6 years agodrm: move drv test macros out of drmP.h
Daniel Vetter [Mon, 9 Jul 2018 08:40:02 +0000 (10:40 +0200)]
drm: move drv test macros out of drmP.h

Last bit the prevented us from starting to delete the drmP.h monster
includes from source files!

Also add kernel-doc while moving them.

A nice consistent drm_dev_ prefix would be cute for these, but since
they're used everywhere I've figured I'll leave this bikeshed aside
for now.

Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180709084016.23750-2-daniel.vetter@ffwll.ch
6 years agodrm/arm/malidp: Add modifier definitions for describing Arm Framebuffer Compression...
Ayan Kumar Halder [Tue, 10 Jul 2018 13:18:54 +0000 (14:18 +0100)]
drm/arm/malidp: Add modifier definitions for describing Arm Framebuffer Compression (AFBC).

AFBC is a proprietary lossless image compression protocol and format.
It provides fine-grained random access and minimizes the amount of data
transferred between IP blocks.
AFBC has several features which may be supported and/or used, which are
represented using bits in the modifier. Not all combinations are valid,
and different devices or use-cases may support different combinations.

Changes from v2:-
- Added ack by Maarten Lankhorst

Signed-off-by: Rosen Zhelev <rosen.zhelev@arm.com>
Signed-off-by: Ayan Kumar halder <ayan.halder@arm.com>
Reviewed-by: Brian Starkey <brian.starkey@arm.com>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Reviewed-by: James (Qian) Wang <james.qian.wang@arm.com>
Acked-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://lkml.org/lkml/2018/7/10/360
6 years agodrm: Fix kerneldoc for DRM_MODE_PROP_IMMUTABLE
Sean Paul [Fri, 13 Jul 2018 15:34:44 +0000 (11:34 -0400)]
drm: Fix kerneldoc for DRM_MODE_PROP_IMMUTABLE

Noticed this while browsing the docs.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180713153444.95466-1-seanpaul@chromium.org
6 years agodrm: Skip __drm_mode_set_config_internal() on atomic drivers
Ville Syrjälä [Thu, 5 Jul 2018 19:00:10 +0000 (22:00 +0300)]
drm: Skip __drm_mode_set_config_internal() on atomic drivers

Everything (apart from the actual ->set_config() call)
__drm_mode_set_config_internal() does is now useless on
atomic drivers. So let's just skip all the foreplay.

v2: Use drm_drv_uses_atomic_modeset() (Daniel)

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180705190010.19836-1-ville.syrjala@linux.intel.com
6 years agodrm: Introduce __setplane_atomic()
Ville Syrjälä [Thu, 5 Jul 2018 18:59:07 +0000 (21:59 +0300)]
drm: Introduce __setplane_atomic()

All the plane->fb/old_fb/crtc dance of __setplane_internal() is
pointless on atomic drivers. So let's just introduce a simpler
version that skips all that.

Ideally we could also skip the __setplane_check() as
drm_atomic_plane_check() already checks for everything, but the
legacy cursor/"async" .update_plane() tricks bypass that so
we still need to call __setplane_check(). Toss in a FIXME to
remind someone to clean this up later.

v2: Use drm_drv_uses_atomic_modeset() (Daniel)

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180705185907.9524-1-ville.syrjala@linux.intel.com
6 years agodrm: Extract __setplane_check()
Ville Syrjälä [Thu, 28 Jun 2018 13:54:55 +0000 (16:54 +0300)]
drm: Extract __setplane_check()

Pull all the error checking out from __set_plane_internal() to a helper
function. We'll have another user of this soon.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180628135457.14647-1-ville.syrjala@linux.intel.com
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
6 years agodrm/i915: add DisplayPort CEC-Tunneling-over-AUX support
Hans Verkuil [Wed, 11 Jul 2018 13:29:09 +0000 (15:29 +0200)]
drm/i915: add DisplayPort CEC-Tunneling-over-AUX support

Implement support for this DisplayPort feature.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180711132909.25409-4-hverkuil@xs4all.nl
6 years agodrm-kms-helpers.rst: document the DP CEC helpers
Hans Verkuil [Wed, 11 Jul 2018 13:29:08 +0000 (15:29 +0200)]
drm-kms-helpers.rst: document the DP CEC helpers

Document the Display Port CEC helper functions.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180711132909.25409-3-hverkuil@xs4all.nl
6 years agodrm: add support for DisplayPort CEC-Tunneling-over-AUX
Hans Verkuil [Wed, 11 Jul 2018 13:29:07 +0000 (15:29 +0200)]
drm: add support for DisplayPort CEC-Tunneling-over-AUX

This adds support for the DisplayPort CEC-Tunneling-over-AUX
feature that is part of the DisplayPort 1.3 standard.

Unfortunately, not all DisplayPort/USB-C to HDMI adapters with a
chip that has this capability actually hook up the CEC pin, so
even though a CEC device is created, it may not actually work.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180711132909.25409-2-hverkuil@xs4all.nl
6 years agodrm/client: Fix double free in error path
Noralf Trønnes [Thu, 12 Jul 2018 15:04:14 +0000 (17:04 +0200)]
drm/client: Fix double free in error path

This fixes a static checker warning:

drivers/gpu/drm/drm_client.c:289 drm_client_buffer_create()
error: double free of 'buffer'

Extend drm_client_buffer_delete() to handle the case when there's no
dumb buffer attached and drop the extra kfree.

Fixes: c76f0f7cb546 ("drm: Begin an API for in-kernel clients")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180712150414.46908-1-noralf@tronnes.org
6 years agodrm/sti: Replace drm_dev_unref with drm_dev_put
Thomas Zimmermann [Thu, 12 Jul 2018 15:26:39 +0000 (17:26 +0200)]
drm/sti: Replace drm_dev_unref with drm_dev_put

This patch unifies the naming of DRM functions for reference counting
of struct drm_device. The resulting code is more aligned with the rest
of the Linux kernel interfaces.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180712152639.30934-1-tzimmermann@suse.de
6 years agodrm/stm: Replace drm_dev_unref with drm_dev_put
Thomas Zimmermann [Fri, 13 Jul 2018 08:06:25 +0000 (10:06 +0200)]
drm/stm: Replace drm_dev_unref with drm_dev_put

This patch unifies the naming of DRM functions for reference counting
of struct drm_device. The resulting code is more aligned with the rest
of the Linux kernel interfaces.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Philippe Cornu <philippe.cornu@st.com>
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180713080625.18256-1-tzimmermann@suse.de
6 years agodrm/tinydrm: add backlight dependency for ili9341
Arnd Bergmann [Mon, 9 Jul 2018 15:20:29 +0000 (17:20 +0200)]
drm/tinydrm: add backlight dependency for ili9341

This tinydrm driver fails to link without the backlight support:

drivers/gpu/drm/tinydrm/ili9341.o: In function `ili9341_probe':
ili9341.c:(.text+0x578): undefined reference to `devm_of_find_backlight'

Fixes: 3fa0e8f6f960 ("drm/tinydrm: new driver for ILI9341 display panels")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: David Lechner <david@lechnology.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180709152106.990066-1-arnd@arndb.de
6 years agodrm/sun4i: tcon-top: Fix return type warning
Maxime Ripard [Thu, 12 Jul 2018 08:08:18 +0000 (10:08 +0200)]
drm/sun4i: tcon-top: Fix return type warning

When commit af11942ee44e ("drm/sun4i: tcon-top: Cleanup clock handling")
was merged, the error handling path of the of_property_match_string was
changed to take into account the fact that the returned value of that
function wasn't an error pointer but an error code.

Unfortunately, this introduced a warning since the now returned value is an
integer, while the sun8i_tcon_top_register_gate function should return an
error pointer.

Fix that by calling ERR_PTR.

Cc: Jernej Skrabec <jernej.skrabec@siol.net>
Cc: Chen-Yu Tsai <wens@csie.org>
Fixes: af11942ee44e ("drm/sun4i: tcon-top: Cleanup clock handling")
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180712080818.3571-1-maxime.ripard@bootlin.com
6 years agodrm/sun4i: Implement zpos for DE2
Jernej Skrabec [Fri, 6 Jul 2018 16:47:32 +0000 (18:47 +0200)]
drm/sun4i: Implement zpos for DE2

Initial implementation of DE2 planes only supported fixed zpos.

Expand implementation with configurable zpos property.

Implementation background:
Channel in DE2 driver represents one DRM plane, whereas pipe is just
mapped channel to known Z position. Pipe 0 will always be at the bottom,
pipe 1 just above pipe 0 and so on. If, for example, channel 1 is mapped
at pipe 0 and channel 0 at pipe 1, whatever is on channel 0 will appear
on top.

Before this commit, channel id was used for addressing channel related
registers (prefixed with SUN8I_MIXER_CHAN_UI_ or SUN8I_MIXER_CHAN_VI_)
and pipe registers (prefixed with SUN8I_MIXER_BLEND_). Additionally,
register SUN8I_MIXER_BLEND_ROUTE, which takes care for mapping channels
to pipes had fixed value. It mapped channel 0 to pipe 0, 1 to 1 and so
on. Consequence of all that was fixed Z order of planes.

With this commit, pipe registers are using zpos property as index and
channel related registers still use channel id as index. Pipe mapping
register is now set dynamically too and pipe enable register is rebuild
every time to make sure only active pipes are enabled.

Testing was done to confirm that there is no issues if bottom plane
contains pixels with alpha value < 0xff and if it doesn't whole screen.

Tested-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180706164732.24166-1-jernej.skrabec@siol.net
6 years agodrm/vkms: Add framebuffer and plane helpers
Rodrigo Siqueira [Thu, 12 Jul 2018 13:41:02 +0000 (10:41 -0300)]
drm/vkms: Add framebuffer and plane helpers

This patch appends the minimum helpers related to framebuffer and plane
to make vkms minimally usable.

Changes since V1:
- None
Changes since V2:
- Squash "Add plane helper struct" and "Add helper for framebuffer
  create"
Changes since V3:
 Daniel Vetter:
 - Remove atomic_check from plane helper

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/d37807da7d3b39444b4c9abb149fe3c518d07c61.1531402095.git.rodrigosiqueiramelo@gmail.com
6 years agodrm/sun4i: fix build failure with CONFIG_DRM_SUN8I_MIXER=m
Arnd Bergmann [Wed, 11 Jul 2018 14:43:10 +0000 (16:43 +0200)]
drm/sun4i: fix build failure with CONFIG_DRM_SUN8I_MIXER=m

Having DRM_SUN4I built-in but DRM_SUN8I_MIXER as a loadable module results in
a link error, as we try to access a symbol from the sun8i_tcon_top.ko module:

ERROR: "sun8i_tcon_top_of_table" [drivers/gpu/drm/sun4i/sun8i-drm-hdmi.ko] undefined!
ERROR: "sun8i_tcon_top_of_table" [drivers/gpu/drm/sun4i/sun4i-drm.ko] undefined!

This solves the problem by adding a silent symbol for the tcon_top module,
building it as a separate module in exactly the cases that we need it,
but in a way that it is reachable by the other modules.

Fixes: 57e23de02f48 ("drm/sun4i: DW HDMI: Expand algorithm for possible crtcs")
Fixes: ef0cf6441fbb ("drm/sun4i: Add support for traversing graph with TCON TOP")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180711144403.1022829-1-arnd@arndb.de
6 years agodrm/sun4i: mixer: Read id from DT
Jernej Skrabec [Wed, 11 Jul 2018 11:27:06 +0000 (13:27 +0200)]
drm/sun4i: mixer: Read id from DT

Currently, TCON supports 2 ways to match TCON with engine (mixer in this
case). Old way is to just traverse of graph backwards and compare node
pointer. New way is to match TCON and engine by their respective ids.
All SoCs with DE2 enabled till now used the old way, which means mixer
id was never used and thus never implemented.

However, for R40, only the new way will be used. To prepare for that,
implement mixer id fetching from DT.

Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180711112706.30222-1-jernej.skrabec@siol.net
6 years agodrm/sun4i: DW HDMI: Make symbol sun8i_dw_hdmi_pltfm_driver static
Wei Yongjun [Wed, 11 Jul 2018 13:22:47 +0000 (13:22 +0000)]
drm/sun4i: DW HDMI: Make symbol sun8i_dw_hdmi_pltfm_driver static

Fixes the following sparse warning:

drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c:228:24: warning:
 symbol 'sun8i_dw_hdmi_pltfm_driver' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1531315367-190647-1-git-send-email-weiyongjun1@huawei.com
6 years agodrm/vkms: Add vblank events simulated by hrtimers
Rodrigo Siqueira [Thu, 12 Jul 2018 02:02:26 +0000 (23:02 -0300)]
drm/vkms: Add vblank events simulated by hrtimers

This commit adds regular vblank events simulated through hrtimers, which
is a feature required by VKMS to mimic real hardware. Additionally, all
the vblank event send after pageflip is kept in the atomic_flush
function.

Changes since V1:
 - Compute the vblank timer interval per interruption
 Ville Syrjälä and Daniel Vetter:
 - Removes hardcoded vblank interval to get it from user space

Changes since V2:
 Chris Wilson
 - Removes unnecessary algorithm to compute the next period
 Daniel Vetter:
 - Uses drm_calc_timestamping_constants to get the vblank interval
   instead of calculating it manually
 - Adds disable_vblank helper that turns of crtc
 - Simplifies implementation by using drm_crtc_arm_vblank_event
 - Replaces the code in atomic_begin to atomic_flush
 - Removes unnecessary field in vkms_output

Changes since V3:
 Daniel Vetter:
 - Squash "drm/vkms: Add atomic helpers functions" into the commit that
   handling vblank events simulated by hrtimers

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/7709bba40782ec06332d57fff337797b272581fc.1531359228.git.rodrigosiqueiramelo@gmail.com
6 years agodrm/vkms: Add connectors helpers
Rodrigo Siqueira [Thu, 12 Jul 2018 02:02:14 +0000 (23:02 -0300)]
drm/vkms: Add connectors helpers

This patch adds the struct drm_connector_helper_funcs with some
necessary hooks. Additionally, it also adds some missing hooks at
drm_connector_funcs.

Changes since V1:
- None
Change since V2:
 Daniel Vetter:
 - Remove vkms_conn_mode_valid

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/c8ee28b889234e866ef18bce4216385661c48041.1531359228.git.rodrigosiqueiramelo@gmail.com
6 years agodrm: gma500: Changed __attribute__((packed)) to __packed
Eames Trinh [Tue, 10 Jul 2018 13:00:21 +0000 (15:00 +0200)]
drm: gma500: Changed __attribute__((packed)) to __packed

Signed-off-by: Eames Trinh <eamestrinh@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180710130021.4499-1-eamestrinh@gmail.com
6 years agodrm/vkms: Add dumb operations
Rodrigo Siqueira [Thu, 12 Jul 2018 02:01:47 +0000 (23:01 -0300)]
drm/vkms: Add dumb operations

VKMS currently does not handle dumb data, and as a consequence, it does
not provide mechanisms for handling gem. This commit adds the necessary
support for gem object/handler and the dumb functions.

Changes since V1:
 Daniel Vetter:
 - Add dumb buffer support to the same patchset
Changes since V2:
 Haneen:
 - Add missing gem_free_object_unlocked callback to fix the warning
   "Memory manager not clean during takedown"

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/70b7becc91c6a323dbc15cb5fc912cbdfe4ef7d9.1531359228.git.rodrigosiqueiramelo@gmail.com
6 years agodrm/client: Fix: drm_client_new: Don't require DRM to be registered
Noralf Trønnes [Wed, 11 Jul 2018 15:56:32 +0000 (17:56 +0200)]
drm/client: Fix: drm_client_new: Don't require DRM to be registered

Commit 894a677f4b3e ("drm/cma-helper: Use the generic fbdev emulation")
broke almost all drivers that use the CMA helper.

The reason is that drm_client_new() requires that the DRM device has
been registered, but the drivers register fbdev before registering DRM.

Remove the requirement that DRM should be registered when creating a
new client.

Fixes: c76f0f7cb546 ("drm: Begin an API for in-kernel clients")
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Icenowy Zheng <icenowy@aosc.io>
Cc: Chen-Yu Tsai <wens@csie.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Tested-by: Icenowy Zheng <icenowy@aosc.io>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180711155632.37437-1-noralf@tronnes.org
6 years agodrm/tinydrm: Fix doc build warnings
Noralf Trønnes [Tue, 10 Jul 2018 15:05:18 +0000 (17:05 +0200)]
drm/tinydrm: Fix doc build warnings

include/drm/tinydrm/tinydrm.h:34: warning: Function parameter or member 'fb_dirty' not described in 'tinydrm_device'
drivers/gpu/drm/tinydrm/mipi-dbi.c:272: warning: Function parameter or member 'crtc_state' not described in 'mipi_dbi_enable_flush'
drivers/gpu/drm/tinydrm/mipi-dbi.c:272: warning: Function parameter or member 'plane_state' not described in 'mipi_dbi_enable_flush'

Move struct member docs inline so it's not missed next time.

Cc: David Lechner <david@lechnology.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: David Lechner <david@lechnology.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180710150518.10528-1-noralf@tronnes.org
6 years agodrm/panel: simple: Add Sharp LQ035Q7DB03 panel support
Vladimir Zapolskiy [Fri, 6 Jul 2018 18:51:01 +0000 (21:51 +0300)]
drm/panel: simple: Add Sharp LQ035Q7DB03 panel support

The change adds support for Sharp LQ035Q7DB03 3.5" QVGA TFT panel.

Note that this aged panel is already found in the kernel sources,
for instance in board mach files mach-mx21ads.c, mach-mx27ads.c,
mach-pcm043.c, lpd270.c and imx27-phytec-phycore-rdk.dts.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180706185101.31186-1-vz@mleia.com
6 years agodt-bindings: display: sun4i-drm: Fix order of DW HDMI PHY compatibles
Jernej Skrabec [Tue, 10 Jul 2018 20:35:11 +0000 (22:35 +0200)]
dt-bindings: display: sun4i-drm: Fix order of DW HDMI PHY compatibles

They are currently sorted alphabetically. However, they should be sorted
by release date of the family and then alphabetically.

Fixes: 03c35dbf73e0 ("dt-bindings: display: sun4i-drm: Add description of A64 HDMI PHY")
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180710203511.18454-19-jernej.skrabec@siol.net
6 years agodrm/sun4i: tcon-top: Remove mux configuration at probe time
Jernej Skrabec [Tue, 10 Jul 2018 20:35:10 +0000 (22:35 +0200)]
drm/sun4i: tcon-top: Remove mux configuration at probe time

Now that R40 TCON migrated to runtime mux configuration, old code can be
removed.

Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180710203511.18454-18-jernej.skrabec@siol.net
6 years agodrm/sun4i: tcon-top: Add helpers for mux switching
Jernej Skrabec [Tue, 10 Jul 2018 20:35:04 +0000 (22:35 +0200)]
drm/sun4i: tcon-top: Add helpers for mux switching

We want to be able to set TCON TOP muxes at runtime. Add helpers for
that.

Old, static configuration of muxes at probe time is preserved for now.
It will be removed when R40 TCON starts using them.

Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180710203511.18454-12-jernej.skrabec@siol.net
6 years agodrm/sun4i: mixer: Order includes alphabetically
Jernej Skrabec [Tue, 10 Jul 2018 20:35:02 +0000 (22:35 +0200)]
drm/sun4i: mixer: Order includes alphabetically

Includes are not alphabetically ordered.

Reorder them.

Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180710203511.18454-10-jernej.skrabec@siol.net
6 years agodrm/sun4i: DW HDMI: Release nodes if error happens during CRTC search
Jernej Skrabec [Tue, 10 Jul 2018 20:35:00 +0000 (22:35 +0200)]
drm/sun4i: DW HDMI: Release nodes if error happens during CRTC search

If error happens in sun8i_dw_hdmi_find_possible_crtcs(), nodes are not
released with of_node_put() before returning.

Fix that by calling of_node_put() when necessary. While on it, clean up
the code by using of_graph_get_remote_node() which also lowers number of
cases where error handling has to be performed.

Fixes: 57e23de02f48 ("drm/sun4i: DW HDMI: Expand algorithm for possible crtcs")
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180710203511.18454-8-jernej.skrabec@siol.net
6 years agodt-bindings: display: sun4i-drm: Add R40 TV TCON description
Jernej Skrabec [Tue, 10 Jul 2018 20:34:59 +0000 (22:34 +0200)]
dt-bindings: display: sun4i-drm: Add R40 TV TCON description

TCON description is expanded with R40 TV TCON compatible. It is a bit
special, because it is connected to TCON TOP instead directly to mixer
and it needs special handling.

Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180710203511.18454-7-jernej.skrabec@siol.net
6 years agodrm/sun4i: tcon: Release node when traversing of graph
Jernej Skrabec [Tue, 10 Jul 2018 20:34:58 +0000 (22:34 +0200)]
drm/sun4i: tcon: Release node when traversing of graph

Function sun4i_tcon_find_engine_traverse() doesn't release node if it
needs to traverse of graph deeper than 1 level.

Fix this by calling of_node_put().

Fixes: 49836b11fe71 ("drm/sun4i: tcon: Generalize engine search algorithm")
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180710203511.18454-6-jernej.skrabec@siol.net
6 years agodrm/sun4i: tcon-top: Cleanup clock handling
Jernej Skrabec [Tue, 10 Jul 2018 20:34:57 +0000 (22:34 +0200)]
drm/sun4i: tcon-top: Cleanup clock handling

There is no need to acquire reference to clock just to get its name.

This commit just cleans up the code. There is no functional change.

Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
[Maxime: Fixed the of_property_match_string error check]
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180710203511.18454-5-jernej.skrabec@siol.net
6 years agodrm/sun4i: Add R40 display engine compatible
Jernej Skrabec [Tue, 10 Jul 2018 20:34:55 +0000 (22:34 +0200)]
drm/sun4i: Add R40 display engine compatible

R40 has versatile display pipeline. It supports two simultanious outputs
on various outputs (TVE, VGA, HDMI, MIPI DSI, LCD).

Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180710203511.18454-3-jernej.skrabec@siol.net
6 years agodt-bindings: display: sun4i-drm: Add R40 display engine compatible
Jernej Skrabec [Tue, 10 Jul 2018 20:34:54 +0000 (22:34 +0200)]
dt-bindings: display: sun4i-drm: Add R40 display engine compatible

R40 has pretty unique display pipeline. It supports two outputs at the
same time.

Possible outputs:
- 1x HDMI,
- 2x TV output
- 1x VGA,
- 1x MIPI DSI and
- 2x LCD outputs

That is the biggest number of possible outputs from all Allwinner SoC.
Because of that, add new compatible for it.

Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180710203511.18454-2-jernej.skrabec@siol.net
6 years agodrm/panel: p079zca: Use of_device_get_match_data()
Thierry Reding [Tue, 10 Jul 2018 10:51:38 +0000 (12:51 +0200)]
drm/panel: p079zca: Use of_device_get_match_data()

Use this helper to get rid of some extra boilerplate code.

Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180710110127.12315-1-thierry.reding@gmail.com
6 years agodrm/panel: type promotion bug in s6e8aa0_read_mtp_id()
Dan Carpenter [Wed, 4 Jul 2018 09:38:09 +0000 (12:38 +0300)]
drm/panel: type promotion bug in s6e8aa0_read_mtp_id()

The ARRAY_SIZE() macro is type size_t.  If s6e8aa0_dcs_read() returns a
negative error code, then "ret < ARRAY_SIZE(id)" is false because the
negative error code is type promoted to a high positive value.

Fixes: 02051ca06371 ("drm/panel: add S6E8AA0 driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180704093807.s3lqsb2v6dg2k43d@kili.mountain
6 years agodt-bindings: Add KINGDISPLAY KD097D04 panel bindings
Nickey Yang [Mon, 2 Jul 2018 10:32:28 +0000 (12:32 +0200)]
dt-bindings: Add KINGDISPLAY KD097D04 panel bindings

The KINGDISPLAY KD097D04 is a 9.7" panel with a 1536x2048
resolution and connected to DSI using 8 lanes.

Signed-off-by: Nickey Yang <nickey.yang@rock-chips.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180702103229.3952-3-heiko@sntech.de
6 years agodt-bindings: Add vendor prefix for kingdisplay
Nickey Yang [Mon, 2 Jul 2018 10:32:27 +0000 (12:32 +0200)]
dt-bindings: Add vendor prefix for kingdisplay

Kingdisplay Technology Co., Ltd, established in
China Shenzhen in 2006, is a national high-tech
enterprise specializing in the R&D, manufacturing
and marketing of TFT-LCM and touch panel.

Signed-off-by: Nickey Yang <nickey.yang@rock-chips.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180702103229.3952-2-heiko@sntech.de
6 years agodrm/panel: p079zca: Support Innolux P097PFG panel
Lin Huang [Mon, 2 Jul 2018 10:27:21 +0000 (12:27 +0200)]
drm/panel: p079zca: Support Innolux P097PFG panel

Support Innolux P097PFG 9.7" 1536x2048 TFT LCD panel, it reuse
the Innolux P079ZCA panel driver.

Changes in v2:
- None
Changes in v3:
- None
Changes in v4:
- None
Changes in v5:
- Document source of init-commands
- 4 lanes per DSI interface

Signed-off-by: Lin Huang <hl@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180702102721.3546-5-heiko@sntech.de
6 years agodt-bindings: Add Innolux P097PFG panel bindings
Lin Huang [Mon, 2 Jul 2018 10:27:20 +0000 (12:27 +0200)]
dt-bindings: Add Innolux P097PFG panel bindings

The Innolux P097PFG panel is 9.7" panel with 1536X2048
resolution, it reuse P079ZCA panel driver, so improve
p079ZCA dt-binding to support P097PFG.

Changes in v2:
- None
Changes in v3:
- None
Changes in v4:
- None
Changes in v5:
- use separate file for binding
- keep power supplies as required

Signed-off-by: Lin Huang <hl@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180702102721.3546-4-heiko@sntech.de
6 years agodrm/panel: p079zca: Add variable unprepare_delay properties
Lin Huang [Mon, 2 Jul 2018 10:27:19 +0000 (12:27 +0200)]
drm/panel: p079zca: Add variable unprepare_delay properties

When panel power down, p079zca need delay between reset and disable
power supply, but p097pfg does not need it. Similarly p097zca needs
a delay after entering panel sleep mode. So add two delay properties,
so we can meet these two panel power down sequence.

Signed-off-by: Lin Huang <hl@rock-chips.com>
[add sleep-mode delay]
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180702102721.3546-3-heiko@sntech.de
6 years agodrm/panel: p079zca: Refactor panel driver to support multiple panels
Lin Huang [Mon, 2 Jul 2018 10:27:18 +0000 (12:27 +0200)]
drm/panel: p079zca: Refactor panel driver to support multiple panels

Refactor Innolux P079ZCA panel driver, let it support multi panels from
Innolux that share similar power sequences.

Panels may require different power supplies so use regulator bulk
interfaces and define per panel supply-names.

Changes in v2:
- Change regulator property name to meet the panel datasheet
Changes in v3:
- this patch only refactor P079ZCA panel to support multi panel,
  support P097PFG panel in another patch
Changes in v4:
- Modify the patch which suggest by Thierry
Changes in v5:
- use regulator_bulk to handle different supply number

Signed-off-by: Lin Huang <hl@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180702102721.3546-2-heiko@sntech.de
6 years agodrm/panel: ili9881c: Fix missing assignment to error return ret
Colin Ian King [Tue, 26 Jun 2018 16:03:54 +0000 (17:03 +0100)]
drm/panel: ili9881c: Fix missing assignment to error return ret

Currently, ret is being checked for an error condition however it
is not being assigned in the previous statement on the call of
function mipi_dsi_dcs_exit_sleep_mode.  Add in the missing assignment
of ret.

Detected by CoverityScan, CID#14701741470178 ("Unchecked return value")

Fixes: 26aec25593c2 ("drm/panel: Add Ilitek ILI9881c panel driver")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180626160354.1363-1-colin.king@canonical.com
6 years agodrm/panel: simple: Add support for DataImage SCF0700C48GGU18
Michal Vokáč [Mon, 25 Jun 2018 12:41:30 +0000 (14:41 +0200)]
drm/panel: simple: Add support for DataImage SCF0700C48GGU18

This adds support for the DataImage SCF0700C48GGU18 7.0" WVGA (800x480)
TFT LCD panel. The panel has 24-bit parallel interface and can be
supported by the simple panel driver.

Signed-off-by: Michal Vokáč <michal.vokac@ysoft.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1529930490-11874-2-git-send-email-michal.vokac@ysoft.com
6 years agodt-bindings: Add DataImage, Inc. vendor prefix
Michal Vokáč [Mon, 25 Jun 2018 12:41:29 +0000 (14:41 +0200)]
dt-bindings: Add DataImage, Inc. vendor prefix

DataImage is a Taiwan-based manufacturer of LCD panels.

Signed-off-by: Michal Vokáč <michal.vokac@ysoft.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1529930490-11874-1-git-send-email-michal.vokac@ysoft.com
6 years agodrm/panel: simple: Add support for Innolux G070Y2-L01
Christoph Fritz [Mon, 4 Jun 2018 11:16:48 +0000 (13:16 +0200)]
drm/panel: simple: Add support for Innolux G070Y2-L01

This patch adds support for Innolux G070Y2-L01 7" WVGA (800x480) TFT LCD
panel.

Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1528111008.2818.20.camel@googlemail.com
6 years agodrm/panel: simple: Add newhaven, nhd-4.3-480272ef-atxl LCD
Tomi Valkeinen [Mon, 18 Jun 2018 13:22:40 +0000 (16:22 +0300)]
drm/panel: simple: Add newhaven, nhd-4.3-480272ef-atxl LCD

Add support for newhaven,nhd-4.3-480272ef-atxl to panel-simple.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180618132242.8673-8-tomi.valkeinen@ti.com
6 years agodrm: Add support for extracting sync signal drive edge from videomode
Peter Ujfalusi [Mon, 18 Jun 2018 13:22:34 +0000 (16:22 +0300)]
drm: Add support for extracting sync signal drive edge from videomode

The sync in some panels needs to be driven by different edge of the pixel
clock compared to data. This is reflected by the
DISPLAY_FLAGS_SYNC_(POS|NEG)EDGE in videmode flags.
Add similar similar definitions for bus_flags and convert the sync drive
edge via drm_bus_flags_from_videomode().

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180618132242.8673-2-tomi.valkeinen@ti.com
6 years agodrm/panel: simple: Add support for BOE HV070WSA-100 panel to simple-panel
Andrzej Hajda [Tue, 19 Jun 2018 08:19:26 +0000 (10:19 +0200)]
drm/panel: simple: Add support for BOE HV070WSA-100 panel to simple-panel

The patch adds support for BOE HV070WSA-100 WSVGA 7.01 inch panel to the
panel-simple driver. The panel is used in Exynos5250-arndale boards.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Maciej Purski <m.purski@samsung.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1529396370-18761-6-git-send-email-m.purski@samsung.com
6 years agodt-bindings: display: Add DT bindings for BOE HV070WSA-100 panel
Andrzej Hajda [Tue, 19 Jun 2018 08:19:25 +0000 (10:19 +0200)]
dt-bindings: display: Add DT bindings for BOE HV070WSA-100 panel

The patch adds bindings to BOE HV070-WSA WSVGA panel. Bindings are
compatible with simple panel bindings.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Maciej Purski <m.purski@samsung.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1529396370-18761-5-git-send-email-m.purski@samsung.com
6 years agodrm/vc4: Support the case where the DSI device is disabled
Boris Brezillon [Wed, 9 May 2018 13:00:42 +0000 (15:00 +0200)]
drm/vc4: Support the case where the DSI device is disabled

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
6 years agodrm/of: Make drm_of_find_panel_or_bridge() fail when the device is disabled
Boris Brezillon [Wed, 9 May 2018 13:00:41 +0000 (15:00 +0200)]
drm/of: Make drm_of_find_panel_or_bridge() fail when the device is disabled

There's no point searching for a drm_bridge or drm_panel if the OF node
we're pointing has a status property that is not "okay" or "ok". Just
return -ENODEV in this case.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180509130042.9435-4-boris.brezillon@bootlin.com
6 years agodrm/panel: Let of_drm_find_panel() return -ENODEV when the panel is disabled
Boris Brezillon [Wed, 9 May 2018 13:00:40 +0000 (15:00 +0200)]
drm/panel: Let of_drm_find_panel() return -ENODEV when the panel is disabled

DT nodes might be present in the DT but with a status property set to
"disabled" or "fail". In this case, we should not return -EPROBE_DEFER
when the caller asks for a drm_panel instance. Return -ENODEV instead.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180509130042.9435-3-boris.brezillon@bootlin.com
6 years agodrm/panel: Make of_drm_find_panel() return an ERR_PTR() instead of NULL
Boris Brezillon [Wed, 9 May 2018 13:00:39 +0000 (15:00 +0200)]
drm/panel: Make of_drm_find_panel() return an ERR_PTR() instead of NULL

Right now, the DRM panel logic returns NULL when a panel pointing to
the passed OF node is not present in the list of registered panels.

Most drivers interpret this NULL value as -EPROBE_DEFER, but we are
about to modify the semantic of of_drm_find_panel() and let the
framework return -ENODEV when the device node we're pointing to has
a status property that is not equal to "okay" or "ok".

Let's first patch the of_drm_find_panel() implementation to return
ERR_PTR(-EPROBE_DEFER) instead of NULL and patch all callers to replace
the '!panel' check by an 'IS_ERR(panel)' one.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180509130042.9435-2-boris.brezillon@bootlin.com
6 years agodrm/panel: simple: Add DLC DLC0700YZG-1 panel
Philipp Zabel [Wed, 23 May 2018 09:25:04 +0000 (11:25 +0200)]
drm/panel: simple: Add DLC DLC0700YZG-1 panel

This patch adds support for DLC DLC0700YZG-1 1024x600 LVDS panels
to the simple-panel driver.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
[m.felsch@pengutronix.de: fix typo in compatible dt-binding]
[m.felsch@pengutronix.de: add property bindings]
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180523092504.5142-3-m.felsch@pengutronix.de
6 years agodt-bindings: Add vendor prefix for DLC Display Co., Ltd.
Philipp Zabel [Wed, 23 May 2018 09:25:03 +0000 (11:25 +0200)]
dt-bindings: Add vendor prefix for DLC Display Co., Ltd.

DLC provides a wide range of display solutions.
Website: http://www.dlcdisplay.com/

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180523092504.5142-2-m.felsch@pengutronix.de
6 years agodrm/panel: Add support for the EDT ETM0700G0EDH6
Jan Tuerk [Tue, 19 Jun 2018 09:55:45 +0000 (11:55 +0200)]
drm/panel: Add support for the EDT ETM0700G0EDH6

The Emerging Display Technology ETM0700G0EDH6 is the
uses the same panel as the ETM0700G0BDH6. It differs
in the hardware design for the backlight and the
touchscreen i2c interface. As the new display type has
different requirements for drive-strengths on the i2c-bus,
add an additional compatible to allow the handling of it or warn
about incompatible cpu and display combinations.

Signed-off-by: Jan Tuerk <jan.tuerk@emtrion.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180619095546.24445-3-jan.tuerk@emtrion.com
6 years agodrm/panel: Add support for the EDT ETM0700G0BDH6
Jan Tuerk [Tue, 19 Jun 2018 09:55:44 +0000 (11:55 +0200)]
drm/panel: Add support for the EDT ETM0700G0BDH6

The Emerging Display Technology ETM0700G0BDH6 is exactly
the same display as the ETM0700G0DH6, exept the pixelclock
polarity. Therefore re-use the ETM0700G0DH6 modes. It is
used by default on emtrion Avari based development kits.

Signed-off-by: Jan Tuerk <jan.tuerk@emtrion.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180619095546.24445-2-jan.tuerk@emtrion.com
6 years agodt-bindings: display: Document the EDT et* displays in one file.
Jan Tuerk [Tue, 19 Jun 2018 09:55:43 +0000 (11:55 +0200)]
dt-bindings: display: Document the EDT et* displays in one file.

Document the Emerging Display Technology Corp. (EDT) using the
simple-panel binding in one single file.

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jan Tuerk <jan.tuerk@emtrion.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180619095546.24445-1-jan.tuerk@emtrion.com
6 years agodrm/panel: simple: Add support for Rocktech RK070ER9427 LCD panel
Jagan Teki [Thu, 7 Jun 2018 13:46:48 +0000 (19:16 +0530)]
drm/panel: simple: Add support for Rocktech RK070ER9427 LCD panel

This adds support for the Rocktech Display Ltd. RK070ER9427
800(RGB)x480 TFT LCD panel, which can be supported by the
simple panel driver.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180607134648.2902-1-jagan@amarulasolutions.com
6 years agodrm/cma-helper: Remove drm_fb_cma_fbdev_init_with_funcs()
Noralf Trønnes [Tue, 3 Jul 2018 16:03:54 +0000 (18:03 +0200)]
drm/cma-helper: Remove drm_fb_cma_fbdev_init_with_funcs()

Remove drm_fb_cma_fbdev_init_with_funcs(), its only user tinydrm has
moved to drm_fbdev_generic_setup().

Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: David Lechner <david@lechnology.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180703160354.59955-9-noralf@tronnes.org
6 years agodrm/tinydrm: Use drm_fbdev_generic_setup()
Noralf Trønnes [Tue, 3 Jul 2018 16:03:53 +0000 (18:03 +0200)]
drm/tinydrm: Use drm_fbdev_generic_setup()

Make full use of the generic fbdev client.

Cc: David Lechner <david@lechnology.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: David Lechner <david@lechnology.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180703160354.59955-8-noralf@tronnes.org
6 years agodrm/fb-helper: Finish the generic fbdev emulation
Noralf Trønnes [Tue, 3 Jul 2018 16:03:52 +0000 (18:03 +0200)]
drm/fb-helper: Finish the generic fbdev emulation

This adds a drm_fbdev_generic_setup() function that sets up generic
fbdev emulation with client callbacks for restore, hotplug and
unregister.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180703160354.59955-7-noralf@tronnes.org
6 years agodrm/debugfs: Add internal client debugfs file
Noralf Trønnes [Tue, 3 Jul 2018 16:03:51 +0000 (18:03 +0200)]
drm/debugfs: Add internal client debugfs file

Print the names of the internal clients currently attached.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180703160354.59955-6-noralf@tronnes.org
6 years agodrm/cma-helper: Use the generic fbdev emulation
Noralf Trønnes [Tue, 3 Jul 2018 16:03:50 +0000 (18:03 +0200)]
drm/cma-helper: Use the generic fbdev emulation

This switches the CMA helper drivers that use its fbdev emulation over
to the generic fbdev emulation. It's the first phase of using generic
fbdev. A later phase will use DRM client callbacks for the
lastclose/hotplug/remove callbacks.

There are currently 2 fbdev init/fini functions:
- drm_fb_cma_fbdev_init/drm_fb_cma_fbdev_fini
- drm_fbdev_cma_init/drm_fbdev_cma_fini

This is because the work on generic fbdev came up during a fbdev
refactoring and thus wasn't completed. No point in completing that
refactoring when drivers will soon move to drm_fb_helper_generic_probe().

tinydrm uses drm_fb_cma_fbdev_init_with_funcs().

Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180703160354.59955-5-noralf@tronnes.org
6 years agodrm/pl111: Set .gem_prime_vmap and .gem_prime_mmap
Noralf Trønnes [Tue, 3 Jul 2018 16:03:49 +0000 (18:03 +0200)]
drm/pl111: Set .gem_prime_vmap and .gem_prime_mmap

These are needed for pl111 to use the generic fbdev emulation.

Cc: Eric Anholt <eric@anholt.net>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20180703160354.59955-4-noralf@tronnes.org
6 years agodrm/fb-helper: Add generic fbdev emulation .fb_probe function
Noralf Trønnes [Tue, 3 Jul 2018 16:03:48 +0000 (18:03 +0200)]
drm/fb-helper: Add generic fbdev emulation .fb_probe function

This is the first step in getting generic fbdev emulation.
A drm_fb_helper_funcs.fb_probe function is added which uses the
DRM client API to get a framebuffer backed by a dumb buffer.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180703160354.59955-3-noralf@tronnes.org
6 years agodrm: Begin an API for in-kernel clients
Noralf Trønnes [Tue, 3 Jul 2018 16:03:47 +0000 (18:03 +0200)]
drm: Begin an API for in-kernel clients

This the beginning of an API for in-kernel clients.
First out is a way to get a framebuffer backed by a dumb buffer.

Only GEM drivers are supported.
The original idea of using an exported dma-buf was dropped because it
also creates an anonomous file descriptor which doesn't work when the
buffer is created from a kernel thread. The easy way out is to use
drm_driver.gem_prime_vmap to get the virtual address, which requires a
GEM object. This excludes the vmwgfx driver which is the only non-GEM
driver apart from the legacy ones. A solution for vmwgfx will have to be
worked out later if it wants to support the client API which it probably
will when we have a bootsplash client.

Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180703160354.59955-2-noralf@tronnes.org
6 years agodrm: vkms: select DRM_KMS_HELPER
Arnd Bergmann [Mon, 9 Jul 2018 15:48:18 +0000 (17:48 +0200)]
drm: vkms: select DRM_KMS_HELPER

Without this, we get link errors during randconfig build:

drivers/gpu/drm/vkms/vkms_drv.o:(.rodata+0xa0): undefined reference to `drm_atomic_helper_check'
drivers/gpu/drm/vkms/vkms_drv.o:(.rodata+0xa8): undefined reference to `drm_atomic_helper_commit'
drivers/gpu/drm/vkms/vkms_plane.o:(.rodata+0x0): undefined reference to `drm_atomic_helper_update_plane'
drivers/gpu/drm/vkms/vkms_plane.o:(.rodata+0x8): undefined reference to `drm_atomic_helper_disable_plane'
drivers/gpu/drm/vkms/vkms_plane.o:(.rodata+0x18): undefined reference to `drm_atomic_helper_plane_reset'
drivers/gpu/drm/vkms/vkms_plane.o:(.rodata+0x28): undefined reference to `drm_atomic_helper_plane_duplicate_state'
drivers/gpu/drm/vkms/vkms_plane.o:(.rodata+0x30): undefined reference to `drm_atomic_helper_plane_destroy_state'
drivers/gpu/drm/vkms/vkms_output.o:(.rodata+0x1c0): undefined reference to `drm_helper_probe_single_connector_modes'
drivers/gpu/drm/vkms/vkms_crtc.o:(.rodata+0x40): undefined reference to `drm_atomic_helper_crtc_reset'
drivers/gpu/drm/vkms/vkms_crtc.o:(.rodata+0x70): undefined reference to `drm_atomic_helper_set_config'
drivers/gpu/drm/vkms/vkms_crtc.o:(.rodata+0x78): undefined reference to `drm_atomic_helper_page_flip'
drivers/gpu/drm/vkms/vkms_crtc.o:(.rodata+0x90): undefined reference to `drm_atomic_helper_crtc_duplicate_state'
drivers/gpu/drm/vkms/vkms_crtc.o:(.rodata+0x98): undefined reference to `drm_atomic_helper_crtc_destroy_state'

Fixes: 854502fa0a38 ("drm/vkms: Add basic CRTC initialization")
Fixes: 1c7c5fd916a0 ("drm/vkms: Introduce basic VKMS driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180709154901.1989316-1-arnd@arndb.de
6 years agodrm/vc4: Add support for the transposer block
Boris Brezillon [Tue, 3 Jul 2018 07:50:22 +0000 (09:50 +0200)]
drm/vc4: Add support for the transposer block

The transposer block is providing support for mem-to-mem composition,
which is exposed as a drm_writeback connector in DRM.

Add a driver to support this feature.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20180703075022.15138-9-boris.brezillon@bootlin.com
6 years agodrm/vc4: Call drm_atomic_helper_fake_vblank() in the commit path
Boris Brezillon [Tue, 3 Jul 2018 07:50:21 +0000 (09:50 +0200)]
drm/vc4: Call drm_atomic_helper_fake_vblank() in the commit path

Mimic what is done in drm_atomic_commit_tail() and call
drm_atomic_helper_fake_vblank() so that VBLANK events are faked
when the drm_crtc_state.no_vblank is true. Will be needed when we'll
add support for the transposer block.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20180703075022.15138-8-boris.brezillon@bootlin.com
6 years agodrm/atomic: Call fake_vblank() from the generic commit_tail() helpers
Boris Brezillon [Tue, 3 Jul 2018 07:50:20 +0000 (09:50 +0200)]
drm/atomic: Call fake_vblank() from the generic commit_tail() helpers

Now that we have a way to fake VBLANK events when requested by the CRTC
hook it up to the generic commit_tail() helpers.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180703075022.15138-7-boris.brezillon@bootlin.com
6 years agodrm/crtc: Add a generic infrastructure to fake VBLANK events
Boris Brezillon [Tue, 3 Jul 2018 07:50:19 +0000 (09:50 +0200)]
drm/crtc: Add a generic infrastructure to fake VBLANK events

In some cases CRTCs are active but are not able to generating events, at
least not at every frame at it's expected to.
This is typically the case when the CRTC is feeding a writeback connector
that has no job queued. In this situation the CRTC is usually stopped
until a new job is queued, and this can lead to timeouts when part of
the pipeline is updated but no new jobs are queued to the active
writeback connector.

In order to solve that, we add a ->no_vblank flag to drm_crtc_state
and ask the CRTC drivers to set it to true when they know they're not
able to generate VBLANK events. The core drm_atomic_helper_fake_vblank()
helper can then be used to fake VBLANKs at commit time.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180703075022.15138-6-boris.brezillon@bootlin.com
6 years agodrm/vc4: Use wait_for_flip_done() instead of wait_for_vblanks()
Boris Brezillon [Tue, 3 Jul 2018 07:50:18 +0000 (09:50 +0200)]
drm/vc4: Use wait_for_flip_done() instead of wait_for_vblanks()

drm_atomic_helper_wait_for_vblanks() assumes the CRTC will continuously
generate VBLANK events and the vblank counter will keep increasing.
While this work for a regular pipeline, it doesn't when you have the
CRTC is feeding the transposer block, because this block works in
oneshot mode, and, by the time we reach
drm_atomic_helper_wait_for_vblanks() the only VBLANK event might have
already been sent and the VBLANK counter will stay unchanged, thus
triggering a timeout.

Luckily, we can replace the drm_atomic_helper_wait_for_vblanks() call
by drm_atomic_helper_wait_for_flip_done() because the only thing we
want to check when calling drm_atomic_helper_wait_for_vblanks() from
vc4_atomic_complete_commit() is that new FBs are in use and the old
ones can be safely released.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20180703075022.15138-5-boris.brezillon@bootlin.com
6 years agodrm/connector: Make ->atomic_commit() optional
Boris Brezillon [Tue, 3 Jul 2018 07:50:17 +0000 (09:50 +0200)]
drm/connector: Make ->atomic_commit() optional

Not all writeback connector implementations might want to commit things
from the connector driver. Some, like the malidp driver, commit things
from their main commit_tail() function, and would rather not have to
implement a dummy hook for drm_connector_helper_funcs.atomic_commit().

Make this function optional and reflect this fact in the doc.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Acked-by: Liviu Dudau <liviu.dudau@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180703075022.15138-4-boris.brezillon@bootlin.com
6 years agodrm/connector: Pass a drm_connector_state to ->atomic_commit()
Boris Brezillon [Tue, 3 Jul 2018 07:50:16 +0000 (09:50 +0200)]
drm/connector: Pass a drm_connector_state to ->atomic_commit()

Other atomic hooks are passed state objects, let's change this one to
be consistent.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Acked-by: Liviu Dudau <liviu.dudau@arm.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180703075022.15138-3-boris.brezillon@bootlin.com
6 years agodrm/atomic: Avoid connector to writeback_connector casts
Boris Brezillon [Tue, 3 Jul 2018 07:50:15 +0000 (09:50 +0200)]
drm/atomic: Avoid connector to writeback_connector casts

Use container_of() instead of type casting so that it keeps working
even if base is moved inside the drm_writeback_connector struct.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20180703075022.15138-2-boris.brezillon@bootlin.com