firefly-linux-kernel-4.4.55.git
9 years agoof: Add vendor prefix for Shanghai AVIC Optoelectronics Co., Ltd.
Philipp Zabel [Thu, 18 Dec 2014 15:43:42 +0000 (16:43 +0100)]
of: Add vendor prefix for Shanghai AVIC Optoelectronics Co., Ltd.

Shanghai AVIC Optoelectronics Co., Ltd. is a subsidiary of Tianma
Microelectronics Co., Ltd. and designs and manufactures TFT LCDs.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/panel: sharp: lq101r1sx01: Remove unneeded include
Thierry Reding [Thu, 18 Dec 2014 16:11:47 +0000 (17:11 +0100)]
drm/panel: sharp: lq101r1sx01: Remove unneeded include

Nothing in the file needs symbols from include/linux/host1x.h, so remove
the include.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/panel: sharp: lq101r1sx01: Respect power timings
Thierry Reding [Mon, 8 Dec 2014 14:38:17 +0000 (15:38 +0100)]
drm/panel: sharp: lq101r1sx01: Respect power timings

Before shutting down the display using the DCS display_off command, wait
for 4 frames according to the datasheet.

Furthermore, after enabling the power supply, the supply voltage needs
around 10 ms to settle. After that, another 120 ms is required before a
DCS exit_sleep_mode command can be sent.

While at it, no longer send the DCS soft_reset command. This is totally
unnecessary because we've just powered up the display, hence it will be
in a reset state already.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/panel: sharp: lq101r1sx01: Add delay after display on
Thierry Reding [Mon, 8 Dec 2014 14:05:48 +0000 (15:05 +0100)]
drm/panel: sharp: lq101r1sx01: Add delay after display on

After switching the display on (using the DCS display_on command), wait
for 6 frames (100ms at 60 Hz) to give the display more time to prepare.
Failing to do this results in the panel not initializing properly in a
large number of cases.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/panel: simple: Add support for Giantplus GPG482739QS5
Philipp Zabel [Wed, 19 Nov 2014 09:29:55 +0000 (10:29 +0100)]
drm/panel: simple: Add support for Giantplus GPG482739QS5

This patch adds support for the GiantPlus GPG48273QS5 4.3" WQVGA TFT LCD
panel to the simple-panel driver.

This panel is connected via a parallel bus and uses both HSYNC and
VSYNC, whose lengths are unfortunately not clearly defined. The
datasheet only specifies the front- and backporch length, but the timing
diagram suggests that both sync signals should be asserted for exactly
one clock cycle.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agoof: Add vendor prefix for Giantplus Technology Co., Ltd.
Philipp Zabel [Wed, 19 Nov 2014 09:29:54 +0000 (10:29 +0100)]
of: Add vendor prefix for Giantplus Technology Co., Ltd.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/mipi-dsi: Avoid potential NULL pointer dereference
Thierry Reding [Fri, 5 Dec 2014 10:46:56 +0000 (11:46 +0100)]
drm/mipi-dsi: Avoid potential NULL pointer dereference

The mipi_dsi_packet_create() function dereferences the msg pointer
before checking that it's valid. Move the dereference down to where it
is required to avoid potentially dereferencing a NULL pointer.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agoMerge tag 'topic/atomic-core-2015-01-27' of git://anongit.freedesktop.org/drm-intel...
Dave Airlie [Tue, 27 Jan 2015 23:34:27 +0000 (09:34 +1000)]
Merge tag 'topic/atomic-core-2015-01-27' of git://anongit.freedesktop.org/drm-intel into drm-next

* tag 'topic/atomic-core-2015-01-27' of git://anongit.freedesktop.org/drm-intel:
  drm/atomic: Fix potential use of state after free
  drm/atomic-helper: debug output for modesets
  drm/atomic-helpers: Saner encoder/crtc callbacks
  drm/atomic-helpers: Recover full cursor plane behaviour
  drm/atomic-helper: add connector->dpms() implementation
  drm/atomic: Add drm_crtc_state->active
  drm: Add standardized boolean props
  drm/plane-helper: Fix transitional helper kerneldocs
  drm/plane-helper: Skip prepare_fb/cleanup_fb when newfb==oldfb

Conflicts:
include/drm/drm_crtc_helper.h

9 years agoMerge tag 'drm/tegra/for-3.20-rc1' of git://anongit.freedesktop.org/tegra/linux into...
Dave Airlie [Tue, 27 Jan 2015 23:27:29 +0000 (09:27 +1000)]
Merge tag 'drm/tegra/for-3.20-rc1' of git://anongit.freedesktop.org/tegra/linux into drm-next

drm/tegra: Changes for v3.20-rc1

The biggest part of these changes is the conversion to atomic mode-
setting. A lot of cleanup and demidlayering was required before the
conversion, with the result being a whole lot of changes.

Besides the atomic mode-setting support, the host1x bus now has the
proper infrastructure to support suspend/resume for child devices.

Finally, a couple of smaller cleanup patches round things off.

* tag 'drm/tegra/for-3.20-rc1' of git://anongit.freedesktop.org/tegra/linux: (54 commits)
  drm/tegra: Use correct relocation target offsets
  drm/tegra: Add minimal power management
  drm/tegra: dc: Unify enabling the display controller
  drm/tegra: Track tiling and format in plane state
  drm/tegra: Track active planes in CRTC state
  drm/tegra: Remove unused ->mode_fixup() callbacks
  drm/tegra: Atomic conversion, phase 3, step 3
  drm/tegra: Atomic conversion, phase 3, step 2
  drm/tegra: dc: Use atomic clock state in modeset
  drm/tegra: sor: Implement ->atomic_check()
  drm/tegra: hdmi: Implement ->atomic_check()
  drm/tegra: dsi: Implement ->atomic_check()
  drm/tegra: rgb: Implement ->atomic_check()
  drm/tegra: dc: Store clock setup in atomic state
  drm/tegra: Atomic conversion, phase 3, step 1
  drm/tegra: Atomic conversion, phase 2
  drm/tegra: Atomic conversion, phase 1
  drm/tegra: dc: Do not needlessly deassert reset
  drm/tegra: Output cleanup functions cannot fail
  drm/tegra: Remove remnants of the output midlayer
  ...

9 years agodrm/tegra: Use correct relocation target offsets
David Ung [Wed, 21 Jan 2015 02:37:35 +0000 (18:37 -0800)]
drm/tegra: Use correct relocation target offsets

When copying a relocation from userspace, copy the correct target
offset.

Signed-off-by: David Ung <davidu@nvidia.com>
Fixes: 961e3beae3b2 ("drm/tegra: Make job submission 64-bit safe")
Cc: stable@vger.kernel.org
[treding@nvidia.com: provide a better commit message]
Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: Add minimal power management
Thierry Reding [Thu, 18 Dec 2014 16:15:25 +0000 (17:15 +0100)]
drm/tegra: Add minimal power management

For now only disable the KMS hotplug polling helper logic upon suspend
and re-enable it on resume.

Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Mark Zhang <markz@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: dc: Unify enabling the display controller
Thierry Reding [Mon, 8 Dec 2014 15:32:47 +0000 (16:32 +0100)]
drm/tegra: dc: Unify enabling the display controller

Previously output drivers would enable continuous display mode and power
up the display controller at various points during the initialization.
This is suboptimal because it accesses display controller registers in
output drivers and duplicates a bit of code.

Move this code into the display controller driver and enable the display
controller as the final step of the ->mode_set_nofb() implementation.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: Track tiling and format in plane state
Thierry Reding [Fri, 28 Nov 2014 12:14:55 +0000 (13:14 +0100)]
drm/tegra: Track tiling and format in plane state

Tracking these in the plane state allows them to be computed in the
->atomic_check() callback and reused when applying the configuration in
->atomic_update().

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: Track active planes in CRTC state
Thierry Reding [Wed, 26 Nov 2014 11:28:39 +0000 (12:28 +0100)]
drm/tegra: Track active planes in CRTC state

Wrap struct drm_crtc_state in a driver-specific structure and add the
planes field which keeps track of which planes are updated or disabled
during a modeset. This allows atomic updates of the the display engine
at ->atomic_flush() time.

v2: open-code getting the state of the CRTC that the plane is being
    attached to (Daniel Vetter)

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: Remove unused ->mode_fixup() callbacks
Thierry Reding [Fri, 19 Dec 2014 14:19:21 +0000 (15:19 +0100)]
drm/tegra: Remove unused ->mode_fixup() callbacks

All output drivers have now been converted to use the ->atomic_check()
callback, so the ->mode_fixup() callbacks are no longer used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: Atomic conversion, phase 3, step 3
Thierry Reding [Mon, 24 Nov 2014 16:41:23 +0000 (17:41 +0100)]
drm/tegra: Atomic conversion, phase 3, step 3

Provide a custom ->atomic_commit() implementation which supports async
commits. The generic atomic page-flip helper can use this to implement
page-flipping.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: Atomic conversion, phase 3, step 2
Thierry Reding [Mon, 24 Nov 2014 16:08:20 +0000 (17:08 +0100)]
drm/tegra: Atomic conversion, phase 3, step 2

Replace drm_crtc_helper_set_config() by drm_atomic_helper_set_config().
All drivers have now been converted to use ->atomic_check() to set the
atomic state, therefore the atomic mode setting helpers can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: dc: Use atomic clock state in modeset
Thierry Reding [Fri, 19 Dec 2014 14:09:16 +0000 (15:09 +0100)]
drm/tegra: dc: Use atomic clock state in modeset

All clock state is now stored in the display controller's atomic state,
so the output drivers no longer need to call back into the display
controller driver to set up the clock. This is also required to make
sure no hardware changes are made before validating a configuration.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: sor: Implement ->atomic_check()
Thierry Reding [Mon, 8 Dec 2014 16:26:46 +0000 (17:26 +0100)]
drm/tegra: sor: Implement ->atomic_check()

The implementation of the ->atomic_check() callback precomputes all
parameters to check if the given configuration can be applied. If so the
precomputed values are stored in the atomic state object for the encoder
and applied during modeset. In that way the modeset no longer needs to
perform any checking but simply program values into registers.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: hdmi: Implement ->atomic_check()
Thierry Reding [Mon, 8 Dec 2014 15:33:03 +0000 (16:33 +0100)]
drm/tegra: hdmi: Implement ->atomic_check()

The implementation of the ->atomic_check() callback precomputes all
parameters to check if the given configuration can be applied. If so the
precomputed values are stored in the atomic state object for the encoder
and applied during modeset. In that way the modeset no longer needs to
perform any checking but simply program values into registers.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: dsi: Implement ->atomic_check()
Thierry Reding [Mon, 8 Dec 2014 15:22:28 +0000 (16:22 +0100)]
drm/tegra: dsi: Implement ->atomic_check()

The implementation of the ->atomic_check() callback precomputes all
parameters to check if the given configuration can be applied. If so the
precomputed values are stored in the atomic state object for the encoder
and applied during modeset. In that way the modeset no longer needs to
perform any checking but simply program values into registers.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: rgb: Implement ->atomic_check()
Thierry Reding [Wed, 17 Dec 2014 16:04:36 +0000 (17:04 +0100)]
drm/tegra: rgb: Implement ->atomic_check()

The implementation of the ->atomic_check() callback precomputes all
parameters to check if the given configuration can be applied. If so the
precomputed values are stored in the atomic state object for the encoder
and applied during modeset. In that way the modeset no longer needs to
perform any checking but simply program values into registers.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: dc: Store clock setup in atomic state
Thierry Reding [Mon, 8 Dec 2014 15:14:45 +0000 (16:14 +0100)]
drm/tegra: dc: Store clock setup in atomic state

This allows the clock setup to be separated from the clock programming
and better matches the expectations of the atomic modesetting where no
code paths must fail during modeset.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: Atomic conversion, phase 3, step 1
Thierry Reding [Mon, 24 Nov 2014 16:08:06 +0000 (17:08 +0100)]
drm/tegra: Atomic conversion, phase 3, step 1

Switch out the regular plane helpers for the atomic plane helpers. Also
use the default atomic helpers to implement the ->atomic_check() and
->atomic_commit() callbacks. The driver now exclusively uses the atomic
interfaces.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: Atomic conversion, phase 2
Thierry Reding [Mon, 24 Nov 2014 16:02:53 +0000 (17:02 +0100)]
drm/tegra: Atomic conversion, phase 2

Hook up the default ->reset() and ->atomic_duplicate_state() helpers.
This ensures that state objects are properly created and framebuffer
reference counts correctly maintained.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: Atomic conversion, phase 1
Thierry Reding [Mon, 24 Nov 2014 15:27:13 +0000 (16:27 +0100)]
drm/tegra: Atomic conversion, phase 1

Implement initial atomic state handling. Hook up the CRTCs, planes' and
connectors' ->atomic_destroy_state() callback to ensure that the atomic
state objects don't leak.

Furthermore the CRTC now implements the ->mode_set_nofb() callback that
is used by new helpers to implement ->mode_set() and ->mode_set_base().
These new helpers also make use of the new plane helper functions which
the driver now provides.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: dc: Do not needlessly deassert reset
Thierry Reding [Fri, 16 Jan 2015 15:30:55 +0000 (16:30 +0100)]
drm/tegra: dc: Do not needlessly deassert reset

Commit 9c0127004ff4 ("drm/tegra: dc: Add powergate support") changed the
driver's ->probe() implementation to deassert the module reset, and with
there being nobody else to assert it until ->remove() there is no need
to deassert again later on.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: Output cleanup functions cannot fail
Thierry Reding [Fri, 19 Dec 2014 14:55:08 +0000 (15:55 +0100)]
drm/tegra: Output cleanup functions cannot fail

The tegra_output_exit() and tegra_output_remove() functions cannot fail,
so make them return void.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: Remove remnants of the output midlayer
Thierry Reding [Fri, 19 Dec 2014 14:51:35 +0000 (15:51 +0100)]
drm/tegra: Remove remnants of the output midlayer

The tegra_output midlayer is now completely gone and output drivers use
it purely as a helper library.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: debugfs cleanup cannot fail
Thierry Reding [Fri, 19 Dec 2014 14:47:30 +0000 (15:47 +0100)]
drm/tegra: debugfs cleanup cannot fail

The debugfs cleanup code never fails, so no error is returned. Therefore
the functions can all return void instead.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: sor: Demidlayer
Thierry Reding [Fri, 28 Nov 2014 14:41:34 +0000 (15:41 +0100)]
drm/tegra: sor: Demidlayer

Implement encoder and connector within the eDP driver itself using the
Tegra output helpers rather than using the Tegra output as midlayer. By
doing so one level of indirection is removed and output drivers become
more flexible while keeping the majority of the advantages provided by
the common output helpers.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: dsi: Demidlayer
Thierry Reding [Tue, 2 Dec 2014 16:30:23 +0000 (17:30 +0100)]
drm/tegra: dsi: Demidlayer

Implement encoder and connector within the DSI driver itself using the
Tegra output helpers rather than using the Tegra output as midlayer. By
doing so one level of indirection is removed and output drivers become
more flexible while keeping the majority of the advantages provided by
the common output helpers.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: hdmi: Demidlayer
Thierry Reding [Fri, 28 Nov 2014 15:50:59 +0000 (16:50 +0100)]
drm/tegra: hdmi: Demidlayer

Implement encoder and connector within the HDMI driver itself using the
Tegra output helpers rather than using the Tegra output as midlayer. By
doing so one level of indirection is removed and output drivers become
more flexible while keeping the majority of the advantages provided by
the common output helpers.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: rgb: Demidlayer
Thierry Reding [Tue, 16 Dec 2014 17:30:16 +0000 (18:30 +0100)]
drm/tegra: rgb: Demidlayer

Implement encoder and connector within the RGB driver itself using the
Tegra output helpers rather than using the Tegra output as midlayer. By
doing so one level of indirection is removed and output drivers become
more flexible while keeping the majority of the advantages provided by
the common output helpers.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: Add tegra_dc_setup_clock() helper
Thierry Reding [Tue, 2 Dec 2014 14:15:06 +0000 (15:15 +0100)]
drm/tegra: Add tegra_dc_setup_clock() helper

This is a small helper that performs the basic steps required by all
output drivers to prepare the display controller for use with a given
encoder.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: output: Make ->setup_clock() optional
Thierry Reding [Tue, 2 Dec 2014 14:12:28 +0000 (15:12 +0100)]
drm/tegra: output: Make ->setup_clock() optional

In order to transition output drivers to using the struct tegra_output
as a helper rather than midlayer, make this callback optional. Instead
drivers should implement the equivalent as part of ->mode_fixup(). For
the conversion to atomic modesetting a new callback ->atomic_check()
should be implemented that updates the display controller's state with
the corresponding parent clock, rate and shift clock divider.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: Convert output midlayer to helpers
Thierry Reding [Fri, 28 Nov 2014 14:38:40 +0000 (15:38 +0100)]
drm/tegra: Convert output midlayer to helpers

The output layer was initially designed to help reduce the amount of
code duplicated in output drivers. An unfortunate side-effect of that
was that it turned into a midlayer and it became difficult to make the
output drivers work without bending over backwards to fit into the
midlayer.

This commit starts to convert the midlayer into a helper library by
exporting most of the common functions so that they can be used by the
output drivers directly. Doing so will allow output drivers to reuse
common code paths but more easily override them where necessary.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: dc: No longer disable planes at CRTC disable
Thierry Reding [Mon, 17 Nov 2014 14:14:48 +0000 (15:14 +0100)]
drm/tegra: dc: No longer disable planes at CRTC disable

The DRM core should take care of disabling all unneeded planes, so there
is no need to do this explicitly.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: Move tegra_drm_mode_funcs to the core
Thierry Reding [Wed, 26 Nov 2014 12:03:57 +0000 (13:03 +0100)]
drm/tegra: Move tegra_drm_mode_funcs to the core

This structure will be extended using non-framebuffer related callbacks
in subsequent patches, so it should move to a more central location.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: dc: Wait for idle when disabled
Thierry Reding [Mon, 8 Dec 2014 15:03:53 +0000 (16:03 +0100)]
drm/tegra: dc: Wait for idle when disabled

When disabling the display controller, stop it and wait for it to become
idle. Doing so ensures that no further accesses to the framebuffer occur
and the buffers can be safely unmapped or freed.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: Stop CRTC at CRTC disable time
Thierry Reding [Fri, 21 Nov 2014 16:35:54 +0000 (17:35 +0100)]
drm/tegra: Stop CRTC at CRTC disable time

Previously output drivers would all stop the display controller in their
disable path. However with the transition to atomic modesetting the
display controller needs to be kept running until all planes have been
disabled so that software can properly determine (using VBLANK counts)
when it is safe to remove the framebuffers associated with the planes.

Moving this code into the display controller's disable path also gets
rid of the duplication of this into all output drivers.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: Use tegra_commit_dc() in output drivers
Thierry Reding [Fri, 21 Nov 2014 16:33:33 +0000 (17:33 +0100)]
drm/tegra: Use tegra_commit_dc() in output drivers

All output drivers have open-coded variants of this function, so export
it to remove some code duplication.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/atomic: Add ->atomic_check() to encoder helpers
Thierry Reding [Wed, 3 Dec 2014 15:44:34 +0000 (16:44 +0100)]
drm/atomic: Add ->atomic_check() to encoder helpers

This callback can be used instead of the legacy ->mode_fixup() and is
passed the CRTC and connector states. It can thus use these states to
validate the modeset and cache values in the state to be used during
the actual modeset.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/plane: Add optional ->atomic_disable() callback
Thierry Reding [Thu, 20 Nov 2014 11:05:50 +0000 (12:05 +0100)]
drm/plane: Add optional ->atomic_disable() callback

In order to prevent drivers from having to perform the same checks over
and over again, add an optional ->atomic_disable callback which the core
calls under the right circumstances.

v2: pass old state and detect edges to avoid calling ->atomic_disable on
already disabled planes, remove redundant comment (Daniel Vetter)

v3: rename helper to drm_atomic_plane_disabling() to clarify that it is
checking for transitions, move helper to drm_atomic_helper.h, clarify
check for !old_state and its relation to transitional helpers

Here's an extract from some discussion rationalizing the behaviour (for
a full version, see the reference below):

    > > Hm, thinking about this some more this will result in a slight difference
    > > in behaviour, at least when drivers just use the helper ->reset functions
    > > but don't disable everything:
    > > - With transitional helpers we assume we know nothing and call
    > >   ->atomic_disable.
    > > - With atomic old_state->crtc == NULL in the same situation right after
    > >   boot-up, but we asssume the plane is really off and _dont_ call
    > >   ->atomic_disable.
    > >
    > > Should we instead check for (old_state && old_state->crtc) and state that
    > > drivers need to make sure they don't have stuff hanging around?
    >
    > I don't think we can check for old_state because otherwise this will
    > always return false, whereas we really want it to force-disable planes
    > that could be on (lacking any more accurate information). For
    > transitional helpers anyway.
    >
    > For the atomic helpers, old_state will never be NULL, but I'd assume
    > that the driver would reconstruct the current state in ->reset().

    By the way, the reason for why old_state can be NULL with transitional
    helpers is the ordering of the steps in the atomic transition. Currently
    the Tegra patches do this (based on your blog post and the Exynos proto-
    type):

        1) atomic conversion, phase 1:
           - implement ->atomic_{check,update,disable}()
           - use drm_plane_helper_{update,disable}()

        2) atomic conversion, phase 2:
           - call drm_mode_config_reset() from ->load()
           - implement ->reset()

    That's only a partial list of what's done in these steps, but that's the
    only relevant pieces for why old_state is NULL.

    What happens is that without ->reset() implemented there won't be any
    initial state, hence plane->state (the old_state here) will be NULL the
    first time atomic state is applied.

    We could of course reorder the sequence such that drivers are required
    to hook up ->reset() before they can (or at the same as they) hook up
    the transitional helpers. We could add an appropriate WARN_ON to this
    helper to make that more obvious.

    However, that will not solve the problem because it only gets rid of the
    special case. We still don't know whether old_state->crtc == NULL is the
    current state or just the initial default.

    So no matter which way we do this, I don't see a way to get away without
    requiring specific semantics from drivers. They would be that:

        - drivers recreate the correct state in ->reset() so that
          old_state->crtc != NULL if the plane is really enabled

    or

        - drivers have to ensure that the real state in fact mirrors the
          initial default as encoded in the state (plane disabled)

References: http://lists.freedesktop.org/archives/dri-devel/2015-January/075578.html
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/plane: Make ->atomic_update() mandatory
Thierry Reding [Tue, 25 Nov 2014 12:05:12 +0000 (13:05 +0100)]
drm/plane: Make ->atomic_update() mandatory

There is no use-case where it would be useful for drivers not to
implement this function and the transitional plane helpers already
require drivers to provide an implementation.

v2: add new requirement to kerneldoc

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: gem: oops in error handling
Dan Carpenter [Fri, 16 Jan 2015 10:43:42 +0000 (13:43 +0300)]
drm/tegra: gem: oops in error handling

kfree(ERR_PTR(-ENOMEM)) will not work very well.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: dc: Fix bad irqsave/restore in tegra_dc_finish_page_flip()
Dan Carpenter [Wed, 7 Jan 2015 11:01:26 +0000 (14:01 +0300)]
drm/tegra: dc: Fix bad irqsave/restore in tegra_dc_finish_page_flip()

We can't save two values to the IRQ flags at the same time so the IRQs
are not enabled at the end.  This kind of bug is easy to miss in testing
if the function is normally called with IRQs disabled so we wouldn't
enable IRQs anyway.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: dsi: Adjust D-PHY timing
David Ung [Fri, 5 Dec 2014 23:30:05 +0000 (15:30 -0800)]
drm/tegra: dsi: Adjust D-PHY timing

Compliance testing shows that HS Trail is off by -12%. Increase the HS
Trail time to make this test pass.

Signed-off-by: David Ung <davidu@nvidia.com>
[treding@nvidia.com: update specification references, add comment]
Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: dsi: Reset across ->exit()/->init()
Thierry Reding [Mon, 24 Nov 2014 15:31:48 +0000 (16:31 +0100)]
drm/tegra: dsi: Reset across ->exit()/->init()

This allows a DRM driver unload/reload cycle to completely reset the DSI
controller and may help in situations where it's broken.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: dsi: Soft-reset controller on ->disable
Thierry Reding [Mon, 24 Nov 2014 15:29:40 +0000 (16:29 +0100)]
drm/tegra: dsi: Soft-reset controller on ->disable

This reset is necessary to properly clean up the internal state of the
controller.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: dsi: Registers are 32-bit
Thierry Reding [Mon, 24 Nov 2014 11:27:59 +0000 (12:27 +0100)]
drm/tegra: dsi: Registers are 32-bit

Use a sized unsigned 32-bit data type (u32) to store register contents.
The DSI registers are 32 bits wide irrespective of the architecture's
data width.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: hdmi: Registers are 32-bit
Thierry Reding [Mon, 8 Dec 2014 15:25:14 +0000 (16:25 +0100)]
drm/tegra: hdmi: Registers are 32-bit

Use a sized unsigned 32-bit data type (u32) to store register contents.
The HDMI registers are 32 bits wide irrespective of the architecture's
data width.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: dc: Return planar flag for non-YUV modes
Thierry Reding [Mon, 8 Dec 2014 14:55:28 +0000 (15:55 +0100)]
drm/tegra: dc: Return planar flag for non-YUV modes

This prevents the compiler from warning about using a variable that is
possibly uninitialized.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: dc: Describe register copies
Thierry Reding [Mon, 8 Dec 2014 14:50:04 +0000 (15:50 +0100)]
drm/tegra: dc: Describe register copies

Most of the display controller's registers are double-buffered, a few of
them are triple-buffered. The ASSEMBLY shadow copy is latched intto the
ACTIVE copy for double-buffered registers. For triple-buffered registers
the ASSEMBLY copy is first latched into the ARM copy.

Latching into the ACTIVE copy happens immediately if the controller is
inactive. Otherwise the latching happens on the next frame boundary. The
latching of the ASSEMBLY into the ARM copy happens immediately. Latching
is controlled by a set of *_ACT_REQ and *_UPDATE bits in the
DC_CMD_STATE_CONTROL register.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: dc: Initialize border color
Thierry Reding [Mon, 8 Dec 2014 14:45:39 +0000 (15:45 +0100)]
drm/tegra: dc: Initialize border color

Tegra114 and earlier support specifying the color of the border (i.e.
the active area of the screen that is not covered by any of the overlay
windows). By default this is set to a light blue, so set it to black to
comply with the requirements set by atomic modesetting.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: Check for NULL pointer instead of IS_ERR()
Dan Carpenter [Thu, 4 Dec 2014 11:00:35 +0000 (14:00 +0300)]
drm/tegra: Check for NULL pointer instead of IS_ERR()

iommu_domain_alloc() returns NULL on error, it never returns error
pointers.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: plane: Use proper possible_crtcs mask
Thierry Reding [Tue, 16 Dec 2014 17:04:08 +0000 (18:04 +0100)]
drm/tegra: plane: Use proper possible_crtcs mask

The possible_crtcs mask needs to be a mask of CRTC indices. There is no
guarantee that the DRM indices match the hardware pipe number, so the
mask must be computed from the CRTC index.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: Remove redundant zeroing out of memory
Thierry Reding [Wed, 10 Dec 2014 10:41:05 +0000 (11:41 +0100)]
drm/tegra: Remove redundant zeroing out of memory

The DRM core now zeroes out the memory associated with CRTC, encoder and
connector objects upon cleanup, so there's no need to explicitly do that
in drivers anymore.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/tegra: gem: Use iommu_map_sg()
Thierry Reding [Wed, 17 Dec 2014 15:46:37 +0000 (16:46 +0100)]
drm/tegra: gem: Use iommu_map_sg()

The iommu_map_sg() function is now available in the IOMMU API, so drop
the open-coded variant.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agogpu: host1x: Provide a proper struct bus_type
Thierry Reding [Thu, 18 Dec 2014 14:29:14 +0000 (15:29 +0100)]
gpu: host1x: Provide a proper struct bus_type

Previously the struct bus_type exported by the host1x infrastructure was
only a very basic skeleton. Turn that implementation into a more full-
fledged bus to support proper probe ordering and power management.

Note that the bus infrastructure needs to be available before any of the
drivers can be registered. This is automatically ensured if all drivers
are built as loadable modules (via symbol dependencies). If all drivers
are built-in there are no such guarantees and the link order determines
the initcall ordering. Adjust drivers/gpu/Makefile to make sure that the
host1x bus infrastructure is initialized prior to any of its users (only
drm/tegra currently).

v2: Fix building host1x and tegra-drm as modules
Reported-by: Dave Airlie <airlied@gmail.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Mark Zhang <markz@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agodrm/atomic: Fix potential use of state after free
Ander Conselvan de Oliveira [Fri, 23 Jan 2015 07:27:59 +0000 (09:27 +0200)]
drm/atomic: Fix potential use of state after free

The atomic helpers rely on drm_atomic_state_clear() to reset an atomic
state if a retry is needed due to the w/w mutexes. The subsequent calls
to drm_atomic_get_{crtc,plane,...}_state() would then return the stale
pointers in state->{crtc,plane,...}_states.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agodrm/atomic-helper: debug output for modesets
Daniel Vetter [Thu, 22 Jan 2015 15:36:25 +0000 (16:36 +0100)]
drm/atomic-helper: debug output for modesets

With the combination of ->enable and ->active it's a bit complicated
to follow what exactly is going on sometimes within a full modeset.
Add debug output to make this all traceable.

Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
9 years agodrm/atomic-helpers: Saner encoder/crtc callbacks
Daniel Vetter [Thu, 22 Jan 2015 15:36:24 +0000 (16:36 +0100)]
drm/atomic-helpers: Saner encoder/crtc callbacks

For historical reasons going all the way back to how the Xrandr code
was implemented the semantics of the callbacks used to enable/disable
crtcs and encoders are ... interesting.

But with atomic helpers all that complexity has been binned, with only
a well-defined on/off action left. Unfortunately the names stuck.

Let's fix that by adding enable/disable hooks every, make them the
preferred variant for atomic and update documentations.

Later on we add debug warnings when drivers have deprecated hooks. But
while everything is in-flight with lots of drivers converting to
atomic that's a bit too much - better wait for things to settle a bit
first.

v2: Fix kerneldoc, reported by Wu Fengguang.

Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
9 years agodrm/atomic-helpers: Recover full cursor plane behaviour
Daniel Vetter [Thu, 22 Jan 2015 15:36:23 +0000 (16:36 +0100)]
drm/atomic-helpers: Recover full cursor plane behaviour

Cursor plane updates have historically been fully async and mutliple
updates batched together for the next vsync. And userspace relies upon
that. Since implementing a full queue of async atomic updates is a bit
of work lets just recover the cursor specific behaviour with a hint
flag and some hacks to drop the vblank wait.

v2: Fix kerneldoc, reported by Wu Fengguang.

Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
9 years agodrm/atomic-helper: add connector->dpms() implementation
Daniel Vetter [Thu, 22 Jan 2015 17:53:05 +0000 (18:53 +0100)]
drm/atomic-helper: add connector->dpms() implementation

This builds on top of the crtc->active infrastructure to implement
legacy DPMS. My choice of semantics is somewhat arbitrary, but the
entire pipe is enabled as along as one output is still enabled.

Of course it also clamps everything that's not ON to OFF.

v2: Fix spelling in one comment.

v3: Don't do an async commit (Thierry)

v4: Dan Carpenter noticed missing error case handling.

Cc: Thierry Reding <thierry.reding@gmail.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Tested-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
9 years agodrm/atomic: Add drm_crtc_state->active
Daniel Vetter [Thu, 22 Jan 2015 15:36:21 +0000 (16:36 +0100)]
drm/atomic: Add drm_crtc_state->active

This is the infrastructure for DPMS ported to the atomic world.
Fundamental changes compare to legacy DPMS are:

- No more per-connector dpms state, instead there's just one per each
  display pipeline. So if you clone either you have to unclone first
  if you only want to switch off one screen, or you just switch of
  everything (like all desktops do). This massively reduces complexity
  for cloning since now there's no more half-enabled cloned configs to
  consider.

- Only on/off, dpms standby/suspend are as dead as real CRTs. Again
  reduces complexity a lot.

Now especially for backwards compat the really important part for dpms
support is that dpms on always succeeds (except for hw death and
unplugged cables ofc). Which means everything that could fail (like
configuration checking, resources assignments and buffer management)
must be done irrespective from ->active. ->active is really only a
toggle to change the hardware state. More precisely:

- Drivers MUST NOT look at ->active in their ->atomic_check callbacks.
  Changes to ->active MUST always suceed if nothing else changes.

- Drivers using the atomic helpers MUST NOT look at ->active anywhere,
  period. The helpers will take care of calling the respective
  enable/modeset/disable hooks as necessary. As before the helpers
  will carefully keep track of the state and not call any hooks
  unecessarily, so still no double-disables or enables like with crtc
  helpers.

- ->mode_set hooks are only called when the mode or output
  configuration changes, not for changes in ->active state.

- Drivers which reconstruct the state objects in their ->reset hooks
  or through some other hw state readout infrastructure must ensure
  that ->active reflects actual hw state.

This just implements the core bits and helper logic, a subsequent
patch will implement the helper code to implement legacy dpms with
this.

v2: Rebase on top of the drm ioctl work:
- Move crtc checks to the core check function.
- Also check for ->active_changed when deciding whether a modeset
  might happen (for the ALLOW_MODESET mode).
- Expose the ->active state with an atomic prop.

v3: Review from Rob
- Spelling fix in comment.
- Extract needs_modeset helper to consolidate the ->mode_changed ||
  ->active_changed checks.

v4: Fixup fumble between crtc->state and crtc_state.

Cc: Rob Clark <robdclark@gmail.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Tested-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
9 years agodrm: Add standardized boolean props
Daniel Vetter [Wed, 21 Jan 2015 07:47:38 +0000 (08:47 +0100)]
drm: Add standardized boolean props

Not a new type exposed to userspace, just a standard way to create
them since between range, bitmask and enum there's 3 different ways to
pull out a boolean prop.

Also add the kerneldoc for the recently added new prop types, which
Rob forgot all about.

v2: Fixup kerneldoc, spotted by Rob.

Cc: Rob Clark <robdclark@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
9 years agodrm: Add rotation value to plane state
Matt Roper [Thu, 22 Jan 2015 00:35:40 +0000 (16:35 -0800)]
drm: Add rotation value to plane state

The rotation property is shared by multiple drivers, so it makes sense
to store the rotation value (for atomic-converted drivers) in the common
plane state so that core code can eventually access it as well.

Cc: dri-devel@lists.freedesktop.org
Suggested-by: Daniel Vetter <daniel@ffwll.ch>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoMerge branch 'drm-next' of https://github.com/markyzq/kernel-drm-rockchip into drm...
Dave Airlie [Tue, 27 Jan 2015 00:05:44 +0000 (10:05 +1000)]
Merge branch 'drm-next' of https://github.com/markyzq/kernel-drm-rockchip into drm-next

single rockchip fix.

* 'drm-next' of https://github.com/markyzq/kernel-drm-rockchip:
  drm/rockchip: fix dma_alloc_attrs() error check

9 years agoMerge branch 'drm-next-3.20' of git://people.freedesktop.org/~agd5f/linux into drm...
Dave Airlie [Mon, 26 Jan 2015 23:39:58 +0000 (09:39 +1000)]
Merge branch 'drm-next-3.20' of git://people.freedesktop.org/~agd5f/linux into drm-next

Radeon drm-next changes for 3.20.  Highlights:
- Indirect draw support for evergreen/NI hw
- SMC fan control support for SI/CI
- Manual fan control for SI/CI
- DP audio support
- Lots of code cleanup

* 'drm-next-3.20' of git://people.freedesktop.org/~agd5f/linux: (45 commits)
  drm/radeon: make MMU_NOTIFIER optional
  drm/radeon: use NULL rather then 0 in audio detect
  drm/radeon: whitespace clean up in radeon_audio.c
  radeon/audio: enable DP audio
  radeon/audio: moved audio caps programming to audio_hotplug() function
  radeon/audio: applied audio_dpms() and audio_mode_set() calls
  radeon/audio: consolidate audio_mode_set() functions
  radeon/audio: removed unnecessary debug settings
  radeon/audio: moved mute programming to a separate function
  radeon/audio: moved audio packet programming to a separate function
  radeon/audio: set_avi_packet() function cleanup
  radeon/audio: removed unnecessary CRC control programing
  radeon: moved HDMI color depth programming to a separate function
  radeon/audio: moved VBI packet programming to separate functions
  radeon/audio: consolidate update_acr() functions (v2)
  radeon/audio: consolidate update_avi_infoframe() functions
  radeon/audio: consolidate audio_set_dto() functions
  radeon/audio: consolidate audio_fini() functions
  radeon/audio: consolidate audio_enable() functions
  radeon/audio: consolidate select_pin() functions
  ...

9 years agoMerge branch 'exynos-drm-next' of git://git.kernel.org/pub/scm/linux/kernel/git/daein...
Dave Airlie [Mon, 26 Jan 2015 23:38:29 +0000 (09:38 +1000)]
Merge branch 'exynos-drm-next' of git://git./linux/kernel/git/daeinki/drm-exynos into drm-next

  This pull request includes some code refactoring which removes
   Exynos specific structure names and uses generic structure
   names instead, and makes all plane updating to be done
   by only exynos_update_plane function. And also it includes
   some cleanup and fixup patches.

* 'exynos-drm-next' of git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos: (22 commits)
  drm/exynos: fimd: check error status for drm_iommu_attach_device
  drm/exynos: create exynos_check_plane()
  drm/exynos: remove mode_set() ops from exynos_crtc
  drm/exynos: don't duplicate drm_display_mode in fimd context
  drm/exynos: remove struct exynos_drm_manager
  drm/exynos: remove drm_dev from struct exynos_drm_manager
  drm/exynos: move 'type' from manager to crtc struct
  drm/exynos: remove pipe member of struct exynos_drm_manager
  drm/exynos: add pipe param to exynos_drm_crtc_create()
  drm/exynos: rename base object of struct exynos_drm_crtc to 'base'
  drm/exynos: remove exynos_drm_crtc_mode_set_commit()
  drm/exynos: call exynos_update_plane() directly on page flips
  drm/exynos: unify plane update on exynos_update_plane()
  drm/exynos: remove exynos_plane_commit() wrapper
  drm/exynos: don't do any DPMS operation while updating planes
  drm/exynos: Don't touch DPMS when updating overlay planes
  drm/exynos/vidi: remove useless ops->commit()
  drm/exynos/fimd: don't initialize 'ret' variable in fimd_probe()
  drm/exynos: remove struct exynos_drm_overlay
  drm/exynos: remove exynos_drm_crtc_plane_* wrappers
  ...

9 years agoMerge tag 'drm-amdkfd-next-fixes-2015-01-25' of git://people.freedesktop.org/~gabbayo...
Dave Airlie [Mon, 26 Jan 2015 23:14:15 +0000 (09:14 +1000)]
Merge tag 'drm-amdkfd-next-fixes-2015-01-25' of git://people.freedesktop.org/~gabbayo/linux into drm-next

Here is a pull request of fixes for 3.20 patches, including the fix you asked
me when you merged the previous pull request.

* tag 'drm-amdkfd-next-fixes-2015-01-25' of git://people.freedesktop.org/~gabbayo/linux:
  drm/amdkfd: change amdkfd version to 0.7.1
  drm/radeon: cik_sdma_ctx_switch_enable() can be static
  drm/amdkfd: Fix sparse errors
  drm/amdkfd: Handle case of invalid queue type
  drm/amdkfd: Add break at the end of case
  drm/amdkfd: Remove negative check of uint variable

9 years agodrm: fix drm_display_info_set_bus_formats kernel doc header
Boris Brezillon [Fri, 23 Jan 2015 20:09:30 +0000 (21:09 +0100)]
drm: fix drm_display_info_set_bus_formats kernel doc header

formats and num_formats arguments were previously called fmts and nfmts.
Fix the kernel doc comment so that it matches the new argument names.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoMerge tag 'drm-intel-next-2015-01-17' of git://anongit.freedesktop.org/drm-intel...
Dave Airlie [Mon, 26 Jan 2015 23:01:09 +0000 (09:01 +1000)]
Merge tag 'drm-intel-next-2015-01-17' of git://anongit.freedesktop.org/drm-intel into drm-next

- refactor i915/snd-hda interaction to use the component framework (Imre)
- psr cleanups and small fixes (Rodrigo)
- a few perf w/a from Ken Graunke
- switch to atomic plane helpers (Matt Roper)
- wc mmap support (Chris Wilson & Akash Goel)
- smaller things all over

* tag 'drm-intel-next-2015-01-17' of git://anongit.freedesktop.org/drm-intel: (40 commits)
  drm/i915: Update DRIVER_DATE to 20150117
  i915: reuse %ph to dump small buffers
  drm/i915: Ensure the HiZ RAW Stall Optimization is on for Cherryview.
  drm/i915: Enable the HiZ RAW Stall Optimization on Broadwell.
  drm/i915: PSR link standby at debugfs
  drm/i915: group link_standby setup and let this info visible everywhere.
  drm/i915: Add missing vbt check.
  drm/i915: PSR HSW/BDW: Fix inverted logic at sink main_link_active bit.
  drm/i915: PSR VLV/CHV: Remove condition checks that only applies to Haswell.
  drm/i915: VLV/CHV PSR needs to exit PSR on every flush.
  drm/i915: Fix kerneldoc for i915 atomic plane code
  drm/i915: Don't pretend SDVO hotplug works on 915
  drm/i915: Don't register HDMI connectors for eDP ports on VLV/CHV
  drm/i915: Remove I915_HAS_HOTPLUG() check from i915_hpd_irq_setup()
  drm/i915: Make hpd arrays big enough to avoid out of bounds access
  Revert "drm/i915/chv: Use timeout mode for RC6 on chv"
  drm/i915: Improve HiZ throughput on Cherryview.
  drm/i915: Reset CSB read pointer in ring init
  drm/i915: Drop unused position fields (v2)
  drm/i915: Move to atomic plane helpers (v9)
  ...

9 years agoMerge tag 'topic/core-stuff-2015-01-23' of git://anongit.freedesktop.org/drm-intel...
Dave Airlie [Mon, 26 Jan 2015 22:54:11 +0000 (08:54 +1000)]
Merge tag 'topic/core-stuff-2015-01-23' of git://anongit.freedesktop.org/drm-intel into drm-next

Just flushing out my drm-misc branch, nothing major. Well too old patches
I've dug out from years since a patch from Rob look eerily familiar ;-)

* tag 'topic/core-stuff-2015-01-23' of git://anongit.freedesktop.org/drm-intel:
  drm/probe-helper: clamp unknown connector status in the poll work
  drm/probe-helper: don't lose hotplug event
  next: drm/atomic: Use copy_from_user to copy 64 bit data from user space
  drm: Make drm_read() more robust against multithreaded races
  drm/fb-helper: Propagate errors from initial config failure
  drm: Drop superfluous "select VT_HW_CONSOLE_BINDING"

9 years agodrm/plane-helper: Fix transitional helper kerneldocs
Matt Roper [Fri, 16 Jan 2015 02:34:22 +0000 (18:34 -0800)]
drm/plane-helper: Fix transitional helper kerneldocs

drm_plane_helper_{update,disable} are not specific to primary planes;
fix some copy/paste summaries to avoid confusion.

Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agodrm/plane-helper: Skip prepare_fb/cleanup_fb when newfb==oldfb
Matt Roper [Mon, 19 Jan 2015 16:31:49 +0000 (08:31 -0800)]
drm/plane-helper: Skip prepare_fb/cleanup_fb when newfb==oldfb

When commiting a plane update where the framebuffer doesn't change, we
can skip the prepare_fb/cleanup_fb steps.  This also allows us to avoid
an unnecessary vblank wait at the end of the operation when we're just
moving a plane and not changing its image (e.g., for a cursor).

At the moment, i915 is the only upstream driver using the transitional
plane helpers, and thus the only driver affected by this change.

Note that this replicates a corresponding change in the atomic helpers
implemented in

commit ab58e3384b9f9863bfd029b458ff337d381bf6d2
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Mon Nov 24 20:42:42 2014 +0100

    drm/atomic-helper: Skip vblank waits for unchanged fbs

Reported-by: Jeremiah Mahler <jmmahler@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88540
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Tested-by: Tested-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agodrm/exynos: fimd: check error status for drm_iommu_attach_device
Ajay Kumar [Sun, 11 Jan 2015 16:57:07 +0000 (01:57 +0900)]
drm/exynos: fimd: check error status for drm_iommu_attach_device

check error status for drm_iommu_attach_device() and make sure
it propagates till the caller.

Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
Signed-off-by: Inki Dae <daeinki@gmail.com>
9 years agodrm/exynos: create exynos_check_plane()
Gustavo Padovan [Thu, 27 Nov 2014 16:56:09 +0000 (14:56 -0200)]
drm/exynos: create exynos_check_plane()

Split update plane in two parts, an initial check part that can fail
and the update part that can't fail.

This is a important step for the upcoming atomic modesetting support.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
9 years agodrm/exynos: remove mode_set() ops from exynos_crtc
Gustavo Padovan [Thu, 27 Nov 2014 18:30:45 +0000 (16:30 -0200)]
drm/exynos: remove mode_set() ops from exynos_crtc

It is no longer used anywhere.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
9 years agodrm/exynos: don't duplicate drm_display_mode in fimd context
Gustavo Padovan [Thu, 27 Nov 2014 18:28:44 +0000 (16:28 -0200)]
drm/exynos: don't duplicate drm_display_mode in fimd context

We can safely use the mode stored in the crtc.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
9 years agodrm/exynos: remove struct exynos_drm_manager
Gustavo Padovan [Sun, 18 Jan 2015 09:16:23 +0000 (18:16 +0900)]
drm/exynos: remove struct exynos_drm_manager

exynos_drm_manager was just a redundant struct to represent the crtc as
well. In this commit we merge exynos_drm_manager into exynos_drm_crtc to
remove an unnecessary level of indirection easing the understand of the
flow on exynos.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
9 years agodrm/exynos: remove drm_dev from struct exynos_drm_manager
Gustavo Padovan [Wed, 26 Nov 2014 18:43:27 +0000 (16:43 -0200)]
drm/exynos: remove drm_dev from struct exynos_drm_manager

manager-drm_dev is only accessed by exynos_drm_crtc_create() so this patch
pass drm_dev as argument on exynos_drm_crtc_create() and remove it from
struct exynos_drm_manager.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
9 years agodrm/exynos: move 'type' from manager to crtc struct
Gustavo Padovan [Wed, 5 Nov 2014 21:51:35 +0000 (19:51 -0200)]
drm/exynos: move 'type' from manager to crtc struct

'type' is now part of the struct exynos_drm_crtc. This is just another
step in the struct exynos_drm_manager removal.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
9 years agodrm/exynos: remove pipe member of struct exynos_drm_manager
Gustavo Padovan [Tue, 4 Nov 2014 20:44:47 +0000 (18:44 -0200)]
drm/exynos: remove pipe member of struct exynos_drm_manager

It is not longer used. This is part of the process of removing
struct exynos_drm_manager entirely.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
9 years agodrm/exynos: add pipe param to exynos_drm_crtc_create()
Gustavo Padovan [Tue, 4 Nov 2014 20:25:27 +0000 (18:25 -0200)]
drm/exynos: add pipe param to exynos_drm_crtc_create()

Get the pipe value from a parameter instead of getting it from
manager->pipe. We are removing manager->pipe.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
9 years agodrm/exynos: rename base object of struct exynos_drm_crtc to 'base'
Gustavo Padovan [Mon, 3 Nov 2014 20:20:29 +0000 (18:20 -0200)]
drm/exynos: rename base object of struct exynos_drm_crtc to 'base'

'base' is more widely used name in the drm subsystem for the base object.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
9 years agodrm/exynos: remove exynos_drm_crtc_mode_set_commit()
Gustavo Padovan [Fri, 14 Nov 2014 00:30:00 +0000 (22:30 -0200)]
drm/exynos: remove exynos_drm_crtc_mode_set_commit()

This was just as extra chain in the call stack. We just rename it to
_set_base() and let it do everything alone.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
9 years agodrm/exynos: call exynos_update_plane() directly on page flips
Gustavo Padovan [Tue, 25 Nov 2014 18:18:34 +0000 (16:18 -0200)]
drm/exynos: call exynos_update_plane() directly on page flips

Avoid an extra call to exynos_drm_crtc_mode_set_commit() that only calls
exynos_update_plane().

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
9 years agodrm/exynos: unify plane update on exynos_update_plane()
Gustavo Padovan [Tue, 25 Nov 2014 13:21:17 +0000 (11:21 -0200)]
drm/exynos: unify plane update on exynos_update_plane()

We can safely use the exynos_update_plane() to update the plane
framebuffer for both the overlay and primary planes.

Note that this patch removes a call to manager->ops->commit() in
exynos_drm_crtc_mode_set_commit(). The commit() call is used only by the
fimd driver to set underlying timings and need only in full modeset
operations. For plane update only win_commit is needed.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
9 years agodrm/exynos: remove exynos_plane_commit() wrapper
Gustavo Padovan [Fri, 14 Nov 2014 00:17:46 +0000 (22:17 -0200)]
drm/exynos: remove exynos_plane_commit() wrapper

It's doing nothing but calling exynos_crtc->ops->win_commit(), so let's
call this directly to avoid extra layers of abstraction.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
9 years agodrm/exynos: don't do any DPMS operation while updating planes
Gustavo Padovan [Fri, 14 Nov 2014 00:27:20 +0000 (22:27 -0200)]
drm/exynos: don't do any DPMS operation while updating planes

DPMS only makes sense when the mode changes, for plane update changes do
not perform any dpms operation.

This move places the win_commit() and commit() calls directly in the code
instead of calling exynos_drm_crtc_commit() thus avoiding DPMS operations.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
9 years agodrm/exynos: Don't touch DPMS when updating overlay planes
Gustavo Padovan [Thu, 30 Oct 2014 12:00:54 +0000 (12:00 +0000)]
drm/exynos: Don't touch DPMS when updating overlay planes

DPMS settings should only be changed by a full modeset.
exynos_plane_update() should only care about updating the planes itself
and nothing else.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
9 years agodrm/exynos/vidi: remove useless ops->commit()
Gustavo Padovan [Thu, 6 Nov 2014 20:15:01 +0000 (18:15 -0200)]
drm/exynos/vidi: remove useless ops->commit()

vidi_commit does nothing, remove it and its callers.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
9 years agodrm/exynos/fimd: don't initialize 'ret' variable in fimd_probe()
Gustavo Padovan [Mon, 3 Nov 2014 20:56:57 +0000 (18:56 -0200)]
drm/exynos/fimd: don't initialize 'ret' variable in fimd_probe()

We  set it in the beginning of the function, thus no need to set it at
initialization.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
9 years agodrm/exynos: remove struct exynos_drm_overlay
Gustavo Padovan [Mon, 3 Nov 2014 20:13:27 +0000 (18:13 -0200)]
drm/exynos: remove struct exynos_drm_overlay

struct exynos_drm_overlay has no practical advantage nor serves as
important piece of the exynos API design. The only place it was used
was inside the struct exynos_plane which was just causing a extra
access overhead. Users had to access the overlay first and just then
get the plane information it contains.

This patch merges struct exynos_drm_overlay into struct exynos_plane.
It also renames struct exynos_plane to struct exynos_drm_plane.

The rational is to cut one step to access plane information.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
9 years agodrm/exynos: remove exynos_drm_crtc_plane_* wrappers
Gustavo Padovan [Wed, 29 Oct 2014 19:25:53 +0000 (19:25 +0000)]
drm/exynos: remove exynos_drm_crtc_plane_* wrappers

This functions were doing nothing but calling a manager op function,
so remove them and call the manager directly.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
9 years agodrm/exynos: expose struct exynos_drm_crtc
Gustavo Padovan [Fri, 31 Oct 2014 17:33:30 +0000 (17:33 +0000)]
drm/exynos: expose struct exynos_drm_crtc

Let other pieces of the driver access struct exynos_drm_crtc as well.

struct exynos_drm_manager will be merged into struct exynos_drm_crtc, in
the sense we will move all its members to exynos_drm_crtc, so to start
this conversion exynos_drm_crtc need to be exposed as well.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
9 years agodrm/exynos: move to_exynos_crtc() macro to main header
Gustavo Padovan [Fri, 31 Oct 2014 14:32:32 +0000 (14:32 +0000)]
drm/exynos: move to_exynos_crtc() macro to main header

With this change we allow other pieces of the code to use this macro.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
9 years agogpu: host1x: Factor out __host1x_device_del()
Thierry Reding [Thu, 18 Dec 2014 14:26:02 +0000 (15:26 +0100)]
gpu: host1x: Factor out __host1x_device_del()

This function is needed in several places, so factor it out.

Signed-off-by: Thierry Reding <treding@nvidia.com>