1
0
Fork 0
Commit Graph

194 Commits (94aae4caacda89a1bdb7198b260f4ca3595b7ed7)

Author SHA1 Message Date
Dan Carpenter 15da78084d drm/rockchip: fix a couple off by one bugs
The priv->crtc_funcs[] array has ROCKCHIP_MAX_CRTC elements so > should
be >= here.

Fixes: 2048e3286f ('drm: rockchip: Add basic drm driver')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
2016-07-19 09:42:39 +08:00
Mark Yao 44958207d6 drm/rockchip: vop: correct rk3036 register define
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
Reported-by: Tomasz Figa <tfiga@chromium.org>
2016-07-19 09:42:21 +08:00
Mark Yao ee8662fc1f drm/rockchip: vop: correct the source size of uv scale factor setting
When the input color format is YUV, we need to do some external scale
for CBCR. Like,
 * In YUV420 data format:
     cbcr_xscale = dst_w / src_w * 2;
     cbcr_yscale = dst_h / src_h * 2;
 * In YUV422 data format:
     cbcr_xscale = dst_w / src_w * 2;
     cbcr_yscale = dst_h / src_h;
 * In YUV444 data format
     cbcr_xscale = dst_w / src_w;
     cbcr_yscale = dst_h / src_h;

Signed-off-by: Yakir Yang <ykk@rock-chips.com>
2016-07-19 09:42:20 +08:00
Yakir Yang 7a1ff36c2c drm/rockchip: vop: add uv_vir register field for RK3036 VOP
The WIN0 of RK3036 VOP could support YUV data format, but driver
forget to add the uv_vir register field for it.

Signed-off-by: Yakir Yang <ykk@rock-chips.com>
2016-07-19 09:42:20 +08:00
John Keeping 8ff490ae42 drm/rockchip: fix "should it be static?" warnings
Combined with the previous commit, this fixes all of the sparse warnings
in drm/rockchip.

Signed-off-by: John Keeping <john@metanate.com>
2016-07-19 09:42:19 +08:00
John Keeping a7e03fb537 drm/rockchip: fb: add missing header
This fixes the following sparse warnings:

drivers/gpu/drm/rockchip/rockchip_drm_fb.c:32:23: warning: symbol 'rockchip_fb_get_gem_obj' was not declared. Should it be static?
drivers/gpu/drm/rockchip/rockchip_drm_fb.c:315:24: warning: symbol 'rockchip_drm_framebuffer_init' was not declared. Should it be static?
drivers/gpu/drm/rockchip/rockchip_drm_fb.c:329:6: warning: symbol 'rockchip_drm_mode_config_init' was not declared. Should it be static?

Signed-off-by: John Keeping <john@metanate.com>
2016-07-19 09:42:18 +08:00
John Keeping a38656958e drm/rockchip: dw_hdmi: remove unused #include
drm_encoder_slave is not used in this file.

Signed-off-by: John Keeping <john@metanate.com>
2016-07-19 09:42:18 +08:00
Markus Elfring d37e2a150e drm/rockchip: Delete an unnecessary check before drm_gem_object_unreference_unlocked()
The drm_gem_object_unreference_unlocked() function tests whether
its argument is NULL and then returns immediately.
Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/b66399ed-278b-b85d-4a21-b34164936ef6@users.sourceforge.net
2016-07-18 08:54:55 +02:00
Dave Airlie e2b80bac21 Merge branch 'upstream/analogix-dp-20160705' of git://github.com/yakir-Yang/linux into drm-next
Please consider merging this tag, which contains the v4 misc fixes and add RK3399 eDP support patches[0] I sent on 2016-06-29, rebased onto v4.7-rc5.

* 'upstream/analogix-dp-20160705' of git://github.com/yakir-Yang/linux:
  dt-bindings: analogix_dp: rockchip: correct the wrong compatible name
  drm/rockchip: analogix_dp: introduce the pclk for grf
  drm/bridge: analogix_dp: fix no drm hpd event when panel plug in
  drm/rockchip: analogix_dp: update the comments about why need to hardcode VOP output mode
  drm/rockchip: analogix_dp: correct the connector display color format and bpc
  drm/bridge: analogix_dp: passing the connector as an argument in .get_modes()
  drm/rockchip: analogix_dp: make panel detect to an optional action
  drm/rockchip: analogix_dp: add rk3399 eDP support
  drm/bridge: analogix_dp: some rockchip chips need to flip REF_CLK bit setting
  drm/bridge: analogix_dp: correct the register bit define error in ANALOGIX_DP_PLL_REG_1
  drm/rockchip: analogix_dp: split the lcdc select setting into device data
2016-07-16 11:21:50 +10:00
Tobias Jakobi dd86027b3b drm/rockchip: make fbdev support really optional
Currently enabling Rockchip DRM support automatically pulls
in fbdev dependency. However this dep is unnecessary since
DRM core already handles this for us (DRM_FBDEV_EMULATION).

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
2016-07-15 10:28:20 -04:00
Peter Chen 6d5fa28c13 gpu: drm: rockchip_drm_drv: add missing of_node_put after calling of_parse_phandle
of_node_put needs to be called when the device node which is got
from of_parse_phandle has finished using.

Cc: Mark Yao <mark.yao@rock-chips.com>
Cc: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1467684294-20111-2-git-send-email-peter.chen@nxp.com
2016-07-12 15:45:49 +02:00
Yakir Yang dc1c93bef4 drm/rockchip: analogix_dp: introduce the pclk for grf
For RK3399's GRF module, if we want to operate the graphic related grf
registers, we need to enable the pclk_vio_grf which supply power for VIO
GRF IOs, so it's better to introduce an optional grf clock in driver.

Signed-off-by: Yakir Yang <ykk@rock-chips.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Tomasz Figa <tomasz.figa@chromium.com>
2016-07-05 21:53:41 +08:00
Yakir Yang d698f0eb9d drm/rockchip: analogix_dp: update the comments about why need to hardcode VOP output mode
The hardware IC designed that VOP must output the RGB10 video format to
eDP contoller, and if eDP panel only support RGB8, then eDP contoller
should cut down the video data, not via VOP contoller, that's why we need
to hardcode the VOP output mode to RGA10 here.

Signed-off-by: Yakir Yang <ykk@rock-chips.com>
Acked-by: Mark Yao <mark.yao@rock-chips.com>
Reviewed-by: Tomasz Figa <tomasz.figa@chromium.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
2016-07-05 21:53:39 +08:00
Yakir Yang db8a9aed10 drm/rockchip: analogix_dp: correct the connector display color format and bpc
Rockchip VOP couldn't output YUV video format for eDP controller, so
when driver detect connector support YUV video format, we need to hack
it down to RGB888.

Signed-off-by: Yakir Yang <ykk@rock-chips.com>
Acked-by: Mark Yao <mark.yao@rock-chips.com>
Reviewed-by: Tomasz Figa <tomasz.figa@chromium.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
2016-07-05 21:53:38 +08:00
Yakir Yang eb87c91c73 drm/rockchip: analogix_dp: make panel detect to an optional action
Some boards don't need to declare a panel device node, like the
display interface is DP monitors, so it's necessary to make the
panel detect to an optional action.

Signed-off-by: Yakir Yang <ykk@rock-chips.com>
Acked-by: Mark Yao <mark.yao@rock-chips.com>
Reviewed-by: Tomasz Figa <tomasz.figa@chromium.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
2016-07-05 21:53:37 +08:00
Yakir Yang 82872e42bb drm/rockchip: analogix_dp: add rk3399 eDP support
RK3399 and RK3288 shared the same eDP IP controller, only some light
difference with VOP configure and GRF configure.

Signed-off-by: Yakir Yang <ykk@rock-chips.com>
Acked-by: Mark Yao <mark.yao@rock-chips.com>
Reviewed-by: Tomasz Figa <tomasz.figa@chromium.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
2016-07-05 21:53:31 +08:00
Yakir Yang d9c900b027 drm/rockchip: analogix_dp: split the lcdc select setting into device data
eDP controller need to declare which vop provide the video source,
and it's defined in GRF registers.

But different chips have different GRF register address, so we need to
create a device data to declare the GRF messages for each chips.

Signed-off-by: Yakir Yang <ykk@rock-chips.com>
Acked-by: Mark Yao <mark.yao@rock-chips.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
2016-07-05 09:16:33 +08:00
Tomasz Figa 9127f99c48 drm/rockchip: Finish initialization before registering DRM device
Currently the driver calls drm_dev_register() directly after allocating
the DRM device and then continues with further initialization. This is
incorrect, because drm_dev_register() is supposed to be called after all
initialization is done. This problem was masked by the fact that
drm_dev_register() did not use to do anything special before, but
recently it started to call drm_connector_register_all(), which leads to
a crash if the driver is not fully initialized.

This patch fixes the problem by moving the call to drm_dev_register() to
the end of the initialization sequence and also removing the, now
unnecessary, call to drm_connector_register_all() from driver code.

Fixes: f706974a69 ("drm/rockchip: Drop drm_driver.load/unload callbacks")
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
[danvet: Fix up cleanup labels a bit.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1466483254-35373-1-git-send-email-tfiga@chromium.org
2016-06-21 10:52:58 +02:00
Ville Syrjälä 9b8b013dde drm: Deal with rotation in drm_plane_helper_check_update()
drm_plane_helper_check_update() needs to account for the plane rotation
for correct clipping/scaling calculations. Do so.

There was an earlier attempt [1] to add this into
intel_check_primary_plane() but I requested that it'd be put into the
helper instead. An updated patch never materialized AFAICS, so I went
ahead and cooked one up myself.

v2: Deal with new drm_plane_helper_check_update() callers

[1] https://patchwork.freedesktop.org/patch/65177/
Cc: Nabendu Maiti <nabendu.bikash.maiti@intel.com>
Cc: Noralf Trønnes <noralf@tronnes.org>
Cc: CK Hu <ck.hu@mediatek.com>
Cc: Mark Yao <mark.yao@rock-chips.com>
Cc: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1466172790-10025-1-git-send-email-ville.syrjala@linux.intel.com
2016-06-17 16:41:25 +02:00
Arnd Bergmann 2a6ae85a38 drm: rockchip: select DRM_GEM_CMA_HELPER
The rockchip drm driver started using drm_gem_cma_vm_ops, but that might
not be part of the kernel, causing the link to fail:

drivers/gpu/built-in.o:(.data+0xb234): undefined reference to `drm_gem_cma_vm_ops'

This adds a Kconfig 'select' statement to enable it like the other
user do.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 80f67cd80a ("drm/rockchip: Use cma gem vm ops")
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20160616122800.1174015-1-arnd@arndb.de
2016-06-16 14:37:15 +02:00
Boris Brezillon 49339e2a40 drm: rockchip: Rely on the default ->best_encoder() behavior
All outputs have a 1:1 relationship between connectors and encoders
and the driver is relying on the atomic helpers: we can drop the custom
->best_encoder() implementations  and let the core call
drm_atomic_helper_best_encoder() for us.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Mark Yao <mark.yao@rock-chips.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1465300095-16971-11-git-send-email-boris.brezillon@free-electrons.com
Link: http://patchwork.freedesktop.org/patch/msgid/1465300095-16971-12-git-send-email-boris.brezillon@free-electrons.com
2016-06-10 17:24:37 +02:00
Tomeu Vizoso fe64ba5c63 drm/rockchip: Resume DP early
The DP needs to have resumed once the DRM driver calls
drm_atomic_helper_resume, otherwise the DP clock is still disabled when
the DRM core enables the DP bridge.

Would be nice to use device_pm_wait_for_dev to synchronize these
devices, but the DRM device doesn't know what specific implementation
this bridge has.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Cc: Caesar Wang <wxt@rock-chips.com>
Cc: Douglas Anderson <dianders@chromium.org>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: Yakir Yang <ykk@rock-chips.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1465224813-7359-2-git-send-email-tomeu.vizoso@collabora.com
2016-06-10 17:13:24 +02:00
Tomeu Vizoso 5a58738309 drm/rockchip: Use atomic PM helpers
This driver was still using the old legacy helpers and that caused a few
NULL dereferences when trying to call empty callbacks.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Cc: Caesar Wang <wxt@rock-chips.com>
Cc: Douglas Anderson <dianders@chromium.org>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: Yakir Yang <ykk@rock-chips.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1465224813-7359-1-git-send-email-tomeu.vizoso@collabora.com
2016-06-10 17:13:19 +02:00
Daniel Vetter 7442148e51 drm/rockchip: Nuke pending event handling in preclose
This is now handled by the core, drivers can totally ignore lifetime
issues of drm events.

Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Cc: Mark yao <mark.yao@rock-chips.com>
Tested-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1465388359-8070-11-git-send-email-daniel.vetter@ffwll.ch
2016-06-10 17:11:20 +02:00
Daniel Vetter 893b6cad4d drm/rockchip: convert to helper nonblocking atomic commit
With the various bits fixed rockchip now has an atomic compliant
handling/signalling of crtc_state->event, which means we can just
switch over to the new nonblocking helpers and remove some code.

v2: Fixes from Tomeu.

v3: Send out vblank events correctly when shutting down a crtc for
good. This is part of the atomic interface contract.

v4: Properly protect vop->event.

v5: Add more WARN_ON to check vop->event isn't clobbered.

Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Cc: Mark yao <mark.yao@rock-chips.com>
Tested-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2016-06-10 17:11:19 +02:00
Daniel Vetter 4f9d39a78e drm/rockchip: Fix crtc_state->event signalling
It's not permissible to look at plane->state from interrupt context,
since doing that would need the irq handler to acquire the
plane->mutex lock.

The other problem is that if we pipeline updates using the new
nonblocking atomic helpers new state gets commit before the irq
handler fires, resulting in a lost event.

Fix both issues by caching the necessary values in vop_win, protected
by dev->event_lock.

Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Cc: Mark yao <mark.yao@rock-chips.com>
Tested-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1465388359-8070-19-git-send-email-daniel.vetter@ffwll.ch
2016-06-10 17:11:18 +02:00
Daniel Vetter 05c960e79d drm/rockchip: Disarm vop->is_enabled
With atomic helpers there's no need to track the enabled state of a pipe
any more, because atomic helpers track this accurately already.

Just disable the early returns, since the debug checks might be useful.

v2: Don't call drm_helper_disable_unused_functions, it blows up
without this check. At least explains why rockchip still needed this
old legacy-style state tracing - to work around issues from calling
other legacy style functions!

Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Cc: Mark yao <mark.yao@rock-chips.com>
Tested-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1465388359-8070-18-git-send-email-daniel.vetter@ffwll.ch
2016-06-10 17:11:18 +02:00
Daniel Vetter 5e84c2690b drm/atomic-helper: Massage swap_state signature somewhat
- dev is redundant, we have state->atomic
- add stall parameter, which must be set when swapping needs to stall
  for preceeding commits to stop looking at ->state pointers. Currently
  all drivers need this to be, just prep work for a glorious future.

v2: Rebased on top of

commit e7cf0963f8
Author: Gerd Hoffmann <kraxel@redhat.com>
Date:   Tue May 31 08:50:47 2016 +0200

    virtio-gpu: add atomic_commit function

Cc: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1465509992-19284-1-git-send-email-daniel.vetter@ffwll.ch
Link: http://patchwork.freedesktop.org/patch/msgid/1465388359-8070-2-git-send-email-daniel.vetter@ffwll.ch
2016-06-10 16:52:12 +02:00
Tomeu Vizoso f706974a69 drm/rockchip: Drop drm_driver.load/unload callbacks
They are deprecated and by moving their implementations to bind/unbind
we can call drm_connector_register_all instead of open-coding it.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1465557253-10670-1-git-send-email-tomeu.vizoso@collabora.com
2016-06-10 16:47:48 +02:00
Brian Norris 913bb40a45 drm/rockchip: fix compile warnings for 64-bit
Rockchip DRM does not yet build properly for ARM64, but we might as well
get the printf formatting correct now, to avoid the following warnings:

drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c: In function 'rockchip_drm_fbdev_create':
drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c:111:2: warning: format '%d' expects argument of type 'int', but argument 8 has type 'size_t' [-Wformat=]
  DRM_DEBUG_KMS("FB [%dx%d]-%d kvaddr=%p offset=%ld size=%d\n",
  ^

drivers/gpu/drm/rockchip/rockchip_drm_gem.c: In function 'rockchip_gem_alloc_buf':
drivers/gpu/drm/rockchip/rockchip_drm_gem.c:41:3: warning: format '%x' expects argument of type 'unsigned int', but argument 2 has type 'size_t' [-Wformat=]
   DRM_ERROR("failed to allocate %#x byte dma buffer", obj->size);
   ^

Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Tested-by: Caesar Wang <wxt@rock-chips.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1465494392-92489-1-git-send-email-briannorris@chromium.org
2016-06-10 16:33:40 +02:00
Dave Airlie 2cca455740 Merge tag 'topic/drm-misc-2016-06-07' of git://anongit.freedesktop.org/drm-intel into drm-next
As promised, piles of prep work all around:
- drm_atomic_state rework, prep for nonblocking commit helpers
- fence patches from Gustavo and Christian to prep for atomic fences and
  some cool work in ttm/amdgpu from Christian
- drm event prep for both nonblocking commit and atomic fences
- Gustavo seems on a crusade against the non-kms-native version of the
  vblank functions.
- prep work from Boris to nuke all the silly ->best_encoder
  implementations we have (we really only need that for truly dynamic
  cases like dvi-i vs dvi-d or dp mst selecting the right transcoder on
  intel)
- prep work from Laurent to rework the format handling functions
- and few small things all over

* tag 'topic/drm-misc-2016-06-07' of git://anongit.freedesktop.org/drm-intel: (47 commits)
  drm/dsi: Implement set tear scanline
  drm/fb_cma_helper: Implement fb_mmap callback
  drm/qxl: Remove useless drm_fb_get_bpp_depth() call
  drm/ast: Remove useless drm_fb_get_bpp_depth() call
  drm/atomic: Fix remaining places where !funcs->best_encoder is valid
  drm/core: Change declaration for gamma_set.
  Documentation: add fence-array to kernel DocBook
  drm/shmobile: use drm_crtc_vblank_{get,put}()
  drm/radeon: use drm_crtc_vblank_{get,put}()
  drm/qxl: use drm_crtc_vblank_{get,put}()
  drm/atmel: use drm_crtc_vblank_{get,put}()
  drm/armada: use drm_crtc_vblank_{get,put}()
  drm/amdgpu: use drm_crtc_vblank_{get,put}()
  drm/virtio: use drm_crtc_send_vblank_event()
  drm/udl: use drm_crtc_send_vblank_event()
  drm/qxl: use drm_crtc_send_vblank_event()
  drm/atmel: use drm_crtc_send_vblank_event()
  drm/armada: use drm_crtc_send_vblank_event()
  drm/doc: Switch to sphinx/rst fixed-width quoting
  drm/doc: Drop kerneldoc for static functions in drm_irq.c
  ...
2016-06-09 11:19:28 +10:00
Gustavo Padovan 1b47aaf9a9 drm/fence: add fence to drm_pending_event
Now a drm_pending_event can either send a real drm_event or signal a
fence, or both. It allow us to signal via fences when the buffer is
displayed on the screen. Which in turn means that the previous buffer
is not in use anymore and can be freed or sent back to another driver
for processing.

v2: Comments from Daniel Vetter
	- call fence_signal in drm_send_event_locked()
	- remove unneeded !e->event check

v3: Remove drm_pending_event->destroy to fix a leak when e->file_priv
is not set.

Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> (v2)
[danvet: fix one e->destroy in arcpgu due to rebasing.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1464818821-5736-13-git-send-email-daniel.vetter@ffwll.ch
2016-06-03 00:01:59 +02:00
Daniel Vetter 80f67cd80a drm/rockchip: Use cma gem vm ops
No need to reinvent this little wheel.

v2: Like, try to make it compile even.

Cc: Mark Yao <mark.yao@rock-chips.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1464630800-30786-21-git-send-email-daniel.vetter@ffwll.ch
2016-06-01 09:41:46 +02:00
Daniel Vetter c2466ac3d2 drm/rockchip: Use lockless gem BO free callback
No dev->struct_mutex anywhere to be seen.

Cc: Mark Yao <mark.yao@rock-chips.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1464630800-30786-12-git-send-email-daniel.vetter@ffwll.ch
2016-06-01 09:40:52 +02:00
Daniel Vetter fcee59065e drm: Nuke ->vblank_disable_allowed
This was added in

commit 0a3e67a4ca
Author: Jesse Barnes <jbarnes@virtuousgeek.org>
Date:   Tue Sep 30 12:14:26 2008 -0700

    drm: Rework vblank-wait handling to allow interrupt reduction.

to stay backwards-compatible with old UMS code that didn't even tell
the kernel when it did a modeset, so that the kernel could
save/restore vblank counters. At worst this means vblanks will be
somewhat funky on a setup that very likely no one still runs.

So let's just nuke it.

Plan B would be to set it unconditionally in drm_vblank_init for kms
drivers, instead of in each driver separately. So if this patch breaks
anything please only restore the hunks in drmP.h and drm_irq.c, plus
add a check for DRIVER_MODESET in drm_vblank_init.

Stumbled over this in a discussion on irc with Chris.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Eric Anholt <eric@anholt.net>
Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Cc: Inki Dae <inki.dae@samsung.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Mark Yao <mark.yao@rock-chips.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Liviu Dudau <Liviu.Dudau@arm.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-05-21 07:03:31 +10:00
Daniel Vetter 2f701695fd drm: Drop plane argument from __drm_atomic_helper_plane_destroy_state
It's unused, and really this helper should only look at the state
structure and nothing else.

v2: Fix commit message (Laurent).

v3: Rebase onto mtk driver merge.

Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Eric Anholt <eric@anholt.net>
Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Cc: Inki Dae <inki.dae@samsung.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Mark Yao <mark.yao@rock-chips.com>
Acked-by: Thierry Reding <thierry.reding@gmail.com>
Acked-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1462804451-15318-2-git-send-email-daniel.vetter@ffwll.ch
2016-05-17 08:56:55 +02:00
Daniel Vetter ec2dc6a0fe drm: Drop crtc argument from __drm_atomic_helper_crtc_destroy_state
It's unused, and really this helper should only look at the state
structure and nothing else.

v2: Rebase on top of rockchip changes

v3: Drop unrelated hunk, spotted by Laurent.

v4: Rebase onto mtk driver merge.

Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Eric Anholt <eric@anholt.net>
Cc: Mark Yao <mark.yao@rock-chips.com>
Acked-by: Thierry Reding <thierry.reding@gmail.com>
Acked-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1462804451-15318-1-git-send-email-daniel.vetter@ffwll.ch
2016-05-17 08:56:41 +02:00
Chris Wilson a8ad0bd84f drm: Remove unused drm_device from drm_gem_object_lookup()
drm_gem_object_lookup() has never required the drm_device for its file
local translation of the user handle to the GEM object. Let's remove the
unused parameter and save some space.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: dri-devel@lists.freedesktop.org
Cc: Dave Airlie <airlied@redhat.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
[danvet: Fixup kerneldoc too.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-05-17 08:47:30 +02:00
Dave Airlie 21daaeee9f Merge tag 'topic/drm-misc-2016-05-04' of git://anongit.freedesktop.org/drm-intel into drm-next
Ofc I promise just a few leftovers for drm-misc and somehow it's the
biggest pull. But really mostly trivial stuff:
- MAINTAINERS updates from Emil
- rename async to nonblock in atomic_commit to avoid the confusion between
  nonblocking ioctl and async flip (= not vblank synced), from Maarten.
  Needs to be regened with newer drivers, but probably only after -rc1 to
  catch them all.
- actually lockless gem_object_free, plus acked driver conversion patches.
  All the trickier prep stuff already is in drm-next.
- Noralf's nice work for generic defio support in our fbdev emulation.
  Keeps the udl hack, and qxl is tested by Gerd.

* tag 'topic/drm-misc-2016-05-04' of git://anongit.freedesktop.org/drm-intel: (47 commits)
  drm: Fixup locking WARN_ON mistake around gem_object_free_unlocked
  drm/etnaviv: Use lockless gem BO free callback
  drm/imx: Use lockless gem BO free callback
  drm/radeon: Use lockless gem BO free callback
  drm/amdgpu: Use lockless gem BO free callback
  drm/gem: support BO freeing without dev->struct_mutex
  MAINTAINERS: Add myself for the new VC4 (RPi GPU) graphics driver.
  MAINTAINERS: Add a bunch of legacy (UMS) DRM drivers
  MAINTAINERS: Add a few DRM drivers by Dave Airlie
  MAINTAINERS: List the correct git repo for the Renesas DRM drivers
  MAINTAINERS: Update the files list for the Renesas DRM drivers
  MAINTAINERS: Update the files list for the Armada DRM driver
  MAINTAINERS: Update the files list for the Rockchip DRM driver
  MAINTAINERS: Update the files list for the Exynos DRM driver
  MAINTAINERS: Add maintainer entry for the VMWGFX DRM driver
  MAINTAINERS: Add maintainer entry for the MSM DRM driver
  MAINTAINERS: Add maintainer entry for the Nouveau DRM driver
  MAINTAINERS: Update the files list for the Etnaviv DRM driver
  MAINTAINERS: Remove unneded wildcard for the i915 DRM driver
  drm/atomic: Add WARN_ON when state->acquire_ctx is not set.
  ...
2016-05-05 09:56:30 +10:00
Mark Yao 2db00cf5a0 drm/rockchip: vop: Initialize vskiplines to zero
There is a path that use vskiplines with non-initialize.
That would cause vop abnormal behavior.

Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
2016-05-03 14:11:23 +08:00
Mark Yao 44d0237a26 drm/rockchip: vop: fix iommu crash with async atomic
After async atomic_commit callback, drm_atomic_clean_old_fb will
clean all old fb, but because async, the old fb may be also on
the vop hardware, dma will access the old fb buffer, clean old
fb will cause iommu page fault.

Reference the fb and unreference it when the fb actuall swap out
from vop hardware.

Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
2016-05-03 14:11:23 +08:00
Mark Yao 2d90d47743 drm/rockchip: support non-iommu buffer path
Some rockchip vop not support iommu, need use non-iommu
buffer for it. And if we get iommu issues, we can compare
the issues with non-iommu path, that would help the debug.

Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
2016-05-03 14:11:23 +08:00
Mark Yao 4e257d9eee drm/rockchip: get rid of rockchip_drm_crtc_mode_config
We need to take care of the vop status when use
rockchip_drm_crtc_mode_config, if vop is disabled,
the function would failed, that is terrible.

Save output_type and output_mode into rockchip_crtc_state,
it's nice to make them into atomic.

Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
Tested-by: John Keeping <john@metanate.com>
2016-05-03 14:11:23 +08:00
Dan Carpenter 2743becb33 drm/rockchip: inno_hdmi: fix an error code
We were accidentally returning PTR_ERR(NULL) which means success when we
wanted to return a negative error code.

Fixes: 412d4ae6b7 ('drm/rockchip: hdmi: add Innosilicon HDMI support')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Yakir Yang <ykk@rock-chips.com>
2016-05-03 14:11:22 +08:00
John Keeping 69b007968e drm/rockchip: don't leak iommu mapping
arm_iommu_attach_device() takes its own reference to the mapping we give
it.  Since we do not keep a reference to the mapping ourselves, we must
release it before returning.

Also fix the error path, which fails to release the mapping if it has
called arm_iommu_detach_device() since that clears archdata.mapping.

Signed-off-by: John Keeping <john@metanate.com>
2016-05-03 14:11:22 +08:00
John Keeping aa1ac27f48 drm/rockchip: remove redundant statement
The call to arm_iommu_detach_device() on the previous line sets
dev->archdata.mapping to NULL so this call is always a no-op.

Signed-off-by: John Keeping <john@metanate.com>
2016-05-03 14:11:22 +08:00
Maarten Lankhorst 8beafe0254 drm/rockchip: Rename async to nonblock.
The async name is deprecated and should be changed to nonblocking.

Cc: Mark Yao <mark.yao@rock-chips.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-11-git-send-email-maarten.lankhorst@linux.intel.com
2016-05-02 16:38:12 +02:00
Dave Airlie d00b39c175 Merge branch 'drm-next-analogix-dp-v2' of github.com:yakir-Yang/linux into drm-next
This pull request want to land the analogix_dp driver into drm/bridge directory,
which reused the Exynos DP code, and add Rockchip DP support. And those
patches have been:

* 'drm-next-analogix-dp-v2' of github.com:yakir-Yang/linux:
  drm: bridge: analogix/dp: Fix the possible dead lock in bridge disable time
  drm: bridge: analogix/dp: add panel prepare/unprepare in suspend/resume time
  drm: bridge: analogix/dp: add edid modes parse in get_modes method
  drm: bridge: analogix/dp: move hpd detect to connector detect function
  drm: bridge: analogix/dp: try force hpd after plug in lookup failed
  drm: bridge: analogix/dp: add max link rate and lane count limit for RK3288
  drm: bridge: analogix/dp: add some rk3288 special registers setting
  dt-bindings: add document for rockchip variant of analogix_dp
  drm: rockchip: dp: add rockchip platform dp driver
  ARM: dts: exynos/dp: remove some properties that deprecated by analogix_dp driver
  dt-bindings: add document for analogix display port driver
  drm: bridge: analogix/dp: dynamic parse sync_pol & interlace & dynamic_range
  drm: bridge: analogix/dp: remove duplicate configuration of link rate and link count
  drm: bridge: analogix/dp: fix some obvious code style
  drm: bridge: analogix/dp: rename register constants
  drm/exynos: dp: rename implementation specific driver part
  drm: bridge: analogix/dp: split exynos dp driver to bridge directory
2016-04-06 09:57:33 +10:00
Yakir Yang 9e32e16e9e drm: rockchip: dp: add rockchip platform dp driver
Rockchip have three clocks for dp controller, we leave pclk_edp
to analogix_dp driver control, and keep the sclk_edp_24m and
sclk_edp in platform driver.

Acked-by: Mark Yao <mark.yao@rock-chips.com>
Tested-by: Caesar Wang <wxt@rock-chips.com>
Tested-by: Douglas Anderson <dianders@chromium.org>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Yakir Yang <ykk@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
2016-04-05 10:13:04 +08:00
Douglas Anderson 06b898ec84 drm/rockchip: dw_hdmi: Don't call platform_set_drvdata()
The Rockchip dw_hdmi driver just called platform_set_drvdata() to get
your hopes up that maybe, somehow, you'd be able to retrieve the 'struct
rockchip_hdmi' from a pointer to the 'struct device'.  You can't.  When
we call dw_hdmi_bind() the main driver calls dev_set_drvdata(), which
clobbers our setting.

Let's just remove the platform_set_drvdata() to avoid dashing people's
hopes.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
2016-03-28 14:48:32 +08:00
Douglas Anderson 328b51c0f5 drm/rockchip: vop: Fix vop crtc cleanup
This fixes a few problems in the vop crtc cleanup (handling error
paths and cleanup upon exit):

* The vop_create_crtc() error path had an unsafe version of the
  iterator used for iterating over all planes (though it was
  destroying planes in the iterator so should have used the safe
  version)

* vop_destroy_crtc() - wasn't calling vop_plane_destroy(), which made
  slub_debug unhappy, at least if we ended up running this due to a
  deferred probe.

* In vop_create_crtc() if we were missing the "port" device tree node
  we would fail but not return an error (found by code inspection).

Fix these problems.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
2016-03-28 14:48:32 +08:00
Douglas Anderson 948cf42700 drm/rockchip: dw_hdmi: Call drm_encoder_cleanup() in error path
The drm_encoder_cleanup() was missing both from the error path of
dw_hdmi_rockchip_bind().  This caused a crash when slub_debug was
enabled and we ended up deferring probe of HDMI at boot.

This call isn't needed from unbind() because if dw_hdmi_bind() returns
no error then it takes over the job of freeing the encoder (in
dw_hdmi_unbind).

Signed-off-by: Douglas Anderson <dianders@chromium.org>
2016-03-28 14:48:31 +08:00
Tomeu Vizoso 3ed6c64911 drm/rockchip: vop: Disable planes when disabling CRTC
When a VOP is re-enabled, it will start scanning right away the
framebuffers that were configured from the last time, even if those have
been destroyed already.

To prevent the VOP from trying to access freed memory, disable all its
windows when the CRTC is being disabled, then each window will get a
valid framebuffer address before it's enabled again.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Link: http://lkml.kernel.org/g/CAAObsKAv+05ih5U+=4kic_NsjGMhfxYheHR8xXXmacZs+p5SHw@mail.gmail.com
2016-03-28 14:48:30 +08:00
Tomeu Vizoso eac5ad8861 drm/rockchip: vop: Don't reject empty modesets
So that when DRM_IOCTL_MODE_SETCRTC is called without a FB nor mode, the
CRTC gets disabled.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Link: http://lkml.kernel.org/g/CAAObsKAv+05ih5U+=4kic_NsjGMhfxYheHR8xXXmacZs+p5SHw@mail.gmail.com
2016-03-28 14:48:30 +08:00
John Keeping f135046e51 drm/rockchip: cancel pending vblanks on close
When closing the DRM device while a vblank is pending, we access
file_priv after it has been free'd, which gives:

  Unable to handle kernel NULL pointer dereference at virtual address 00000000
  ...
  PC is at __list_add+0x5c/0xe8
  LR is at send_vblank_event+0x54/0x1f0
  ...
  [<c02952e8>] (__list_add) from [<c031a7b4>] (send_vblank_event+0x54/0x1f0)
  [<c031a760>] (send_vblank_event) from [<c031a9c0>] (drm_send_vblank_event+0x70/0x78)
  [<c031a950>] (drm_send_vblank_event) from [<c031a9f8>] (drm_crtc_send_vblank_event+0x30/0x34)
  [<c031a9c8>] (drm_crtc_send_vblank_event) from [<c0339ad8>] (vop_isr+0x224/0x28c)
  [<c03398b4>] (vop_isr) from [<c0081780>] (handle_irq_event_percpu+0x12c/0x3e4)

This can be triggered somewhat reliably with:

	modetest -M rockchip -v -s ...

Add a preclose hook to the driver so that we can discard any pending
vblank events when the device is closed.

Signed-off-by: John Keeping <john@metanate.com>
2016-03-28 14:48:29 +08:00
John Keeping 92915da647 drm/rockchip: vop: fix crtc size in plane check
If the geometry of a crtc is changing in an atomic update then we must
validate the plane size against the new state of the crtc and not the
current size, otherwise if the crtc size is increasing the plane will be
cropped at the previous size and will not fill the screen.

Signed-off-by: John Keeping <john@metanate.com>
2016-03-28 14:48:29 +08:00
Dave Airlie 42e8560678 imx-drm vblank IRQ control, fence support, and of endpoint helpers
- Add and make use of drm_of_active_endpoint helpers
 - Silence a noisy dev_info into a dev_dbg
 - Stop touching primary fb on pageflips
 - Track flip state explicitly
 - Keep GEM buffer objects referenced while scanout is active
 - Implement fence sync by deferring flips to a workqueue for
   dma-bufs with pending fences
 - Actually disable vblank IRQs while they are not needed
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJW1UXsAAoJEFDCiBxwnmDrcLAP/RSK97JkP35sgPT4+YCuGtsD
 ToXzJaJnKwSMaXQif1IN7xwcX+sYhhivzTYVM5Cj9/CGwAME9fkqirFxC4ZZ4b5B
 0tx/XcRWoyl7zuxTpAPTFxtr7aDQ5cQ2gHMjqasNDXtvQS3h+vjmYuRfNI2PmdLO
 9Bnj7zrun3kW3V05RE2W+3VsFZALQ64tMAuZPnTEI8/F/DH4lyH7q6V9d+jBZiR6
 rYRw4jWn5J37xu84jhjYxISokBB46Ldb1ccLQ9910Whuj6vVnvSd0mufL+MLPYot
 /ZSlcNrjIN6QmeHxWcO17MogW3l94Yp5xvRih9hjO9wc/tgoWNkOw7wcnvE7GW3z
 P5YzlDgRy/MrIxsqIjSTu9yzv6GjDpZCqu/qib9TKWTcsnvz1O23r3Q/CjmILwdk
 Tb0DBHZL2RM01YgunAcuvUQmKoz4MwAk0nqhKGJzkHUUQoXDyk+EJTVFw5liOoOP
 Qb8enNfGhoLVLCKM1sdX5hdrc2WGOiZSXQWK6rsFfK5vuuTFOQC84nH/jj5LasEk
 x07tXnwHEUFEOCLNPjPRrvv6K1juB3n5wmwnmCiaNlnp2alIjRb0ZBGH95egKrGL
 vKuBzwz/FfR2uUDM/fiblwaGV8htmZ0cCWoKckOmyZvTWA/96qEVbvcgOoHDMN6R
 lsv2qUwrkhMQOE9Nr90a
 =ufbY
 -----END PGP SIGNATURE-----

Merge tag 'imx-drm-next-20160301' of git://git.pengutronix.de/git/pza/linux into drm-next

imx-drm vblank IRQ control, fence support, and of endpoint helpers

- Add and make use of drm_of_active_endpoint helpers
- Silence a noisy dev_info into a dev_dbg
- Stop touching primary fb on pageflips
- Track flip state explicitly
- Keep GEM buffer objects referenced while scanout is active
- Implement fence sync by deferring flips to a workqueue for
  dma-bufs with pending fences
- Actually disable vblank IRQs while they are not needed

* tag 'imx-drm-next-20160301' of git://git.pengutronix.de/git/pza/linux:
  drm/imx: only enable vblank IRQs when needed
  drm/imx: implement fence sync
  drm/imx: keep GEM object referenced as long as scanout is active
  drm/imx: track flip state explicitly
  drm/imx: don't touch primary fb on pageflip
  drm/imx: ipuv3 plane: Replace dev_info with dev_dbg if a plane's CRTC changes
  gpu: ipu-v3: ipu-dc: Simplify display controller microcode setup
  drm/rockchip: remove rockchip_drm_encoder_get_mux_id
  drm/imx: remove imx_drm_encoder_get_mux_id
  drm: add drm_of_encoder_active_endpoint helpers
2016-03-02 17:52:51 +10:00
Philipp Zabel 1645061679 drm/rockchip: remove rockchip_drm_encoder_get_mux_id
It is replaced by drm_of_encoder_active_endpoint_id.

Suggested-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Yakir Yang <ykk@rock-chips.com>
[for dw_hdmi-rockchip]
Acked-by: Mark Yao <mark.yao@rock-chips.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2016-03-01 08:33:38 +01:00
Dave Airlie d2eaa59000 Merge branch 'drm-rockchip-next-2016-02-18' of https://github.com/markyzq/kernel-drm-rockchip into drm-next
add Innosilicon HDMI support.

* 'drm-rockchip-next-2016-02-18' of https://github.com/markyzq/kernel-drm-rockchip:
  dt-bindings: add document for Innosilicon HDMI on Rockchip platform
  drm/rockchip: hdmi: add Innosilicon HDMI support
2016-02-19 13:10:18 +10:00
Yakir Yang 412d4ae6b7 drm/rockchip: hdmi: add Innosilicon HDMI support
The Innosilicon HDMI is a low power HDMI 1.4 transmitter
IP, and it have been integrated on some rockchip CPUs
(like RK3036, RK312x).

Signed-off-by: Yakir Yang <ykk@rock-chips.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
2016-02-18 13:56:43 +08:00
Carlos Palminha bb83804843 drm/rockchip: removed optional dummy encoder mode_fixup function.
mode_fixup function for encoder drivers became optional with patch
http://patchwork.freedesktop.org/patch/msgid/1455106522-32307-1-git-send-email-palminha@synopsys.com

This patch set nukes all the dummy mode_fixup implementations.

(made on top of Daniel topic/drm-misc branch)

Signed-off-by: Carlos Palminha <palminha@synopsys.com>
Acked-by: Mark Yao <mark.yao@rock-chips.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/cae559aa2c04a906c21ed5ebe4861f92440e6910.1455540137.git.palminha@synopsys.com
2016-02-16 15:34:07 +01:00
John Keeping f0442df215 drm/rockchip: respect CONFIG_DRM_FBDEV_EMULATION
If DRM_FBDEV_EMULATION is not selected in the config then we can save a
bit of space by not including the framebuffer code.

Signed-off-by: John Keeping <john@metanate.com>
2016-01-22 08:45:31 +08:00
Mark Yao e3c4abdb3b drm/rockchip: fix wrong pitch/size using on gem
args->pitch and args->size may not be set by userspace, sometimes
userspace only malloc args and not memset args to zero, then
args->pitch and args->size is random, it is very danger to use
pitch/size on gem.

pitch's type is u32, and min_pitch's type is int, example,
pitch is 0xffffffff, then pitch < min_pitch return true, then gem will
alloc very very big bufffer, it would eat all the memory and cause kernel
crash.

Stop using pitch/size from args, calc them from other args.

Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
2016-01-21 09:14:05 +08:00
John Keeping c9ad1d9946 drm/rockchip: explain why we can't wait_for_vblanks
Signed-off-by: John Keeping <john@metanate.com>
2016-01-20 08:56:06 +08:00
John Keeping f2227f4697 drm/rockchip: don't wait for vblank if fb hasn't changed
As commented in drm_atomic_helper_wait_for_vblanks(), userspace relies
on cursor ioctls being unsynced.  Converting the rockchip driver to
atomic has significantly impacted cursor performance by making every
cursor update wait for vblank.

By skipping the vblank sync when the framebuffer has not changed (as is
done in drm_atomic_helper_wait_for_vblanks()) we can avoid this for the
common case of moving the cursor and only need to delay the cursor ioctl
when the cursor icon changes.

We cannot add the check on legacy_cursor_update since that results in
the cursor bo being unreferenced while the hardware may still be reading
it.  Fully supporting unsynced cursor updates is left for the future
when the atomic helper framework supports async updates.

Signed-off-by: John Keeping <john@metanate.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
2016-01-20 08:55:56 +08:00
Andrzej Hajda 484bb6c969 drm/rockchip/dsi: fix handling mipi_dsi_pixel_format_to_bpp result
The function can return negative value so it should be assigned to signed
variable.

The problem has been detected using patch
scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Reviewed-by: Chris Zhong <zyw@rock-chips.com>
2016-01-18 08:43:16 +08:00
John Keeping c7647f8681 drm/rockchip: vop: fix mask when updating interrupts
Commit dbb3d94 (drm/rockchip: vop: move interrupt registers into
vop_data) introduced new macros for updating the interrupt control
registers but these always use the mask from the register definition
without refining it for the particular bits that are being changed.

This means that whenever we enable/disable a particular interrupt we end
up disabling all of the others as a side effect.

Signed-off-by: John Keeping <john@metanate.com>
2016-01-18 08:42:09 +08:00
Mark Yao 63087aae5a drm/rockchip: cleanup unnecessary export symbol
Now rockchip_drm_vop.c is build into rockchipdrm.ko, so
no need to export following symbol anymore:
    rockchip_drm_dma_attach_device
    rockchip_drm_dma_detach_device
    rockchip_drm_dma_attach_device
    rockchip_drm_dma_detach_device
    rockchip_register_crtc_funcs
    rockchip_unregister_crtc_funcs
    rockchip_fb_get_gem_obj

Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
2016-01-18 08:42:09 +08:00
Mark Yao ce90d092bc drm/rockchip: Don't build rockchip_drm_vop as modules
rockchip_drm_vop's module init had moved to rockchip_vop_reg.c
so no need to build rockchip_drm_vop.ko

Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
2016-01-18 08:42:08 +08:00
Chris Zhong 84e05408fc drm: rockchip: Support Synopsys DW MIPI DSI
Add support for Synopsys DesignWare MIPI DSI controller which is
embedded in the rk3288 SoCs.

Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Acked-by: Mark Yao <mark.yao@rock-chips.com>
2016-01-06 16:16:39 +08:00
Chris Zhong b59b8de314 drm/rockchip: return a true clock rate to adjusted_mode
Since the mipi dsi driver need to use the clock of vop to make the
calculation of Blanking. But sometimes the clock driver can not set a
accurate clock_rate for vop, get it by clk_round_rate before mode_set,
so we can get the true value.

Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Acked-by: Mark Yao <mark.yao@rock-chips.com>
2016-01-06 13:51:09 +08:00
Stephen Rothwell 54255e818e drm/rockchip: vop: export vop_component_ops to modules
Fixes: a67719d182 ("drm/rockchip: vop: spilt register related into rockchip_reg_vop.c")
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Acked-by: Mark Yao <mark.yao@rock-chips.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-31 17:42:18 +10:00
Mark Yao f767345350 drm/rockchip: vop: add rk3036 vop support
RK3036 registers layout is quite difference with rk3288 layout,
The IC design with different framework, rk3036 vop is VOP LITE,
and rk3288 is VOP FULL.

RK3036 support two overlay plane and one hwc plane, max output
resolution is 1080p. it support IOMMU, and its IOMMU same as
rk3288's.

Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
2015-12-28 09:01:48 +08:00
Mark Yao 1194fffbb1 drm/rockchip: vop: spilt scale regsters
There are two version scale control register found on vop,
scale full version found on rk3288, support extension registers.
and scale little version found on rk3036, only support common scale.

Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
2015-12-28 09:01:41 +08:00
Mark Yao a67719d182 drm/rockchip: vop: spilt register related into rockchip_reg_vop.c
No functional updates. Spilt register related into another file
would be nice to multi vop driver,

Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
2015-12-28 09:01:34 +08:00
Mark Yao dbb3d94444 drm/rockchip: vop: move interrupt registers into vop_data
Move interrupt registers into vop_data, so it can use at multi-vop driver

Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
2015-12-28 09:01:28 +08:00
Mark Yao 0cf33fe33d drm/rockchip: vop: merge vop cfg_done into vop_data
Move cfg_done register into vop_data, so it can use at multi-vop driver

Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
2015-12-28 09:01:21 +08:00
Mark Yao a8eef71d38 drm/rockchip: dw_hdmi: use encoder enable function
encoder.enable is more compatible to atomic api than encoder.prepare/commit

Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
2015-12-28 08:57:16 +08:00
Mark Yao d0e20d0ebf drm/rockchip: direct config connecter gate and out_mode
Both connecter gate and out_mode are not conflict with mode set
configure. Direct setting connecter gate and out_mode, that allow
connector do rockchip_drm_crtc_mode_config after mode set.

Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
2015-12-28 08:50:02 +08:00
Mark Yao f32fad51ee drm/rockchip: support atomic asynchronous commit
If drm core requests a async commit, rockchip_drm_atomic_commit
will schedule a work task to update later.

Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
2015-12-28 08:49:54 +08:00
Mark Yao ce3887ed0d drm/rockchip: Optimization vop mode set
Rk3288 vop timing registers is immediately register, when configure
timing on display active time, will cause tearing. use dclk reset is
not a good idea to avoid this tearing. we can avoid tearing by using
standby register.

Vop standby register will take effect at end of current frame, and
go back to work immediately when exit standby.

So we can use standby register to protect this context.

Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
2015-12-28 08:49:48 +08:00
Mark Yao 63ebb9fa7f drm/rockchip: Convert to support atomic API
Rockchip vop not support hw vblank counter, needed check the committed
register if it's really take effect.

Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
2015-12-28 08:49:39 +08:00
Mark Yao 0ad3675d9c drm/rockchip: vop: replace dpms with enable/disable
For vop, power by enable/disable is more suitable then legacy dpms
function, and enable/disable more closely to the new atomic API.

Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
2015-12-28 08:49:32 +08:00
Mark Yao b5f7b75503 drm/rockchip: Use new vblank api drm_crtc_vblank_*
No functional update, drm_vblank_* is the legacy version of
drm_crtc_vblank_*. and use new api make driver more clean.

Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
2015-12-28 08:49:24 +08:00
Nicolas Iooss e112e593b2 drm: use dev_name as default unique name in drm_dev_alloc()
The following code pattern exists in some DRM drivers:

    ddev = drm_dev_alloc(&driver, parent_dev);
    drm_dev_set_unique(ddev, dev_name(parent_dev));

(Sometimes dev_name(ddev->dev) is used, which is the same.)

As suggested in
http://lists.freedesktop.org/archives/dri-devel/2015-December/096441.html,
the unique name of a new DRM device can be set as dev_name(parent_dev)
when parent_dev is not NULL (vgem is a special case).

Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-12-15 13:56:06 +01:00
Nicolas Iooss 399368aab3 drm: make drm_dev_set_unique() not use a format string
drm_dev_set_unique() uses a format string to define the unique name of a
device.  This feature is not used as currently all the calls to this
function either use "%s" as a format string or directly use
dev_name().

Even though this second kind of call does not introduce security
problems, because there cannot be "%" characters in dev_name() results,
gcc issues a warning when building with -Wformat-security flag
("warning: format string is not a string literal (potentially
insecure)").  This warning is useful to find real bugs like the one
fixed by commit 3958b79266 ("configfs: fix kernel infoleak through
user-controlled format string").  False positives which do not bring
an extra value make the work of finding real bugs harder.

Therefore remove the format-string feature from drm_dev_set_unique().

Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1449829228-4425-1-git-send-email-nicolas.iooss_linux@m4x.org
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-12-15 13:52:38 +01:00
Ville Syrjälä 28c508ece6 drm/rockchip: Constify function pointer structs
Moves a bunch of junk to .rodata from .data.

 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.ko:
-.rodata                      772
+.rodata                      828
-.data                        148
+.data                         92

 drivers/gpu/drm/rockchip/rockchipdrm.ko:
-.rodata                      748
+.rodata                      760
-.data                        448
+.data                        436

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1450178476-26284-25-git-send-email-boris.brezillon@free-electrons.com
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-12-15 13:48:19 +01:00
Ville Syrjälä 13a3d91f17 drm: Pass 'name' to drm_encoder_init()
Done with coccinelle for the most part. However, it thinks '...' is
part of the semantic patch, so I put an 'int DOTDOTDOT' placeholder
in its place and got rid of it with sed afterwards.

@@
identifier dev, encoder, funcs;
@@
 int drm_encoder_init(struct drm_device *dev,
                      struct drm_encoder *encoder,
                      const struct drm_encoder_funcs *funcs,
                      int encoder_type
+                     ,const char *name, int DOTDOTDOT
                      )
{ ... }

@@
identifier dev, encoder, funcs;
@@
 int drm_encoder_init(struct drm_device *dev,
                      struct drm_encoder *encoder,
                      const struct drm_encoder_funcs *funcs,
                      int encoder_type
+                     ,const char *name, int DOTDOTDOT
                      );

@@
expression E1, E2, E3, E4;
@@
 drm_encoder_init(E1, E2, E3, E4
+                 ,NULL
                  )

v2: Add ', or NULL...' to @name kernel doc (Jani)
    Annotate the function with __printf() attribute (Jani)

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1449670818-2966-1-git-send-email-ville.syrjala@linux.intel.com
2015-12-11 09:13:20 +01:00
Ville Syrjälä b0b3b79511 drm: Pass 'name' to drm_universal_plane_init()
Done with coccinelle for the most part. It choked on
msm/mdp/mdp5/mdp5_plane.c like so:
"BAD:!!!!!  enum drm_plane_type type;"
No idea how to deal with that, so I just fixed that up
by hand.

Also it thinks '...' is part of the semantic patch, so I put an
'int DOTDOTDOT' placeholder in its place and got rid of it with
sed afterwards.

I didn't convert drm_plane_init() since passing the varargs through
would mean either cpp macros or va_list, and I figured we don't
care about these legacy functions enough to warrant the extra pain.

@@
typedef uint32_t;
identifier dev, plane, possible_crtcs, funcs, formats, format_count, type;
@@
 int drm_universal_plane_init(struct drm_device *dev,
                              struct drm_plane *plane,
                              unsigned long possible_crtcs,
                              const struct drm_plane_funcs *funcs,
                              const uint32_t *formats,
                              unsigned int format_count,
                              enum drm_plane_type type
+                             ,const char *name, int DOTDOTDOT
                              )
{ ... }

@@
identifier dev, plane, possible_crtcs, funcs, formats, format_count, type;
@@
 int drm_universal_plane_init(struct drm_device *dev,
                              struct drm_plane *plane,
                              unsigned long possible_crtcs,
                              const struct drm_plane_funcs *funcs,
                              const uint32_t *formats,
                              unsigned int format_count,
                              enum drm_plane_type type
+                             ,const char *name, int DOTDOTDOT
                              );

@@
expression E1, E2, E3, E4, E5, E6, E7;
@@
 drm_universal_plane_init(E1, E2, E3, E4, E5, E6, E7
+                         ,NULL
                          )

v2: Split crtc and plane changes apart
    Pass NUL for no-name instead of ""
    Leave drm_plane_init() alone
v3: Add ', or NULL...' to @name kernel doc (Jani)
    Annotate the function with __printf() attribute (Jani)

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1449670795-2853-1-git-send-email-ville.syrjala@linux.intel.com
2015-12-11 09:13:10 +01:00
Ville Syrjälä f98828769c drm: Pass 'name' to drm_crtc_init_with_planes()
Done with coccinelle for the most part. However, it thinks '...' is
part of the semantic patch, so I put an 'int DOTDOTDOT' placeholder
in its place and got rid of it with sed afterwards.

I didn't convert drm_crtc_init() since passing the varargs through
would mean either cpp macros or va_list, and I figured we don't
care about these legacy functions enough to warrant the extra pain.

@@
identifier dev, crtc, primary, cursor, funcs;
@@
 int drm_crtc_init_with_planes(struct drm_device *dev,
                               struct drm_crtc *crtc,
                               struct drm_plane *primary, struct drm_plane *cursor,
                               const struct drm_crtc_funcs *funcs
+                              ,const char *name, int DOTDOTDOT
                               )
{ ... }

@@
identifier dev, crtc, primary, cursor, funcs;
@@
 int drm_crtc_init_with_planes(struct drm_device *dev,
                               struct drm_crtc *crtc,
                               struct drm_plane *primary, struct drm_plane *cursor,
                               const struct drm_crtc_funcs *funcs
+                              ,const char *name, int DOTDOTDOT
                               );

@@
expression E1, E2, E3, E4, E5;
@@
 drm_crtc_init_with_planes(E1, E2, E3, E4, E5
+                          ,NULL
                           )

v2: Split crtc and plane changes apart
    Pass NULL for no-name instead of ""
    Leave drm_crtc_init() alone
v3: Add ', or NULL...' to @name kernel doc (Jani)
    Annotate the function with __printf() attribute (Jani)

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1449670771-2751-1-git-send-email-ville.syrjala@linux.intel.com
2015-12-11 09:12:44 +01:00
Dave Airlie e876b41ab0 Linux 4.4-rc4
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJWZMgaAAoJEHm+PkMAQRiGGcIH+gNS/hbN2DKW7wphl1QuaV7C
 1fror8AvpwbGa/o0yuxovaVuZzAR0TF31vn+gAemF4U/hnM25xqxEHXYZEVv8OWw
 mbz4/z+jbVk3SiS5AiZPIZgL4W6RZnG5QYfiTVGPlBHuBznW2ITlNlClBOmBL45o
 uhb3bjTzi70AZ7Gh6i9sHgJoHg6D9u/ZxLaLcWnM79BzyTMHTf2t0wnrQmh66lEE
 hp7Rn9wXv9bk/e3iH7CVUb97P4IWhhkmfqcoturqAg9+C/M26b0VmvQp9Sy8S6Pd
 FVQ+SUIZllj5ZDKe9mOcs37czlxTr0keEFqzWeMh/7y4iuI3RaRp/qb+7mX5sIE=
 =WGZ1
 -----END PGP SIGNATURE-----

Back merge tag 'v4.4-rc4' into drm-next

We've picked up a few conflicts and it would be nice
to resolve them before we move onwards.
2015-12-08 11:04:26 +10:00
Daniel Stone c9fbb7f7b5 drm/rockchip: Use CRTC vblank event interface
Passing -1 as the pipe for vblank events now triggers a WARN_ON, but had
previously made multi-screen unusable anyway. Pass the correct pipe to
the event-send function, and use the new API to make this a bit easier
for us.

Fixes WARN present since cc1ef118fc for every pageflip event sent:
[  209.549969] ------------[ cut here ]------------
[  209.554592] WARNING: CPU: 3 PID: 238 at drivers/gpu/drm/drm_irq.c:924 drm_vblank_count_and_time+0x80/0x88 [drm]()
[  209.564832] Modules linked in: [...]
[  209.612401] CPU: 3 PID: 238 Comm: irq/41-ff940000 Tainted: G        W       4.3.0-rc6+ #71
[  209.620647] Hardware name: Rockchip (Device Tree)
[  209.625348] [<c001bb80>] (unwind_backtrace) from [<c001615c>] (show_stack+0x20/0x24)
[  209.633079] [<c001615c>] (show_stack) from [<c02b2c50>] (dump_stack+0x8c/0x9c)
[  209.640289] [<c02b2c50>] (dump_stack) from [<c0052e88>] (warn_slowpath_common+0x94/0xc4)
[  209.648364] [<c0052e88>] (warn_slowpath_common) from [<c0052f74>] (warn_slowpath_null+0x2c/0x34)
[  209.657139] [<c0052f74>] (warn_slowpath_null) from [<bf17dc30>] (drm_vblank_count_and_time+0x80/0x88 [drm])
[  209.666875] [<bf17dc30>] (drm_vblank_count_and_time [drm]) from [<bf17e484>] (drm_send_vblank_event+0x74/0x7c [drm])
[  209.677385] [<bf17e484>] (drm_send_vblank_event [drm]) from [<bf4c1144>] (vop_win_state_complete+0x4c/0x70 [rockchip_drm_vop])
[  209.688757] [<bf4c1144>] (vop_win_state_complete [rockchip_drm_vop]) from [<bf4c3bdc>] (vop_isr_thread+0x170/0x1d4 [rockchip_drm_vop])
[  209.700822] [<bf4c3bdc>] (vop_isr_thread [rockchip_drm_vop]) from [<c00ab93c>] (irq_thread_fn+0x2c/0x50)
[  209.710284] [<c00ab93c>] (irq_thread_fn) from [<c00abcac>] (irq_thread+0x13c/0x188)
[  209.717927] [<c00abcac>] (irq_thread) from [<c00723c8>] (kthread+0xec/0x104)
[  209.724965] [<c00723c8>] (kthread) from [<c0011638>] (ret_from_fork+0x14/0x3c)
[  209.732171] ---[ end trace 0690bc604f5d535d ]---

Signed-off-by: Daniel Stone <daniels@collabora.com>
Cc: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Cc: Thierry Reding <treding@nvidia.com>
Cc: Heiko Stuebner <heiko@sntech.de>
Tested-By: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Thierry Reding <treding@nvidia.com>
2015-12-02 10:22:21 +08:00
Luis de Bethencourt 3b134ced9c drm/rockchip: Fix module autoload for OF platform driver
This platform driver has a OF device ID table but the OF module
alias information is not created so module autoloading won't work.

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
2015-12-02 09:13:19 +08:00
Dominik Behr 72906ce030 drm/rockchip: vop: fix window origin calculation
VOP_WINx_DSP_ST does not require subtracting 1 from the values written to
it. It actually causes the screen to be shifted by one pixel.

Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
Tested-by: Yakir Yang <ykk@rock-chips.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Dominik Behr <dbehr@chromium.org>
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
2015-12-02 09:13:18 +08:00
Heiko Stuebner a8594f20ca drm/rockchip: unset pgoff when mmap'ing gems
Commit 371f0f085f ("ARM: 8426/1: dma-mapping: add missing range check
 in dma_mmap()") introduced offset-checking for mappings, which collides
with the fake-offset the drm sets for gems.

Other drm-drivers set this offset to 0 before doing the mapping, so
this looks like the correct way to go for rockchip as well.

Fixes: 371f0f085f ("ARM: 8426/1: dma-mapping: add missing range check in dma_mmap()")
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
2015-12-02 09:13:17 +08:00
Sjoerd Simons d7b53fd9e3 drm/rockchip: vop: Correct enabled clocks during setup
When doing the initial setup both the hclk and the aclk need to be
enabled otherwise the board will simply hang. This only occurs when
building the vop driver as a module, when its built-in the initial setup
happens to run before the clock framework shuts of unused clocks
(including the aclk).

While there also switch to doing prepare and enable in one step rather
then separate steps to reduce the amount of code required.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Acked-by: Mark Yao <mark.yao@rock-chips.com>
Tested-by: Yakir Yang <ykk@rock-chips.com>
Tested-by: Romain Perier <romain.perier@gmail.com>
2015-12-01 18:52:05 +08:00
Ville Syrjälä 1eb83451ba drm: Pass the user drm_mode_fb_cmd2 as const to .fb_create()
Drivers shouldn't clobber the passed in addfb ioctl parameters.
i915 was doing just that. To prevent it from happening again,
pass the struct around as const, starting all the way from
internal_framebuffer_create().

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-11-24 11:47:38 +01:00
Mark Yao 5bad7d29a7 Revert "drm/rockchip: Convert the probe function to the generic drm_of_component_probe()"
This reverts commit 52f5eb6094.

Rockchip drm can't work with generic drm_of_component_probe now

Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
Acked-by: Liviu Dudau <Liviu.Dudau@arm.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-11-13 09:59:46 +10:00
Liviu Dudau 52f5eb6094 drm/rockchip: Convert the probe function to the generic drm_of_component_probe()
Use the generic drm_of_component_probe() function to probe for components.

Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1445332995-11212-4-git-send-email-Liviu.Dudau@arm.com
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-10-20 12:01:30 +02:00
Daniel Vetter 4e270f0880 drm/gem: Drop struct_mutex requirement from drm_gem_mmap_obj
Since

commit 131e663bd6
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Thu Jul 9 23:32:33 2015 +0200

    drm/gem: rip out drm vma accounting for gem mmaps

there is no need for this any more.

v2: Fixup compile noise spotted by 0-day build.

Link: http://mid.gmane.org/1444894601-5200-9-git-send-email-daniel.vetter@ffwll.ch
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2015-10-16 15:51:00 +02:00