Commit graph

460 commits

Author SHA1 Message Date
Archit Taneja 2b66987533 drm/msm: Drop load/unload drm_driver ops
The load/unload drm_driver ops are deprecated. They should be removed as
they result in creation of devices visible to userspace even before
the drm_device is registered.

Drop these ops and use drm_dev_alloc/register and drm_dev_unregister/unref
to explicitly create and destroy the drm device in the msm platform
driver's bind and unbind ops. With this in use, the drm connectors are
only registered once the drm_device is registered.

It also fixes the issue of stray debugfs files after the msm module is
removed. With this, all the debugfs files are removed, and allows
successive module insertions/removals.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
2016-05-08 10:22:19 -04:00
Archit Taneja 8208ed931e drm/msm: Centralize connector registration/unregistration
Move the drm_connector registration from the encoder(HDMI/DSI etc) drivers
to the msm platform driver. This will simplify the task of ensuring that
the connectors are registered only after the drm_device itself is
registered.

The connectors' destroy ops are made to use kzalloc instead of
devm_kzalloc to ensure that that the connectors can be successfully
unregistered when the msm driver module is removed. The memory for the
connectors is unallocated when drm_mode_config_cleanup() is called
during either during an error or during driver remove.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-05-08 10:22:19 -04:00
Archit Taneja c899f93584 drm/msm/hdmi: Prevent gpio_free related kernel warnings
Calling the legacy gpio_free on an invalid GPIO (a GPIO numbered -1)
results in kernel warnings. This causes a lot of backtraces when
we try to unload the drm/msm module.

Call gpio_free only on valid GPIOs.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-05-08 10:22:19 -04:00
Rob Clark 4816b6267c drm/msm: print offender task name on hangcheck recovery
Track the pid per submit, so we can print the name of the task which
submitted the batch that caused the gpu to hang.

Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-05-08 10:22:18 -04:00
Rob Clark 40e6815bba drm/msm: fix leak in failed submit path
Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-05-08 10:22:18 -04:00
Rob Clark 6860b56c4b drm/msm: de-indent submit_create()
Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-05-08 10:22:18 -04:00
Rob Clark 1193c3bcb5 drm/msm: drop return from gpu->submit()
At this point, there is nothing left to fail.  And submit already has a
fence assigned and is added to the submit_list.  Any problems from here
on out are asynchronous (ie. hangcheck/recovery).

Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-05-08 10:22:18 -04:00
Archit Taneja ed19075be1 drm/msm/mdp4: Don't manage DSI PLL regulators in MDP driver
The MDP4 driver tries to request and set voltages for regulators required
by the DSI PLLs.

Firstly, the MDP4 driver shouldn't manage the DSI regulators, this should
be handled in the DSI driver. Secondly, it shouldn't try to set a fixed
voltage for regulators. Voltage constraints should be specified on the
regulator via DT and managed by the regulator core.

Remove all the DSI PLL regulator related code from the MDP4 driver. It's
managed in the DSI driver for MSM8960/APQ8064 already.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-05-08 10:22:18 -04:00
Archit Taneja 1d15c1654f drm/msm/edp: Drop regulator_set_voltage call
The eDP driver tries to set a fixed voltage for one of its regulators(vdda)
before enabling it. This shouldn't be done by the driver, the voltage
constraints should be specified on the regulator via DT and managed by
the regulator core. A driver should call regulator_set_voltage only if
it needs to change the voltage during runtime. Drop the
regulator_set_voltage call. Mention in a comment the voltage that the
regulator expects.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-05-08 10:22:17 -04:00
Archit Taneja f377d59729 drm/msm/dsi: Fix regulator API abuse
The voltage changing code in this driver is broken and should be
removed.  The driver sets a single, exact voltage on probe.  Unless
there is a very good reason for this (which should be documented in
comments) constraints like this need to be set via the machine
constraints, voltage setting in a driver is expected to be used in cases
where the voltage varies at runtime.

In addition client drivers should almost never be calling
regulator_can_set_voltage(), if the device needs to set a voltage it
needs to set the voltage and the regulator core will handle the case
where the regulator is fixed voltage.  If the driver simply skips
setting the voltage if it doesn't have permission then it should just
not bother in the first place.

Originally authored by Mark Brown <broonie@kernel.org>

Remove the min/max voltage data entries per SoC managed by the driver.
These aren't needed as we don't try to set voltages any more. Mention in
comments the voltages that each regulator expects.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-05-08 10:22:17 -04:00
Vaishali Thakkar d6c925cada drm/msm: Move call to PTR_ERR_OR_ZERO after reassignment
Here, a location is reset to NULL before being passed to PTR_ERR.
So, PTR_ERR should be called before its argument is reassigned
to NULL. Further to simplify things use PTR_ERR_OR_ZERO instead
of PTR_ERR and IS_ERR.

Problem found using Coccinelle.

Signed-off-by: Vaishali Thakkar <vaishali.thakkar@oracle.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
[fixed fmt string warning (s/%ld/%d/)]
Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-05-08 10:22:16 -04:00
Rob Herring 30c6bfe8ab drm/msm/mdp: Add support for more RGBX formats
Android needs XBGR8888 format. Add all the missing 32-bpp formats
without alpha for completeness.

Cc: Archit Taneja <architt@codeaurora.org>
Cc: Rob Clark <robdclark@gmail.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Archit Taneja  <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-05-08 10:22:16 -04:00
Arnd Bergmann 6979cd54c0 drm: msm: remove unused variable
A recent cleanup removed the only user of the 'kms' variable in
msm_preclose(), causing a harmless compiler warning:

drivers/gpu/drm/msm/msm_drv.c: In function 'msm_preclose':
drivers/gpu/drm/msm/msm_drv.c:468:18: error: unused variable 'kms' [-Werror=unused-variable]

This removes the variable as well.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 4016260ba4 ("drm/msm: fix bug after preclose removal")
Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-05-08 10:22:16 -04:00
Rob Clark 2755734390 drm/msm: fix ->last_fence() after recover
It is no longer true that we discard all in-flight submits on recover
(these days we only discard the first one that hung).  After the first
re-submitted batch completes it would overwrite the fence with a correct
value, but there would be a window of time which showed all re-submitted
batches as already complete.

Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-05-08 10:22:15 -04:00
Rob Clark b6295f9a38 drm/msm: 'struct fence' conversion
Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-05-08 10:22:15 -04:00
Rob Clark ba00c3f2f0 drm/msm: remove fence_cbs
This was only used for atomic commit these days.  So instead just give
atomic it's own work-queue where we can do a block on each bo in turn.
Simplifies things a whole bunch and makes the 'struct fence' conversion
easier.

Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-05-08 10:22:14 -04:00
Rob Clark ca762a8ae7 drm/msm: introduce msm_fence_context
Better encapsulate the per-timeline stuff into fence-context.  For now
there is just a single fence-context, but eventually we'll also have one
per-CRTC to enable fully explicit fencing.

Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-05-08 10:19:51 -04:00
Rob Clark 340faef241 drm/msm: split locking and pinning BO's
Split up locking and pinning buffers in the submit path.  This is needed
because we'll want to insert fencing in between the two steps.

This makes things end up looking more similar to etnaviv submit code
(which was originally modelled on the msm code but has already added
'struct fence' support).

Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-05-08 10:16:03 -04:00
Rob Clark 7d12a279d4 drm/msm/gpu: simplify tracking in-flight bo's
Since we already track the array of bo's in the submit object, just
unconditionally take and drop ref's per submit (rather than only taking
ref's if bo is not already active).  This simplifies later patches.

Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-05-08 10:16:03 -04:00
Rob Clark 340ff4104f drm/msm: split out timeout_to_jiffies helper
Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-05-08 10:16:03 -04:00
Rob Clark 79f0e20215 drm/msm: use imported dmabuf's reservation object
This was always the intention, but somehow it was never wired up
properly.

Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-05-08 10:16:02 -04:00
Rob Clark fde5de6cb4 drm/msm: move fence code to it's own file
Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-05-08 10:16:02 -04:00
Rob Clark edcd60ce24 drm/msm: move debugfs code to it's own file
Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-05-08 10:16:02 -04:00
Rob Clark feb46f02c3 drm/msm: make HDCP support optional
It is already optional at runtime.  But this at least simplifies
backports to kernels without QCOM_SCM.

Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-05-08 10:16:02 -04:00
Gustavo Padovan 6118faea2b drm/msm: use drm_crtc_send_vblank_event()
Replace the legacy drm_send_vblank_event() with the new helper function.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1460656118-16766-5-git-send-email-gustavo@padovan.org
2016-05-02 17:03:51 +02:00
Maarten Lankhorst a3ccfb9feb drm/msm: Rename async to nonblock.
The async name is deprecated and should be changed to nonblocking.

Also comments seem to be a bit outdated, as it looks like
nonblocking commit is supported by msm.

Cc: Rob Clark <robdclark@gmail.com>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1461679905-30177-6-git-send-email-maarten.lankhorst@linux.intel.com
2016-05-02 16:36:29 +02:00
Dave Airlie 747a598ffa drm/mode: introduce wrapper to read framebuffer refcount.
Avoids drivers knowing where the kref is stored.

[airlied: add kerneldoc]
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-04-22 10:33:53 +10:00
Rob Clark 0a69509f24 drm/msm: fix typo in the !COMMON_CLK case
Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-03-23 18:15:49 -04:00
Rob Clark 4016260ba4 drm/msm: fix bug after preclose removal
commit 53190c7194
Author:     Daniel Vetter <daniel.vetter@ffwll.ch>
AuthorDate: Mon Jan 25 22:16:49 2016 +0100
Commit:     Daniel Vetter <daniel.vetter@ffwll.ch>
CommitDate: Mon Feb 8 09:55:50 2016 +0100

    drm/msm: Nuke preclose hooks

Left around the unused (and null) preclose fxn ptr, and things
predictibly explode when you try to call that.

Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-03-23 18:15:49 -04:00
Dave Airlie 1a4be38a3a Merge tag 'topic/drm-misc-2016-03-14' of git://anongit.freedesktop.org/drm-intel into drm-next
* tag 'topic/drm-misc-2016-03-14' of git://anongit.freedesktop.org/drm-intel: (27 commits)
  drm: atomic helper: do not unreference error pointer
  drm/edid: Extract SADs properly from multiple audio data blocks
  drm: fix blob pointer check
  drm: introduce pipe color correction properties
  drm/atomic: Clean up update_connector_routing.
  drm/atomic: Clean up steal_encoder, v2.
  drm/atomic: Handle encoder assignment conflicts in a separate check, v3.
  drm/atomic: Handle encoder stealing from set_config better.
  drm/atomic: Always call steal_encoder, v2.
  drm/ast: removed optional dummy crtc mode_fixup function.
  drm/bochs: removed optional dummy crtc mode_fixup function.
  drm/fsl-dcu: removed optional dummy crtc mode_fixup function.
  drm/virtio: removed optional dummy crtc mode_fixup function.
  drm/nouveau/dispnv04: removed optional dummy crtc mode_fixup function.
  drm/atmel-hlcdc: remove optional dummy crtc mode_fixup function.
  drm/sti: removed optional dummy crtc mode_fixup function.
  drm/shmobile: removed optional dummy crtc mode_fixup function.
  drm/msm/mdp: removed optional dummy crtc mode_fixup function.
  drm/omapdrm: removed optional dummy crtc mode_fixup function.
  drm/rcar-du: removed optional dummy crtc mode_fixup function.
  ...
2016-03-16 11:09:26 +10:00
Carlos Palminha b205b8ebc5 drm/msm/mdp: removed optional dummy crtc mode_fixup function.
This patch set nukes all the dummy crtc mode_fixup implementations.
(made on top of Daniel topic/drm-misc branch)

Signed-off-by: Carlos Palminha <palminha@synopsys.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-03-04 17:59:27 +01:00
Arnd Bergmann fcda50c8f4 drm/msm: rename hdmi symbols
Global symbols in the kernel should be prefixed by the name
of the subsystem and/or driver to avoid conflicts when all
code is built-in.

In this case, function names like 'hdmi_register' or 'hdmi_set_mode'
are way too generic for an MSM specific DRM driver, so I'm renaming
them all to msm_hdmi_* here.

I also rename a lot of the 'static' symbols along with the global
names for consistency, even though those are relatively harmless;
they might only be slightly confusing when they show up in
backtraces.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-03-03 11:55:33 -05:00
Rob Clark 7977f4426c drm/msm/adreno: remove duplicate adreno_hw_init() call
Not sure where it came from, but seem unintentional.  And also not
needed on a420, so let's just drop it.

Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-03-03 11:55:32 -05:00
Rob Clark 6c77d1abe6 drm/msm: add timestamp param
We need this for GL_TIMESTAMP queries.

Note: currently only supported on a4xx.. a3xx doesn't have this
always-on counter.  I think we could emulate it with the one CP
counter that is available, but for now it is of limited usefulness
on a3xx (since we can't seem to do time-elapsed queries in any sane
way with the existing firmware on a3xx, and if you are trying to do
profiling on a tiler you want time-elapsed).  We can add that later
if it becomes useful.

Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-03-03 11:55:32 -05:00
Rob Clark 4313c744d9 drm/msm: fix small typo
Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-03-03 11:55:31 -05:00
Rob Clark 687f084a3b drm/msm: grab struct_mutex after allocating submit
No real need to hold the lock over allocation, and simplifies things
slightly if we change the order.

Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-03-03 11:55:30 -05:00
Rob Clark c01a958eca drm/msm: reject submit ioctl if no gpu
Existing userspace wouldn't get this far, since getparam ioctl would
have failed and it would have bailed out creating a screen/context.

But all the same, we shouldn't let evil or confused userspace cause a
null ptr deref.

Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-03-03 11:55:30 -05:00
Craig Stout 1e2c8e7a2f drm/msm/adreno: print details in case of a protect fault interrupt
Signed-off-by: Craig Stout <cstout@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-03-03 11:55:29 -05:00
Craig Stout 7d0c5ee9f0 drm/msm/adreno: get CP_RPTR from register instead of shadow memory
As described in the downstream/kgsl driver:
Sometimes the RPTR shadow memory is unreliable causing timeouts
in adreno_idle().  Read it directly from the register instead.

Signed-off-by: Craig Stout <cstout@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-03-03 11:55:28 -05:00
Craig Stout 38bbc55ef5 drm/msm/adreno: add adreno430 power control
Signed-off-by: Craig Stout <cstout@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-03-03 11:55:28 -05:00
Craig Stout 357ff00b08 drm/msm/adreno: support for adreno 430.
Signed-off-by: Craig Stout <cstout@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-03-03 11:55:27 -05:00
Rob Clark a2272e48ee drm/msm: update generated headers
Pull in additional regs needed for a430, etc.

Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-03-03 11:55:27 -05:00
Luis Henriques 61965d3d57 drm/msm/dsi: fix definition of msm_dsi_pll_28nm_8960_init()
This fixes the following build failure:

drivers/gpu/drm/msm/dsi/pll/dsi_pll_28nm.o: In function `msm_dsi_pll_28nm_8960_init':
dsi_pll_28nm.c:(.text+0x1198): multiple definition of `msm_dsi_pll_28nm_8960_init'
drivers/gpu/drm/msm/dsi/pll/dsi_pll.o:dsi_pll.c:(.text+0x0): first defined here

Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
Acked-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-03-03 11:55:26 -05:00
Archit Taneja 26f7d1f4d9 drm/msm/dsi: Parse DSI lanes via DT
The DSI driver is currently unaware of how the DSI physical data lanes
are mapped to the logical lanes provided by the DSI controller.

Create a DT binding "qcom,data-lane-map" that provides this information
on a given platform.

The MSM DSI controller is restricted in terms of what all mappings
it can support. The lane polarity is fixed for all the lanes, the clock
lanes are fixed, and the data lanes can be swapped among each other only
for a few combinations. Apply these restrictions when we parse the DT
data.

Cc: devicetree@vger.kernel.org
Cc: Rob Herring <robh@kernel.org>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
2016-03-03 11:55:20 -05:00
Archit Taneja 52cde8dc8f drm/msm/dsi: Drop VDD regulator for MSM8916
VDD regulator input was specified for MSM8916. It turns our that this
regulator is used for the display panels used on MSM8916 platforms, but
not the DSI controller itself. Drop this regulator from the list.

Reported-by: Vinay Simha <vinaysimha@inforcecomputing.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-03-02 16:19:47 -05:00
Archit Taneja 06cfdc0ba5 drm/msm/dsi: Remove incorrect warning on host attach
With the implementation of of_graph parsing, it isn't any longer
necessary for msm_host->device node to be same as dsi->dev.of_node. This
only holds true when the connected device is also a child of the dsi_host.

In the case of external bridge chips belonging to a different control
bus, these are guaranteed to be different.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-03-02 16:19:46 -05:00
Archit Taneja 1aaa57f5d4 drm/msm: Free fb helper resources in msm_unload
We have a msm_fbev_free function to uninit fb_helper stuff, but we aren't
using it. Call it in msm_unload.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-03-02 16:19:45 -05:00
Sricharan R f759020530 drm/msm/mdp: Detach iommu in mdp4_destroy
attach_dev gets called in mdp4_kms_init, but there is no corresponding
detach_dev called in the error path or in the kms driver unload path.

Detach and destroy mmu in mdp4_destroy.

Signed-off-by: Sricharan R <sricharan@codeaurora.org>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-03-02 16:19:44 -05:00
Rob Clark d72ab59931 drm/msm: make iommu port names const'ier
Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-03-02 16:19:43 -05:00
Archit Taneja 4103eef98c drm/msm/mdp: Use atomic helper to set crtc property
Assign drm_atomic_helper_crtc_set_property helper to MDP4 and MDP5
crtcs' set_property ops. This replaces the custom funcs that
returned an error even for standard crtc properties.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Rob Clark <robdclark@gmail.com>
2016-03-02 16:19:41 -05:00