firefly-linux-kernel-4.4.55.git
9 years agodrm: rcar-du: Disable all planes when stopping the CRTC
Laurent Pinchart [Thu, 14 May 2015 12:01:47 +0000 (15:01 +0300)]
drm: rcar-du: Disable all planes when stopping the CRTC

The DSnPR plane configuration registers are updated on vblank, and no
vblank will occur once the CRTC is stopped. We thus can't only disable
planes right before starting the CRTC as it would start scanning out
immediately from old frame buffers until the next vblank.

Fix the problem by disabling all planes when stopping the CRTC and wait
for the change to take effect. This increases the CRTC stop delay,
especially when multiple CRTCs are stopped in one operation as we now
wait for one vblank per CRTC. Whether this can be improved needs to be
researched.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
9 years agodrm: rcar-du: Print the error value when DRM/KMS init fails
Laurent Pinchart [Wed, 13 May 2015 22:08:34 +0000 (01:08 +0300)]
drm: rcar-du: Print the error value when DRM/KMS init fails

This helps debugging probe failures.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
9 years agoMerge tag 'omapdrm-4.2-atomic' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba...
Dave Airlie [Tue, 16 Jun 2015 01:16:02 +0000 (11:16 +1000)]
Merge tag 'omapdrm-4.2-atomic' of git://git./linux/kernel/git/tomba/linux into drm-next

omapdrm atomic modesetting support

Atomic modesetting support for omapdrm.

" we've had issues with omapdrm for years,
which we've not been able to fix properly (like warnings/crashes when unloading
modules, page-flips tearing, race issues with fbs). All those problems seem to
be gone after this rewrite of omapdrm for atomic modesetting, and the resulting
code is much cleaner and more maintainable."

* tag 'omapdrm-4.2-atomic' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux: (43 commits)
  drm: omapdrm: new vblank and event handling
  drm: omapdrm: merge omap_crtc_flush and omap_crtc_atomic_flush
  drm: omapdrm: add lock for fb pinning
  drm: omapdrm: if omap_plane_atomic_update fails, disable plane
  drm: omapdrm: inline omap_plane_setup into update/disable
  drm: omapdrm: omap_plane_setup() cannot fail, use WARN
  drm: omapdrm: Don't setup planes manually from CRTC .enable()/.disable()
  drm: omapdrm: Don't flush CRTC when enabling or disabling it
  drm: omapdrm: Move encoder setup to encoder operations
  drm: omapdrm: Simplify DSS power management
  drm: omapdrm: Remove nested PM get/sync when configuring encoders
  drm: omapdrm: Support unlinking page flip events prematurely
  drm: omapdrm: omap_crtc_flush() isn't called with modeset locked
  drm: omapdrm: Don't get/put dispc in omap_crtc_flush()
  drm: omapdrm: Make the omap_crtc_flush function static
  drm: omapdrm: Remove omap_plane enabled field
  drm: omapdrm: Remove omap_crtc enabled field
  drm: omapdrm: Move crtc info out of the crtc structure
  drm: omapdrm: Move plane info and win out of the plane structure
  drm: omapdrm: Switch crtc and plane set_property to atomic helpers
  ...

9 years agodrm: omapdrm: new vblank and event handling
Tomi Valkeinen [Fri, 29 May 2015 13:01:18 +0000 (16:01 +0300)]
drm: omapdrm: new vblank and event handling

Rework the crtc event/flip_wait system as follows:

- If we enable a crtc (full modeset), we set omap_crtc->pending and
  register vblank irq.

- If we need to set GO bit (page flip), we do the same but also set the
  GO bit.

- On vblank we unregister the irq, clear the 'pending' flag, send vblank
  event to userspace if crtc->state->event != NULL, and wake up
  'pending_wait' wq.

- In omap_atomic_complete() we wait for the 'pending' flag to get reset
  for all enabled crtcs  using 'pending_wait' wq.

The above ensures that we send the events to userspace in vblank, and
that after the wait in omap_atomic_complete() everything for the
affected crtcs has been completed.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
9 years agodrm: omapdrm: merge omap_crtc_flush and omap_crtc_atomic_flush
Tomi Valkeinen [Mon, 8 Jun 2015 10:08:25 +0000 (13:08 +0300)]
drm: omapdrm: merge omap_crtc_flush and omap_crtc_atomic_flush

omap_crtc_atomic_flush() is the only user of omap_crtc_flush(), so just
move the code from omap_crtc_flush() to omap_crtc_atomic_flush().

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
9 years agodrm: omapdrm: add lock for fb pinning
Tomi Valkeinen [Thu, 4 Jun 2015 07:56:33 +0000 (10:56 +0300)]
drm: omapdrm: add lock for fb pinning

Before atomic modesetting omap_framebuffer_pin() and
omap_framebuffer_unpin() were always called with modesetting locks
taken. With atomic modesetting support this is no longer the case, and
we need locking to protect the pin_count and the paddr, as multiple
threads may pin the same fb concurrently.

This patch adds a mutex to struct omap_framebuffer, and uses it in
omap_framebuffer_pin() and omap_framebuffer_unpin().

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
9 years agodrm: omapdrm: if omap_plane_atomic_update fails, disable plane
Tomi Valkeinen [Fri, 29 May 2015 08:06:07 +0000 (11:06 +0300)]
drm: omapdrm: if omap_plane_atomic_update fails, disable plane

omap_plane_atomic_update() calls dispc_ovl_setup(), which can fail (but
shouldn't). To make the code a bit more robust, make sure the plane gets
disabled if dispc_ovl_setup() fails, as otherwise we might get illegal
HW configuration leading to error interrupts.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
9 years agodrm: omapdrm: inline omap_plane_setup into update/disable
Tomi Valkeinen [Fri, 29 May 2015 08:05:37 +0000 (11:05 +0300)]
drm: omapdrm: inline omap_plane_setup into update/disable

At the moment we have omap_plane_setup() function which handles both
enabling (and configuring) and disabling the plane. With atomic
modesetting we have separate hooks for plane enable/config and disable.

This patch moves the code from omap_plane_setup() to
omap_plane_atomic_update() and omap_plane_atomic_disable().

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
9 years agodrm: omapdrm: omap_plane_setup() cannot fail, use WARN
Tomi Valkeinen [Fri, 29 May 2015 08:03:15 +0000 (11:03 +0300)]
drm: omapdrm: omap_plane_setup() cannot fail, use WARN

With atomic modesetting, omap_plane_setup()'s return value is ignored as
the functions using it cannot fail. dispc_ovl_setup(), called by
omap_plane_setup(), can fail (but shouldn't).

Instead of returning an error from omap_plane_setup() which gets
ignored, return void and use WARN if dispc_ovl_setup() fails.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
9 years agodrm: omapdrm: Don't setup planes manually from CRTC .enable()/.disable()
Laurent Pinchart [Wed, 27 May 2015 17:53:57 +0000 (20:53 +0300)]
drm: omapdrm: Don't setup planes manually from CRTC .enable()/.disable()

Planes setup is handled by the DRM core through the atomic helpers,
there's no need to duplicate the code in the CRTC .enable() and
.disable() operations.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Don't flush CRTC when enabling or disabling it
Laurent Pinchart [Wed, 27 May 2015 23:39:35 +0000 (02:39 +0300)]
drm: omapdrm: Don't flush CRTC when enabling or disabling it

The omap_crtc_flush() call in omap_crtc_enable() and omap_crtc_disable()
is a no-op, as the display manager is always disabled at this point. Just
remove the function call.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Move encoder setup to encoder operations
Laurent Pinchart [Wed, 27 May 2015 23:34:05 +0000 (02:34 +0300)]
drm: omapdrm: Move encoder setup to encoder operations

Now that the driver is fully converted to atomic operations, and that
the atomic helpers call the operations in the right order, we can move
encoder setup to where it belongs, in the encoder operations.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Simplify DSS power management
Laurent Pinchart [Wed, 27 May 2015 23:09:56 +0000 (02:09 +0300)]
drm: omapdrm: Simplify DSS power management

Instead of sprinkling dispc_runtime_get() and dispc_runtime_put() calls
in various CRTC operations, move all power management code to the atomic
commit function.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Remove nested PM get/sync when configuring encoders
Laurent Pinchart [Wed, 27 May 2015 22:58:02 +0000 (01:58 +0300)]
drm: omapdrm: Remove nested PM get/sync when configuring encoders

The omap_crtc_encoder_setup() function is always called with the DSS
enabled. Remove the dispc_runtime_get() and dispc_runtime_put() calls.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Support unlinking page flip events prematurely
Laurent Pinchart [Thu, 16 Apr 2015 19:35:20 +0000 (22:35 +0300)]
drm: omapdrm: Support unlinking page flip events prematurely

DRM page flip vblank events requested by page flips or atomic commits
are created by the DRM core and then passed to driver through CRTC
states (for atomic commit) or directly to the page flip handler (for
legacy page flips). The events are then kept aside until the page flip
completes, at which point drivers queue them for delivery with a call to
drm_send_vblank_event().

When a DRM file handle is closed events pending for delivery are cleaned
up automatically by the DRM core. Events that have been passed to the
driver but haven't completed yet, however, are not handled by the DRM
core. Drivers are responsible for destroying them and must not attempt
to queue them for delivery. This is usually handled by drivers'
preclose() handlers that cancel and destroy page flip events that
reference the file handle being closed.

With asynchronous atomic updates the story becomes more complex. Several
asynchronous atomic updates can be pending, each of them carrying
per-CRTC events. As the atomic_commit() operation doesn't receive a file
handle context, drivers can't know which file handle a pending update
refers to, making it difficult to cancel or wait for completion of
updates related to the file handle being closed.

It should be noted that cancelling page flips or waiting for atomic
updates completion isn't required by the DRM core when closing a file
handle. The only requirement is that no event gets queued for delivery
after the preclose() operation returns. This can easily be achieved by
storing events for atomic commits in a list, unlinking events from the
file handle being closed by setting the file_priv field to NULL, and
skipping delivery of unlinked events.

This logic replaces the page flip cancellation completely.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: omap_crtc_flush() isn't called with modeset locked
Laurent Pinchart [Wed, 15 Apr 2015 19:47:45 +0000 (22:47 +0300)]
drm: omapdrm: omap_crtc_flush() isn't called with modeset locked

When performing asynchronous atomic updates the modeset lock isn't taken
around the callers of omap_crtc_flush(). This isn't an issue though, as
access to the CRTC is properly serialized. Just drop the warning.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Don't get/put dispc in omap_crtc_flush()
Laurent Pinchart [Wed, 15 Apr 2015 18:51:45 +0000 (21:51 +0300)]
drm: omapdrm: Don't get/put dispc in omap_crtc_flush()

The omap_crtc_flush() function is always called with a reference to the
dispc held. Remove unnecessary calls to dispc_runtime_get() and
dispc_runtime_put().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Make the omap_crtc_flush function static
Laurent Pinchart [Wed, 15 Apr 2015 18:47:34 +0000 (21:47 +0300)]
drm: omapdrm: Make the omap_crtc_flush function static

The function isn't used outside of its compilation unit, make it static.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Remove omap_plane enabled field
Laurent Pinchart [Fri, 6 Mar 2015 17:18:56 +0000 (19:18 +0200)]
drm: omapdrm: Remove omap_plane enabled field

The field tracks the plane state to avoid double-enable or -disable.
This isn't required anymore, as

- the DRM atomic core guarantees that the plane atomic_update and
  atomic_disable functions will never be called on an enabled/disabled
  plane

- the CRTC enable/disable operations that enable/disable the plane are
  already guarded against double enable/disable

We can thus remove the enabled field completely. The
omap_plane_set_enable() function then becomes a wrapper around
omap_plane_setup() which can be called directly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Remove omap_crtc enabled field
Laurent Pinchart [Wed, 15 Apr 2015 15:55:27 +0000 (18:55 +0300)]
drm: omapdrm: Remove omap_crtc enabled field

The field tracks the CRTC state to avoid double-enable or -disable. As
the DRM atomic core guarantees that the CRTC enable and disable
functions won't be called on an already enabled or disabled CRTC, such
tracking isn't needed. Remove the enabled field.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Move crtc info out of the crtc structure
Laurent Pinchart [Fri, 6 Mar 2015 17:00:18 +0000 (19:00 +0200)]
drm: omapdrm: Move crtc info out of the crtc structure

The crtc info structure is only used to setup the crtc through the DSS
API. Move it from the crtc structure to local variables in
omap_crtc_dss_enable().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Move plane info and win out of the plane structure
Laurent Pinchart [Fri, 6 Mar 2015 17:00:18 +0000 (19:00 +0200)]
drm: omapdrm: Move plane info and win out of the plane structure

The plane info and win structures are only used to setup the plane
through the DSS API. Move them from the plane structure to local
variables in omap_plane_setup().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Switch crtc and plane set_property to atomic helpers
Laurent Pinchart [Fri, 6 Mar 2015 16:35:16 +0000 (18:35 +0200)]
drm: omapdrm: Switch crtc and plane set_property to atomic helpers

Allow setting up plane properties atomically using the plane
set_property atomic helper. The properties are now stored in the plane
state (requiring subclassing it) and applied when updating the planes.

The CRTC exposes the properties of its primary plane for legacy reason.
We can't get rid of that API, so simply delegate it to the primary
plane.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Drop manual framebuffer pin handling
Laurent Pinchart [Thu, 5 Mar 2015 16:49:37 +0000 (18:49 +0200)]
drm: omapdrm: Drop manual framebuffer pin handling

Since the removal of omap_plane_mode_set(), framebuffers are now pinned
exclusively through the plane .prepare_fb() and .cleanup_fb() operations
as the remaining callers of omap_plane_setup() don't modify the
framebuffer. Remove the manual pin/unpin infrastructure.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Switch page flip to atomic helpers
Laurent Pinchart [Fri, 6 Mar 2015 14:01:53 +0000 (16:01 +0200)]
drm: omapdrm: Switch page flip to atomic helpers

The atomic page flip helper implements the page flip operation using
asynchronous commits.

As the legacy page flip was the last caller of omap_plane_mode_set(),
remove the function.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Implement asynchronous commit support
Laurent Pinchart [Thu, 5 Mar 2015 21:42:39 +0000 (23:42 +0200)]
drm: omapdrm: Implement asynchronous commit support

Implement a custom .atomic_commit() handler that supports asynchronous
commits using a work queue. This can be used for userspace-driven
asynchronous commits, as well as for an atomic page flip implementation.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Replace encoder mode_fixup with atomic_check
Laurent Pinchart [Thu, 5 Mar 2015 21:04:30 +0000 (23:04 +0200)]
drm: omapdrm: Replace encoder mode_fixup with atomic_check

The encoder .mode_fixup() operation is legacy, atomic updates uses the
new .atomic_check() operation. Convert the encoder driver.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Switch connector DPMS to atomic helpers
Laurent Pinchart [Thu, 5 Mar 2015 20:50:51 +0000 (22:50 +0200)]
drm: omapdrm: Switch connector DPMS to atomic helpers

The atomic connector DPMS helper implements the connector DPMS operation
using atomic commit, removing the need for DPMS helper operations on
CRTCs and encoders.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Switch mode config to atomic helpers
Laurent Pinchart [Thu, 5 Mar 2015 19:54:54 +0000 (21:54 +0200)]
drm: omapdrm: Switch mode config to atomic helpers

This removes the legacy mode config code. The CRTC and encoder prepare
and commit operations are not used anymore, remove them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Switch plane update to atomic helpers
Laurent Pinchart [Thu, 5 Mar 2015 19:50:00 +0000 (21:50 +0200)]
drm: omapdrm: Switch plane update to atomic helpers

This removes the legacy plane update code. Wire up the default atomic
check and atomic commit mode config helpers as needed by the plane
update atomic helpers.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Handle primary plane config through atomic plane ops
Laurent Pinchart [Thu, 5 Mar 2015 11:45:14 +0000 (13:45 +0200)]
drm: omapdrm: Handle primary plane config through atomic plane ops

Use the new CRTC atomic transitional helpers drm_helper_crtc_mode_set()
and drm_helper_crtc_mode_set_base() to implement the CRTC .mode_set and
.mode_set_base operations. This delegates primary plane configuration to
the plane .atomic_update and .atomic_disable operations, removing
duplicate code from the CRTC implementation.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Implement planes atomic operations
Laurent Pinchart [Thu, 5 Mar 2015 11:39:56 +0000 (13:39 +0200)]
drm: omapdrm: Implement planes atomic operations

Implement the CRTC .atomic_begin() and .atomic_flush() operations, the
plane .atomic_check(), .atomic_update() and operations, and use the
transitional atomic helpers to implement the plane update and disable
operations on top of the new atomic operations.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Wire up atomic state object scaffolding
Laurent Pinchart [Thu, 5 Mar 2015 19:38:16 +0000 (21:38 +0200)]
drm: omapdrm: Wire up atomic state object scaffolding

Hook up the default .reset(), .atomic_duplicate_state() and
.atomic_free_state() helpers to ensure that state objects are properly
created and destroyed, and call drm_mode_config_reset() at init time to
create the initial state objects.

Framebuffer reference count also gets maintained automatically by the
transitional helpers except for the legacy page flip operation. Maintain
it explicitly there.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Implement encoder .disable() and .enable() operations
Laurent Pinchart [Fri, 6 Mar 2015 22:22:39 +0000 (00:22 +0200)]
drm: omapdrm: Implement encoder .disable() and .enable() operations

The operations are required by the atomic helpers, implement them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Rework CRTC enable/disable for atomic updates
Laurent Pinchart [Thu, 5 Mar 2015 20:13:22 +0000 (22:13 +0200)]
drm: omapdrm: Rework CRTC enable/disable for atomic updates

When using atomic updates the CRTC .enable() and .disable() helper
operations are preferred over the (then legacy) .prepare() and .commit()
operations. Implement .enable() and rework .disable() to not depend on
DPMS, easing DPMS removal later on.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Rename CRTC DSS operations with an omap_crtc_dss_ prefix
Laurent Pinchart [Thu, 5 Mar 2015 20:01:02 +0000 (22:01 +0200)]
drm: omapdrm: Rename CRTC DSS operations with an omap_crtc_dss_ prefix

The omap_crtc_enable() and omap_crtc_disable() DSS operations functions
will clash with the new CRTC enable and disable helpers. Rename them to
omap_crtc_dss_*, as well as the other DSS operations for consistency.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Clean up #include's
Laurent Pinchart [Thu, 5 Mar 2015 19:31:37 +0000 (21:31 +0200)]
drm: omapdrm: Clean up #include's

Use the <...> include style instead of "..." for DRM headers and sort
the headers alphabetically to ease detection of duplicates.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Fix page flip race with CRTC disable
Laurent Pinchart [Wed, 4 Mar 2015 16:24:18 +0000 (18:24 +0200)]
drm: omapdrm: Fix page flip race with CRTC disable

We can't rely on crtc->primary->fb in the page flip worker, as a racing
CRTC disable (due for instance to an explicit framebuffer deletion from
userspace) would set that field to NULL before the worker gets a change
to run. Store the framebuffer queued for page flip in a new field of
omap_crtc instead, and hold a reference to it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Turn vblank on/off when enabling/disabling CRTC
Laurent Pinchart [Sun, 25 Jan 2015 20:42:30 +0000 (22:42 +0200)]
drm: omapdrm: Turn vblank on/off when enabling/disabling CRTC

The DRM core vblank handling mechanism requires drivers to forcefully
turn vblank reporting off when disabling the CRTC, and to restore the
vblank reporting status when enabling the CRTC.

Implement this using the drm_crtc_vblank_on/off helpers. When disabling
vblank we must first wait for page flips to complete, so implement page
flip completion wait as well.

Finally, drm_crtc_vblank_off() must be called at startup to synchronize
the state of the vblank core code with the hardware, which is initially
disabled. An interesting side effect is that the .disable_vblank()
operation will now be called for the first time with the CRTC disabled
and the DISPC runtime suspended. The dispc_runtime_get() call in
.disable_vblank() is supposed to take care of that, but the operation is
called with a spinlock held, which prevents it from sleeping.

To fix that move DISPC runtime PM handling out of the vblank operations
to the CRTC code, ensuring that the display controller will always be
powered when enabling or disabling vblank interrupts.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Rework page flip handling
Laurent Pinchart [Sun, 25 Jan 2015 20:42:30 +0000 (22:42 +0200)]
drm: omapdrm: Rework page flip handling

To implement proper vblank control the driver will need to wait for page
flip completion before disabling the vblank interrupt. This is made
complex by the page flip implementation which queues and submits page
flips to the hardware in two separate steps between which DRM locks are
released. We thus need to avoid waiting on a page flip that has been
queued but not submitted as submission and wait are covered by the same
lock.

Rework page flip handling as a first step by splitting the flip_pending
boolean variable into an enumerated state and moving between states
based on flip queue, submission and completion. The CANCELLED state will
be used in a second step.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Cancel pending page flips when closing device
Laurent Pinchart [Sun, 18 Jan 2015 14:57:36 +0000 (16:57 +0200)]
drm: omapdrm: Cancel pending page flips when closing device

Pending page flips must be cancelled when closing the device, otherwise
their completion at next vblank will result in nasty effects, including
possible oopses due to resources required to complete the page flip
being freed.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Simplify IRQ registration
Laurent Pinchart [Sun, 25 Jan 2015 20:06:45 +0000 (22:06 +0200)]
drm: omapdrm: Simplify IRQ registration

The omapdrm can't use drm_irq_install() and drm_irq_uninstall() as it
delegates IRQ handling to the omapdss driver. However, the code still
declares IRQ-related operations used by the DRM IRQ helpers, and calls
them indirectly.

Simplify the implementation by calling the functions directly or
inlining them. The irq_enabled checks can then also be simplified as
the call stacks guarantees that omap_drm_irq_install() and
omap_drm_irq_uninstall() will never run concurrently.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Rename omap_crtc page flip-related fields
Laurent Pinchart [Mon, 26 Jan 2015 00:58:51 +0000 (02:58 +0200)]
drm: omapdrm: Rename omap_crtc page flip-related fields

The old_fb field is only used to indicate whether a page flip is
pending. Turn it into a bool named flip_pending. Rename event and
page_flip_work to flip_event and flip_work for consistency.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Rename omap_crtc_page_flip_locked to omap_crtc_page_flip
Laurent Pinchart [Sun, 18 Jan 2015 14:36:19 +0000 (16:36 +0200)]
drm: omapdrm: Rename omap_crtc_page_flip_locked to omap_crtc_page_flip

The operation is called page_flip, rename its implementation
accordingly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Apply settings synchronously
Laurent Pinchart [Sat, 17 Jan 2015 17:09:26 +0000 (19:09 +0200)]
drm: omapdrm: Apply settings synchronously

The omapdrm driver implements a mechanism to apply new settings (due to
plane update, plane disable, plane property set, CRTC mode set or CRTC
DPMS) asynchronously. While this improves performance, it adds a level
of complexity that makes transition to the atomic update API close to
impossible. Furthermore the atomic update API requires part of the apply
operations to be synchronous (such as pinning the framebuffers), so the
current implementation needs to be changed.

Simplify the CRTC and plane code by making updates synchronous to
prepare for the switch to the atomic update API. Asynchronous update
will be implemented in a second step.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Store the rotation property in dev->mode_config
Laurent Pinchart [Fri, 6 Mar 2015 15:16:43 +0000 (17:16 +0200)]
drm: omapdrm: Store the rotation property in dev->mode_config

Rotation is a standard property, store it in
dev->mode_config.rotation_property. While at it, extract the properties
initialization code to a separate function instead of running it for
every plane.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agoMerge branch 'msm-next' of git://people.freedesktop.org/~robclark/linux into drm...
Dave Airlie [Fri, 12 Jun 2015 00:17:55 +0000 (10:17 +1000)]
Merge branch 'msm-next' of git://people.freedesktop.org/~robclark/linux into drm-next

Main pull req for 4.2.. I think there will be a secondary pull-req..
I'd like to land the hdcp support patches, since all the review
comments have been long since addressed, and they have been ready to
merge for a couple release cycles now other than the scm dependency
(which should be coming in through arm-soc tree for 4.2). So I am not
including them in this initial pull req to avoid merge ordering
issues.

Main highlights:

1) adreno a306 support (for apq8x16 and upcoming dragonboard 410c)
2) various dsi bits
3) various 64bit fixes (mostly warnings)
4) NV12MT support, pulled in via msm-next rather than drm-misc since
dependency on on regenerated envytools headers (but lgtm'd-by danvet)
5) random fixes and cleanups

* 'msm-next' of git://people.freedesktop.org/~robclark/linux: (36 commits)
  drm/msm: restart queued submits after hang
  drm/msm: fix timeout calculation
  drm/msm/hdmi: Use pinctrl in HDMI driver
  drm/msm/hdmi: Point to the right struct device
  drm/msm/mdp: Add support for more 32-bit RGB formats
  drm/msm: use __s32, __s64, __u32 and __u64 from linux/types.h for uabi
  drm/msm/atomic: Clean up planes in the error paths of .atomic_commit()
  drm/msm/mdp5: Always generate active-high sync signals for DSI
  drm/msm: dsi: fix compile errors when CONFIG_GPIOLIB=n
  drm/msm: use devm_gpiod_get_optional for optional reset gpio
  drm/msm/dsi: Separate PHY to another platform device
  drm/msm/dsi: Enable PLL driver in MSM DSI
  drm/msm/dsi: Add DSI PLL clock driver support
  drm/msm: use IS_ERR() to check regulator_get() return
  drm/msm: use IS_ERR() to check msm_ioremap() return
  drm/msm/mdp5: Wait for PP_DONE irq for command mode CRTC atomic commit
  drm/msm: Use customized function to wait for atomic commit done
  dt-bindings: Add MSM eDP controller documentation
  dt-bindings: Add MSM DSI controller documentation
  drm/msm: drop redundant debug output
  ...

9 years agoMerge tag 'drm-intel-next-fixes-2015-06-11' of git://anongit.freedesktop.org/drm...
Dave Airlie [Fri, 12 Jun 2015 00:16:36 +0000 (10:16 +1000)]
Merge tag 'drm-intel-next-fixes-2015-06-11' of git://anongit.freedesktop.org/drm-intel into drm-next

firmware name fix

* tag 'drm-intel-next-fixes-2015-06-11' of git://anongit.freedesktop.org/drm-intel:
  drm/i915/skl: Fix DMC API version in firmware file name

9 years agoMerge tag 'drm-amdkfd-next-fixes-2015-06-10' of git://people.freedesktop.org/~gabbayo...
Dave Airlie [Fri, 12 Jun 2015 00:14:20 +0000 (10:14 +1000)]
Merge tag 'drm-amdkfd-next-fixes-2015-06-10' of git://people.freedesktop.org/~gabbayo/linux into drm-next

- Make the reset wavefronts action be per process per device instead of
  per process, because one device can be stuck but the other one won't be

- Add some missing properties to the CZ device_info structure

- Rename symbols to not have CONFIG_ prefix

- Some more cleanups and debug prints

* tag 'drm-amdkfd-next-fixes-2015-06-10' of git://people.freedesktop.org/~gabbayo/linux:
  drm/amdkfd: remove not used defines from cik_regs.h
  drm/amdkfd: Add missing properties to CZ device info
  drm/amdkfd: make reset wavefronts per process per device
  drm/amdkfd: add debug print to kfd_events.c
  drm/amdkfd: avoid CONFIG_ prefix for non-Kconfig symbols

9 years agoMerge branch '2015-06-08-st-drm-next' of http://git.linaro.org/people/benjamin.gaigna...
Dave Airlie [Fri, 12 Jun 2015 00:14:00 +0000 (10:14 +1000)]
Merge branch '2015-06-08-st-drm-next' of git.linaro.org/people/benjamin.gaignard/kernel into drm-next

Mainly it is fixing timing on HDMI to be compliant with CEA-861E spec.

* '2015-06-08-st-drm-next' of http://git.linaro.org/people/benjamin.gaignard/kernel:
  drm/sti: vtg fix CEA-861E video format timing error
  drm/sti: hdmi fix CEA-861E video format timing error
  drm/sti: VTG interrupt names are badly displayed
  drm/sti: missing first pixel column on HDMI display
  drm/sti: correctly test devm_ioremap() return

9 years agodrm/msm: restart queued submits after hang
Rob Clark [Sun, 7 Jun 2015 17:46:04 +0000 (13:46 -0400)]
drm/msm: restart queued submits after hang

Track the list of in-flight submits.  If the gpu hangs, retire up to an
including the offending submit, and then re-submit the remainder.  This
way, for concurrently running piglit tests (for example), one failing
test doesn't cause unrelated tests to fail simply because it's submit
was queued up after one that triggered a hang.

Signed-off-by: Rob Clark <robdclark@gmail.com>
9 years agodrm/msm: fix timeout calculation
Rob Clark [Mon, 11 May 2015 15:50:03 +0000 (11:50 -0400)]
drm/msm: fix timeout calculation

The 'timeout' value comes from userspace (CLOCK_MONOTONIC), but
converting this directly to jiffies doesn't take into account the
initial jiffies count at boot, which may differ from the base time
of CLOCK_MONOTONIC.

TODO: add ktime_delta_jiffies() when rebasing on 4.1 and use that
instead of ktime_sub/ktime_to_timespec/timespec_to_jiffies combo (as
suggested by Arnd)

v2: switch over from 'struct timespec' to ktime_t throughout, since
'struct timespec' will be deprecated (as suggested by Arnd)
v3: minor cosmetic tweaks

Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Rob Clark <robdclark@gmail.com>
9 years agodrm/msm/hdmi: Use pinctrl in HDMI driver
Stephane Viau [Thu, 4 Jun 2015 21:31:42 +0000 (17:31 -0400)]
drm/msm/hdmi: Use pinctrl in HDMI driver

Some targets (eg: msm8994) use the pinctrl framework to configure
interface pins. This change adds support for initialization and
pinctrl active/sleep state control for the HDMI driver.

Signed-off-by: Stephane Viau <sviau@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
9 years agodrm/msm/hdmi: Point to the right struct device
Stephane Viau [Thu, 4 Jun 2015 21:31:41 +0000 (17:31 -0400)]
drm/msm/hdmi: Point to the right struct device

DRM device's dev (hdmi->dev->dev) points to the mdss_mdp device
handle. Instead, we should get a reference to the mdss_hdmi
handle.

Signed-off-by: Stephane Viau <sviau@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
9 years agodrm/msm/mdp: Add support for more 32-bit RGB formats
Stephane Viau [Wed, 3 Jun 2015 21:27:21 +0000 (17:27 -0400)]
drm/msm/mdp: Add support for more 32-bit RGB formats

That will complete the lists of Alpha + RGB formats.

Signed-off-by: Stephane Viau <sviau@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
9 years agodrm/msm: use __s32, __s64, __u32 and __u64 from linux/types.h for uabi
Mikko Rapeli [Sat, 30 May 2015 15:38:08 +0000 (17:38 +0200)]
drm/msm: use __s32, __s64, __u32 and __u64 from linux/types.h for uabi

Fixes userspace compilation errors like:

error: unknown type name ‘uint32_t’

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Signed-off-by: Rob Clark <robdclark@gmail.com>
9 years agodrm/msm/atomic: Clean up planes in the error paths of .atomic_commit()
Laurent Pinchart [Wed, 27 May 2015 11:39:46 +0000 (14:39 +0300)]
drm/msm/atomic: Clean up planes in the error paths of .atomic_commit()

When the .atomic_commit() handler fails, clean up planes previoulsy
prepared by drm_atomic_helper_prepare_planes() with a call to
drm_atomic_helper_cleanup_planes().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Rob Clark <robdclark@gmail.com>
9 years agodrm/msm/mdp5: Always generate active-high sync signals for DSI
Hai Li [Fri, 22 May 2015 14:16:46 +0000 (10:16 -0400)]
drm/msm/mdp5: Always generate active-high sync signals for DSI

DSI video mode engine can only take active-high sync signals. This
change prevents MDP5 sending active-low sync signals to DSI in any
case.

Signed-off-by: Hai Li <hali@codeaurora.org>
Tested-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
9 years agodrm/msm: dsi: fix compile errors when CONFIG_GPIOLIB=n
Brian Norris [Wed, 20 May 2015 22:59:31 +0000 (15:59 -0700)]
drm/msm: dsi: fix compile errors when CONFIG_GPIOLIB=n

I'm not sure where, exactly, but somewhere in here we must be relying on
an implicit include.

drivers/gpu/drm/msm/dsi/dsi_host.c: In function ‘dsi_host_init_panel_gpios’:
drivers/gpu/drm/msm/dsi/dsi_host.c:1356:2: error: implicit declaration of function ‘devm_gpiod_get’ [-Werror=implicit-function-declaration]
  msm_host->disp_en_gpio = devm_gpiod_get(panel_device,
  ^
drivers/gpu/drm/msm/dsi/dsi_host.c:1356:25: warning: assignment makes pointer from integer without a cast [enabled by default]
  msm_host->disp_en_gpio = devm_gpiod_get(panel_device,
                         ^
drivers/gpu/drm/msm/dsi/dsi_host.c:1364:3: error: implicit declaration of function ‘gpiod_direction_output’ [-Werror=implicit-function-declaration]
   ret = gpiod_direction_output(msm_host->disp_en_gpio, 0);
   ^
drivers/gpu/drm/msm/dsi/dsi_host.c:1371:20: warning: assignment makes pointer from integer without a cast [enabled by default]
  msm_host->te_gpio = devm_gpiod_get(panel_device, "disp-te");
                    ^
drivers/gpu/drm/msm/dsi/dsi_host.c:1378:3: error: implicit declaration of function ‘gpiod_direction_input’ [-Werror=implicit-function-declaration]
   ret = gpiod_direction_input(msm_host->te_gpio);
   ^
drivers/gpu/drm/msm/dsi/dsi_host.c: In function ‘msm_dsi_host_power_on’:
drivers/gpu/drm/msm/dsi/dsi_host.c:1918:3: error: implicit declaration of function ‘gpiod_set_value’ [-Werror=implicit-function-declaration]
   gpiod_set_value(msm_host->disp_en_gpio, 1);
   ^

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Hai Li <hali@codeaurora.org>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Rob Clark <robdclark@gmail.com>
9 years agodrm/msm: use devm_gpiod_get_optional for optional reset gpio
Uwe Kleine-König [Wed, 20 May 2015 07:21:41 +0000 (09:21 +0200)]
drm/msm: use devm_gpiod_get_optional for optional reset gpio

Since 39b2bbe3d715 (gpio: add flags argument to gpiod_get*() functions)
which appeared in v3.17-rc1, the gpiod_get* functions take an additional
parameter that allows to specify direction and initial value for output.

Also there is a variant to find optional gpios that returns NULL if
there is no gpio instead of -ENOENT.

Make use of both features to simplify the driver.

This makes error checking more strict because errors like -ENOSYS ("no
gpio support compiled in") or -EPROBE_DEFER ("gpio not ready yet") are
handled correctly now.

Furthermore this is one caller less that stops us making the flags
argument to gpiod_get*() mandatory.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Rob Clark <robdclark@gmail.com>
9 years agodrm/msm/dsi: Separate PHY to another platform device
Hai Li [Fri, 15 May 2015 17:04:06 +0000 (13:04 -0400)]
drm/msm/dsi: Separate PHY to another platform device

There are different types of PHY from one chipset to another, while
the DSI host controller is relatively consistent across platforms.
Also, the PLL inside PHY is providing the source of DSI byte and
pixel clocks, which are used by DSI host controller. Separated devices
for clock provider and clock consumer make DSI driver better fit into
common clock framework.

Signed-off-by: Hai Li <hali@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
9 years agodrm/msm/dsi: Enable PLL driver in MSM DSI
Hai Li [Fri, 15 May 2015 17:04:05 +0000 (13:04 -0400)]
drm/msm/dsi: Enable PLL driver in MSM DSI

This change activates PLL driver for DSI to work with
common clock framework.

Signed-off-by: Hai Li <hali@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
9 years agodrm/msm/dsi: Add DSI PLL clock driver support
Hai Li [Fri, 15 May 2015 17:04:04 +0000 (13:04 -0400)]
drm/msm/dsi: Add DSI PLL clock driver support

DSI byte clock and pixel clocks are sourced from DSI PLL.
This change adds the DSI PLL source clock driver under
common clock framework.

This change handles DSI 28nm PLL only.

Signed-off-by: Hai Li <hali@codeaurora.org>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Stephane Viau <sviau@codeaurora.org>
Signed-off-by: Wentao Xu <wentaox@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
9 years agodrm/msm: use IS_ERR() to check regulator_get() return
Fabian Frederick [Mon, 4 May 2015 17:03:55 +0000 (19:03 +0200)]
drm/msm: use IS_ERR() to check regulator_get() return

regulator_get() never returns NULL. There's no need for IS_ERR_OR_NULL()

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Rob Clark <robdclark@gmail.com>
9 years agodrm/msm: use IS_ERR() to check msm_ioremap() return
Fabian Frederick [Mon, 4 May 2015 17:03:54 +0000 (19:03 +0200)]
drm/msm: use IS_ERR() to check msm_ioremap() return

msm_ioremap() never returns NULL. There's no need for IS_ERR_OR_NULL()

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Rob Clark <robdclark@gmail.com>
9 years agodrm/msm/mdp5: Wait for PP_DONE irq for command mode CRTC atomic commit
Hai Li [Tue, 28 Apr 2015 23:35:38 +0000 (19:35 -0400)]
drm/msm/mdp5: Wait for PP_DONE irq for command mode CRTC atomic commit

CRTCs in DSI command mode data path should wait for pingpong done,
instead of vblank, to finish atomic commit.

This change is to enable PP_DONE irq on command mode CRTCs and wait for
this irq happens before atomic commit completion.

Signed-off-by: Hai Li <hali@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
9 years agodrm/msm: Use customized function to wait for atomic commit done
Hai Li [Tue, 28 Apr 2015 23:35:37 +0000 (19:35 -0400)]
drm/msm: Use customized function to wait for atomic commit done

MDP FLUSH registers could indicate if the previous flush updates
has taken effect at vsync boundary. Making use of this H/W feature
can catch the vsync that happened between CRTC atomic_flush and
*_wait_for_vblanks, to avoid unnecessary wait.

This change allows kms CRTCs to use their own *_wait_for_commit_done
functions to wait for FLUSH register cleared at vsync, before commit
completion.

Signed-off-by: Hai Li <hali@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
9 years agodt-bindings: Add MSM eDP controller documentation
Hai Li [Wed, 15 Apr 2015 20:24:38 +0000 (16:24 -0400)]
dt-bindings: Add MSM eDP controller documentation

Signed-off-by: Hai Li <hali@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
9 years agodt-bindings: Add MSM DSI controller documentation
Hai Li [Wed, 15 Apr 2015 20:24:37 +0000 (16:24 -0400)]
dt-bindings: Add MSM DSI controller documentation

Signed-off-by: Hai Li <hali@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
9 years agodrm/msm: drop redundant debug output
Nicholas Mc Guire [Sat, 11 Apr 2015 13:10:38 +0000 (15:10 +0200)]
drm/msm: drop redundant debug output

wait_for_completion_timeout returns 0 in case of timeout and never
return < 0 so there is no additional information in printing the
value of time_left here as it will always be 0, thus it can be dropped.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
9 years agodrm/msm: wait_for_completion_timeout return is never negative
Nicholas Mc Guire [Sat, 11 Apr 2015 13:10:37 +0000 (15:10 +0200)]
drm/msm: wait_for_completion_timeout return is never negative

wait_for_completion_timeout returns >= 0 but never
negative  - so the error check should be against equality
to 0 not <= 0.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
9 years agodrm/msm: match wait_for_completion_timeout return type
Nicholas Mc Guire [Sat, 11 Apr 2015 13:10:36 +0000 (15:10 +0200)]
drm/msm: match wait_for_completion_timeout return type

return type of wait_for_completion_timeout is unsigned long not int, this
patch assigns the return value of wait_for_completion_timeout to an
appropriately typed and named variable.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
9 years agodrm/msm: dsi: Provide option to force continuous HS clock
Archit Taneja [Wed, 8 Apr 2015 06:07:40 +0000 (11:37 +0530)]
drm/msm: dsi: Provide option to force continuous HS clock

Some DSI peripherals rely on the HS clock on DSI clock lane as their clock
source. If the clock lane transitions between HS and LP states, it
can disrupt the functioning of such peripherals.

The mipi dsi mode flag MIPI_DSI_CLOCK_NON_CONTINUOUS already exists for
such peripheral drivers. Use it to configure the bit CLKLN_HS_FORCE_REQUEST
in DSI_LANE_CTRL.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
9 years agodrm/msm: Call drm_prime_gem_destroy to clean up imported GEM object
jilai wang [Tue, 7 Apr 2015 17:51:32 +0000 (13:51 -0400)]
drm/msm: Call drm_prime_gem_destroy to clean up imported GEM object

If the GEM object is imported, drm_prime_gem_destroy needs to be
called to clean up dma buffer related information.

Signed-off-by: Jilai Wang <jilaiw@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
9 years agodrm/msm/edp: fix build warning - missing prototype
Rob Clark [Fri, 5 Jun 2015 16:10:23 +0000 (12:10 -0400)]
drm/msm/edp: fix build warning - missing prototype

Fix build warning when building edp/edp_aux.o due to missing
prototype for edp_aux_transfer.

This function is only used in edp_aux.c so just make it static.

Reported-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
9 years agodrm/msm: drop redundant output in debug message
Nicholas Mc Guire [Sat, 4 Apr 2015 02:39:09 +0000 (04:39 +0200)]
drm/msm: drop redundant output in debug message

wait_for_completion_timeout returns 0 in case of timeout so printing the
return value here will always yield 0 and is therefor redundant - dropped.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
9 years agodrm/msm: fix HZ dependency of timeout
Nicholas Mc Guire [Sat, 4 Apr 2015 02:39:08 +0000 (04:39 +0200)]
drm/msm: fix HZ dependency of timeout

The timeout is passed as a constant which makes it HZ dependent because
jiffies are expected so it should be converted to jiffies. The actual
value is not clear from the code - my best guess is that this should be
300 milliseconds given that other timeouts are in milliseconds based on
looking at other drm drivers (e.g. exynos_drm_dsi.c:356 300ms,
tegra/dpaux.c:188 250ms) - this needs to be confirmed by someone who
knows the details of the driver.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
9 years agodrm/msm: fixup wait_for_completion_timeout handling
Nicholas Mc Guire [Sat, 4 Apr 2015 02:39:07 +0000 (04:39 +0200)]
drm/msm: fixup wait_for_completion_timeout handling

wait_for_completion_timeout return >= 0 but never negative so the check
logic looks inconsistent. Further the return value of
wait_for_completion_timeout was being passed up the call chain but the
x call sites as drm_dp_i2c_do_msg()/drm_dp_dpcd_access() check for < 0
thus timeout was being treated as success case.

<snip> drivers/gpu/drm/drm_dp_helper.c:drm_dp_i2c_do_msg()
                mutex_lock(&aux->hw_mutex);
                ret = aux->transfer(aux, msg);
                mutex_unlock(&aux->hw_mutex);
                if (ret < 0) {
<snip>
logic in edp_aux_transfer() seems incorrect as it could return 0 (timeout)
but checks of <= 0 to indicate error so the return probably should be
-ETIMEDOUT in case wait_for_completion_timeout returns 0 (timeout
occurred).

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
9 years agodrm/msm/mdp5: fix for crash in disable path
Rob Clark [Fri, 15 May 2015 00:21:37 +0000 (20:21 -0400)]
drm/msm/mdp5: fix for crash in disable path

Seems like disable can race with complete_flip() in process of disabling
a crtc, leading to:

[   49.065364] Call trace:
[   49.071441] [<ffffffc00041d5a0>] mdp5_ctl_blend+0x20/0x1c0
[   49.073788] [<ffffffc00041ebcc>] mdp5_crtc_disable+0x3c/0xa8
[   49.079348] [<ffffffc0003e7854>] disable_outputs.isra.4+0x11c/0x220
[   49.085164] [<ffffffc0003e7afc>] drm_atomic_helper_commit_modeset_disables+0x14/0x38
[   49.091155] [<ffffffc000425c80>] complete_commit+0x40/0xb8
[   49.099136] [<ffffffc0004260ac>] msm_atomic_commit+0x364/0x398
[   49.104430] [<ffffffc00040a614>] drm_atomic_commit+0x3c/0x70
[   49.110249] [<ffffffc0003e67b8>] drm_atomic_helper_set_config+0x1b0/0x3e0
[   49.116065] [<ffffffc0003f99bc>] drm_mode_set_config_internal+0x64/0xf8
[   49.122746] [<ffffffc0003fa624>] drm_framebuffer_remove+0xe4/0x128
[   49.129171] [<ffffffc0003feaf8>] drm_mode_rmfb+0xc0/0x100
[   49.135420] [<ffffffc0003efba8>] drm_ioctl+0x258/0x4d0
[   49.140889] [<ffffffc0001b0388>] do_vfs_ioctl+0x338/0x5d0
[   49.145921] [<ffffffc0001b06a8>] SyS_ioctl+0x88/0xa0

It makes no sense to free the ctl without disabling all stages, so lets
just move them together to avoid the crash.

Signed-off-by: Rob Clark <robdclark@gmail.com>
9 years agodrm/msm: workaround for missing irq on a306/8x16
Rob Clark [Tue, 12 May 2015 15:29:40 +0000 (11:29 -0400)]
drm/msm: workaround for missing irq on a306/8x16

Signed-off-by: Rob Clark <robdclark@gmail.com>
9 years agodrm/msm: adreno a306 support
Rob Clark [Wed, 6 May 2015 17:14:30 +0000 (13:14 -0400)]
drm/msm: adreno a306 support

As found in apq8016 (used in DragonBoard 410c) and msm8916.

Note that numerically a306 is actually 307 (since a305c already claimed
306).  Nice and confusing.

Signed-off-by: Rob Clark <robdclark@gmail.com>
9 years agodrm/msm: clarify downstream bus scaling
Rob Clark [Thu, 4 Jun 2015 14:26:37 +0000 (10:26 -0400)]
drm/msm: clarify downstream bus scaling

A few spots in the driver have support for downstream android
CONFIG_MSM_BUS_SCALING.  This is mainly to simplify backporting the
driver for various devices which do not have sufficient upstream
kernel support.  But the intentionally dead code seems to cause
some confusion.  Rename the #define to make this more clear.

Signed-off-by: Rob Clark <robdclark@gmail.com>
9 years agodrm/msm/mdp4: Support NV12MT format in mdp4
Rob Clark [Fri, 30 Jan 2015 14:48:11 +0000 (20:18 +0530)]
drm/msm/mdp4: Support NV12MT format in mdp4

Using fb modifier flag, support NV12MT format in MDP4.

v2:
- rework the modifier's description [Daniel Vetter's comment]
- drop .set_mode_config() callback [Rob Clark's comment]
v3:
- change VENDOR's name and restrict usage to NV12 [pointed by Daniel]

Signed-off-by: Rob Clark <robdclark@gmail.com>
9 years agodrm/msm: update generated headers
Rob Clark [Wed, 20 May 2015 14:50:30 +0000 (10:50 -0400)]
drm/msm: update generated headers

Signed-off-by: Rob Clark <robdclark@gmail.com>
9 years agodrm/msm: add missing DRIVER_ATOMIC flag
Rob Clark [Thu, 4 Jun 2015 14:12:22 +0000 (10:12 -0400)]
drm/msm: add missing DRIVER_ATOMIC flag

Somehow this got lost when msm atomic support was first merged.

Signed-off-by: Rob Clark <robdclark@gmail.com>
9 years agodrm/msm/adreno: dump scratch regs and other info on hang
Rob Clark [Sun, 19 Apr 2015 14:14:09 +0000 (10:14 -0400)]
drm/msm/adreno: dump scratch regs and other info on hang

Dump a bit more info when the GPU hangs, without having hang_debug
enabled (which dumps a *lot* of registers).  Also dump the scratch
registers, as they are useful for determining where in the cmdstream
the GPU hung (and they seem always safe to read when GPU has hung).

Note that the freedreno gallium driver emits increasing counter values
to SCRATCH6 (to identify tile #) and SCRATCH7 (to identify draw #), so
these two in particular can be used to "triangulate" where in the
cmdstream the GPU hung.

Signed-off-by: Rob Clark <robdclark@gmail.com>
9 years agodrm/virtio: remove some dead code
Dan Carpenter [Wed, 10 Jun 2015 19:27:51 +0000 (22:27 +0300)]
drm/virtio: remove some dead code

The goto is correct, and we never reach the return statement so just
delete the dead code.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agodrm/virtio: checking for NULL instead of IS_ERR
Dan Carpenter [Wed, 10 Jun 2015 19:27:11 +0000 (22:27 +0300)]
drm/virtio: checking for NULL instead of IS_ERR

virtio_gpu_alloc_object() returns an error pointer, it never returns
NULL.

Fixes: dc5698e80cf7 ('Add virtio gpu driver.')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoMerge branch 'drm-next-4.2-amdgpu' of git://people.freedesktop.org/~agd5f/linux into...
Dave Airlie [Thu, 11 Jun 2015 03:04:07 +0000 (13:04 +1000)]
Merge branch 'drm-next-4.2-amdgpu' of git://people.freedesktop.org/~agd5f/linux into drm-next

More fixes for amdgpu for 4.2.  We've integrated Jerome's comments
about the interface among other things.  I'll be on vacation next week
so Christian will be handling any updates next week.

* 'drm-next-4.2-amdgpu' of git://people.freedesktop.org/~agd5f/linux: (23 commits)
  drm/amdgpu: fix a amdgpu_dpm=0 bug
  drm/amdgpu: don't enable/disable display twice on suspend/resume
  drm/amdgpu: fix UVD/VCE VM emulation
  drm/amdgpu: enable vce powergating
  drm/amdgpu/iceland: don't call smu_init on resume
  drm/amdgpu/tonga: don't call smu_init on resume
  drm/amdgpu/cz: don't call smu_init on resume
  drm/amdgpu: update to latest gfx8 golden register settings
  drm/amdgpu: whitespace cleanup in gmc8 golden regs
  drm/admgpu: move XDMA golden registers to dce code
  drm/amdgpu: fix the build on big endian
  drm/amdgpu: cleanup UAPI comments
  drm/amdgpu: remove AMDGPU_CTX_OP_STATE_RUNNING
  drm/amdgpu: remove the VI hardware semaphore in ring sync
  drm/amdgpu: set the gfx config properly for all CZ variants (v2)
  drm/amdgpu: also print the pci revision when printing the pci ids
  drm/amdgpu: cleanup VA IOCTL
  drm/amdgpu: fix saddr handling in amdgpu_vm_bo_unmap
  drm/amdgpu: fix amdgpu_vm_bo_map
  drm/amdgpu: remove unused AMDGPU_IB_FLAG_GDS
  ...

9 years agodrm/amdgpu: fix a amdgpu_dpm=0 bug
Sonny Jiang [Wed, 10 Jun 2015 17:46:36 +0000 (13:46 -0400)]
drm/amdgpu: fix a amdgpu_dpm=0 bug

Signed-off-by: Sonny Jiang <sonny.jiang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: don't enable/disable display twice on suspend/resume
Alex Deucher [Wed, 10 Jun 2015 15:52:00 +0000 (11:52 -0400)]
drm/amdgpu: don't enable/disable display twice on suspend/resume

We were doing it in the common code and in the IP specific code.
Remove the IP specific code.  The common code handles the
ordering properly.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: fix UVD/VCE VM emulation
Christian König [Wed, 10 Jun 2015 15:20:11 +0000 (17:20 +0200)]
drm/amdgpu: fix UVD/VCE VM emulation

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: enable vce powergating
Sonny Jiang [Thu, 28 May 2015 19:47:53 +0000 (15:47 -0400)]
drm/amdgpu: enable vce powergating

Enable VCE dpm and powergating. VCE dpm dynamically scales the VCE clocks on
demand.

Signed-off-by: Sonny Jiang <sonny.jiang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
9 years agodrm/amdgpu/iceland: don't call smu_init on resume
Alex Deucher [Tue, 9 Jun 2015 21:46:30 +0000 (17:46 -0400)]
drm/amdgpu/iceland: don't call smu_init on resume

smu_init allocates buffers and initializes them.  It does not
touch the hw.  There is no need to do it again on resume.  It
should really be part of sw_init (and smu_fini should be part
of sw_fini), but we need the firmware sizes from the other IPs
for firmware loading so we have to wait until sw init is done
for all other IPs.

Reviewed-by: Sonny Jiang <Sonny.Jiang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu/tonga: don't call smu_init on resume
Alex Deucher [Tue, 9 Jun 2015 21:42:10 +0000 (17:42 -0400)]
drm/amdgpu/tonga: don't call smu_init on resume

smu_init allocates buffers and initializes them.  It does not
touch the hw.  There is no need to do it again on resume.  It
should really be part of sw_init (and smu_fini should be part
of sw_fini), but we need the firmware sizes from the other IPs
for firmware loading so we have to wait until sw init is done
for all other IPs.

Reviewed-by: Sonny Jiang <Sonny.Jiang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu/cz: don't call smu_init on resume
Alex Deucher [Tue, 9 Jun 2015 21:32:53 +0000 (17:32 -0400)]
drm/amdgpu/cz: don't call smu_init on resume

smu_init allocates buffers and initializes them.  It does not
touch the hw.  There is no need to do it again on resume.  It
should really be part of sw_init (and smu_fini should be part
of sw_fini), but we need the firmware sizes from the other IPs
for firmware loading so we have to wait until sw init is done
for all other IPs.

Reviewed-by: Sonny Jiang <Sonny.Jiang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: update to latest gfx8 golden register settings
Alex Deucher [Tue, 9 Jun 2015 18:33:03 +0000 (14:33 -0400)]
drm/amdgpu: update to latest gfx8 golden register settings

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: whitespace cleanup in gmc8 golden regs
Alex Deucher [Tue, 9 Jun 2015 18:06:18 +0000 (14:06 -0400)]
drm/amdgpu: whitespace cleanup in gmc8 golden regs

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/admgpu: move XDMA golden registers to dce code
Alex Deucher [Tue, 9 Jun 2015 17:51:25 +0000 (13:51 -0400)]
drm/admgpu: move XDMA golden registers to dce code

Already moved other display registers.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: fix the build on big endian
Alex Deucher [Tue, 9 Jun 2015 13:58:23 +0000 (09:58 -0400)]
drm/amdgpu: fix the build on big endian

Some leftover copy and pastes from radeon that never
got updated.

Reviewed-by: Christian König <christian.koenig@amd.com>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>