1
0
Fork 0
Commit Graph

136 Commits (d5d0804f8f6d0c89913f6a2de5348adef8ec33e4)

Author SHA1 Message Date
Jyri Sarha e0e344e620 drm/tilcdc: Change tilcdc_crtc_page_flip() to tilcdc_crtc_update_fb()
Change tilcdc_crtc_page_flip() to tilcdc_crtc_update_fb(). The
function is not used as a page_flip() callback anymore so it is only
confusing to call it that. The function should only be used by dummy
primary plane commit() callback.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
2016-08-08 23:05:19 +03:00
Jyri Sarha d81b7f3403 drm/tilcdc: Remove unnecessary pm_runtime_get() and *_put() calls
Remove unnecessary pm_runtime_get() and *_put() calls from commit
phase callbacks. Those calls are not needed since we have the whole
commit phase between pm_runtime_get_sync() and pm_runtime_put_sync().

Signed-off-by: Jyri Sarha <jsarha@ti.com>
2016-08-08 23:05:18 +03:00
Jyri Sarha 47bfd6c01e drm/tilcdc: Get rid of legacy dpms mechanism
Get rid of legacy dpms mechanism. This simplifies the code quite a
bit. The old start() and stop() functions become tilcdc_crtc_enable()
and *_disable(). The functions are added with all the necessary
mechanisms from the old dpms function and they are used directly as
the crtc helper enable() and disable() callbacks.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
2016-08-08 23:05:17 +03:00
Jyri Sarha 514d1a1f47 drm/tilcdc: Use drm_atomic_helper_resume/suspend()
Use drm_atomic_helper_resume/suspend() and get rid off all the obsolete
register level context restoring code.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
2016-08-08 23:05:16 +03:00
Jyri Sarha afaf833dd5 drm/tilcdc: Enable and disable interrupts in crtc start() and stop()
Enable and disable interrupts in crtc start() and stop(). None of the
interrupts can fire if CRTC is disabled, so it is cleaner - when
considering suspend/resume code etc. - to enable the interrupts when
CRTC is turned on and to disable them when CRTC is turned off.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
2016-08-08 23:05:15 +03:00
Jyri Sarha 018cfbde63 drm/tilcdc: tfp410: Add atomic modeset helpers to connector funcs
Add atomic modeset helpers to tfp410 connector funcs. Property handling
related helpers, atomic reset helper, and new dpms helper is needed in
connector for atomic modeseting to work. The default helper functions
are enough.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
2016-08-08 23:05:13 +03:00
Jyri Sarha 7c979b5518 drm/tilcdc: tfp410: Set crtc panel info at init phase
Set crtc panel info at init phase. Setting it at prepare callback does
it multiple times for no good reason and it is also too late when atomic
modeset is used.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
2016-08-08 23:05:12 +03:00
Jyri Sarha 0f65d89b9a drm/tilcdc: panel: Add atomic modeset helpers to connector funcs
Add atomic modeset helpers to panel connector funcs. Property handling
related helpers, atomic reset helper, and new dpms helper is needed in
connector for atomic modeseting to work. The default helper functions
are enough.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
2016-08-08 23:05:11 +03:00
Jyri Sarha ee6de21b69 drm/tilcdc: panel: Set crtc panel info at init phase
Set crtc panel info at init phase. Setting it at prepare callback does
it multiple times for no good reason and it is also too late when atomic
modeset is used.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
2016-08-08 23:05:10 +03:00
Jyri Sarha c72cc66364 drm/tilcdc: Remove tilcdc_verify_fb()
Remove tilcdc_verify_fb(). The tilcdc_verify_fb() function is not
needed because the same checks are implemented in
tilcdc_plane_atomic_check().

Signed-off-by: Jyri Sarha <jsarha@ti.com>
2016-08-08 23:05:09 +03:00
Jyri Sarha 6b4736db9c drm/tilcdc: Remove obsolete crtc helper functions
Remove obsolete crtc helper functions. These are not needed when
atomic modeset is used.

Note that the drm_crtc_helper_funcs mode_fixup() is still needed. The
crtc's check() callback can not do its job here.

The plane's check() callback needs to set drm_crtc_state's
->mode_changed to true if the pixel format for the framebuffer
changes. Because of this drm_mode_config_funcs atomic_check() callback
needs to call drm_atomic_helper_check_modeset() once more after it has
called drm_atomic_helper_check_planes(). If the fixing of the
adjusted_mode would be done in drm_crtc_helper_funcs atomic_check()
callback, it would get over written by the extra
drm_atomic_helper_check_modeset() call.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
2016-08-08 23:05:08 +03:00
Jyri Sarha 305198de89 drm/tilcdc: Set DRIVER_ATOMIC and use atomic crtc helpers
Set DRIVER_ATOMIC and use atomic helpers and rename commit and prepare
crtc helpers to enable and disable. This makes the final jump to mode
setting, but there is lot of obsolete code to clean up.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
2016-08-08 23:05:07 +03:00
Jyri Sarha 522a76f895 drm/tilcdc: Add drm_mode_config_reset() call to tilcdc_load()
Add drm_mode_config_reset() call to tilcdc_load(). This is need to
initialize atomic state variables at load time.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
2016-08-08 23:05:06 +03:00
Jyri Sarha edc4330388 drm/tilcdc: Add atomic mode config funcs
Add atomic mode config funcs. The atomic_commit implementation is a
copy-paste from drm_atomic_helper_commit(), leaving out the async
test. The similar copy-paste implementation appears to be used in many
other drivers too. The standard drm_atomic_helper_check() is used for
checking.

The drm_atomic_helper_check() can not be used in drm_mode_config_funcs
atomic_check() callback because the plane's check implementation may
update crtc state's ->mode_changed flag. Because of this the
drm_atomic_helper_check_modeset() has to be called once more after
drm_atomic_helper_check_planes() (see drm_atomic_helper_check_modeset()
documentation).

Signed-off-by: Jyri Sarha <jsarha@ti.com>
2016-08-08 23:05:05 +03:00
Jyri Sarha db380c58b7 drm/tilcdc: Add tilcdc_crtc_atomic_check()
Add tilcdc_crtc_atomic_check(). Checks the display mode validity and
the presence of the mandatory primary plane.

The drm_crtc_helper_funcs mode_fixup() callback is left untouched and
the check function does no try to do its job on purpose, despite what
the mode_fixup() callback's documentations suggests.

The plane's check() callback needs to set drm_crtc_state's
->mode_changed to true if the pixel format for the framebuffer
changes. Because of this drm_mode_config_funcs atomic_check() callback
needs to call drm_atomic_helper_check_modeset() once more after it has
called drm_atomic_helper_check_planes(). If the fixing of the
adjusted_mode would be done in drm_crtc_helper_funcs atomic_check()
callback, it would get over written by the extra
drm_atomic_helper_check_modeset() call.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
2016-08-08 23:05:04 +03:00
Jyri Sarha f6382f186d drm/tilcdc: Add tilcdc_crtc_mode_set_nofb()
Add tilcdc_crtc_mode_set_nofb(). The mode_set_nofb() semantics do not
fit well to LCDC, because of the mandatory framebuffer. However, when
the primary plane is required in the check phase, it and the
framebuffer can be found from the atomic state struct.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
2016-08-08 23:05:02 +03:00
Jyri Sarha 47f571c6e5 drm/tilcdc: Initialize dummy primary plane from crtc init
Initialize dummy primary plane from crtc init.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
2016-08-08 23:05:01 +03:00
Jyri Sarha b961c48b05 drm/tilcdc: Add dummy primary plane implementation
Add dummy primary plane implementation. LCDC does not really have
planes, only simple framebuffer that is mandatory. This primary plane
implementation has the necessary checks for implementing simple
framebuffer trough DRM plane abstraction. For setting the actual
framebuffer the implementation relies on a CRTC side function.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
2016-08-08 23:05:00 +03:00
Jyri Sarha 0a1fe1b7c5 drm/tilcdc: Make tilcdc_crtc_page_flip() work if crtc is not yet on
Make tilcdc_crtc_page_flip() work if crtc is not yet on. The plane
commit sometimes comes before crtc is turned on. The new framebuffer
should be set to scanout also in that case, so that it is there when
crtc is turned on at the end of the commit phase.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
2016-08-08 23:04:59 +03:00
Jyri Sarha 8c65abb914 drm/tilcdc: Make tilcdc_crtc_page_flip() public
Make tilcdc_crtc_page_flip() public for dummy plane implementation to use.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
2016-08-08 23:04:58 +03:00
Jyri Sarha 20a98acba5 drm/tilcdc: Fix tilcdc component master unloading
Fix tilcdc component master unloading. If a subcomponent module
(tda998x in this case) is unloaded before its master (tilcdc in this
case), it calls drm_put_dev() and it should not be called again by
the master when its module is unloaded. However component_master_del()
must still be called and the check if the drm_put_dev() has been
called must be in component_master_ops unbind() callback, not in
platform_driver remove() callback.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
2016-08-08 23:04:57 +03:00
Jyri Sarha 10a55a18f5 drm/tilcdc: Avoid error print by of_graph_get_next_endpoint()
Avoid error print by of_graph_get_next_endpoint() if there is no ports
present.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
2016-08-08 23:04:56 +03:00
Jyri Sarha d85f850ed6 drm/tilcdc: Call drm_crtc_vblank_on() and *_off() in start() and stop()
Add drm_crtc_vblank_on() and *_off() calls to start() and stop()
functions, to make sure any vblank waits etc. gets properly cleaned
up.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
2016-08-08 23:04:54 +03:00
Jyri Sarha 437c7d948d drm/tilcdc: Increase time out for waiting frame done interrupt
Increase time out for waiting frame done interrupt. 50ms is long
enough for the usual display modes (50 Hz or higher refresh rate), but
it may be a bit tight for some unusual mode.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
2016-08-08 23:04:52 +03:00
Jyri Sarha 2d5be88235 drm/tilcdc: Move waiting of LCDC_FRAME_DONE IRQ into stop()
Move wait queue waiting of LCDC_FRAME_DONE IRQ from tilcdc_crtc_dpms()
into stop() function. This is just a cleanup and enables independent
use of stop() function.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
2016-08-08 23:04:51 +03:00
Jyri Sarha 149441134c drm/tilcdc: Write to LCDC_END_OF_INT_IND_REG at the end of IRQ function
Reorder the IRQ function so that the write to LCDC_END_OF_INT_IND_REG
is done last. The write to LCDC_END_OF_INT_IND_REG indicates to LCDC
that the interrupt service routine has completed (see section
13.3.6.1.6 in AM335x TRM). This is needed if LCDC's ipgvmodirq module
is configured for pulse interrupts.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
2016-08-08 23:04:50 +03:00
Jyri Sarha 1abcdac8ed drm/tilcdc: Move LCDC_SYNC_LOST handling inside if (ver == 2) statement
Move LCDC_SYNC_LOST handling inside if (ver == 2) statement.
LCDC_SYNC_LOST interrupt status bit is only defined for version 2
silicon.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
2016-08-08 23:04:49 +03:00
Jyri Sarha 8fe5616b20 drm/tilcdc: Restore old dpms state in pm_resume()
Restore old dpms state in pm_resume(). The dpms is turned off in
pm_suspend() and it should be restored to its original state in
pm_resume(). Without this patch the display is left blanked after a
suspend/resume cycle.

Fixes commit 614b3cfeb8 ("drm/tilcdc: disable the lcd controller/dma
engine when suspend invoked")

Signed-off-by: Jyri Sarha <jsarha@ti.com>
2016-08-08 23:04:48 +03:00
Tobias Jakobi 1103ea40f3 drm/tilcdc: make fbdev support really optional
Currently enabling TI LCDC 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: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1468586897-32298-13-git-send-email-tjakobi@math.uni-bielefeld.de
2016-07-18 09:11:38 +02:00
Gustavo Padovan 099ede834b drm/tilcdc: use drm_crtc_handle_vblank()
Remove legacy usage of drm_handle_vblank()

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1467677092-5089-6-git-send-email-gustavo@padovan.org
2016-07-12 15:41:53 +02:00
Daniel Vetter a325725633 drm: Lobotomize set_busid nonsense for !pci drivers
We already have a fallback in place to fill out the unique from
dev->unique, which is set to something reasonable in drm_dev_alloc.

Which means we only need to have a special set_busid for pci devices,
to be able to care the backwards compat code for drm 1.1 around, which
libdrm still needs.

While developing and testing this patch things blew up in really
interesting ways, and the code is rather confusing in naming things
between the kernel code, ioctl #defines and libdrm. For the next brave
dragon slayer, document all this madness properly in the userspace
interface section of gpu.tmpl.

v2: Make drm_dev_set_unique static and update kerneldoc.

v3: Entire rewrite, plus document what's going on for posterity in the
gpu docbook uapi section.

v4: Drop accidental amdgpu hunk (Emil).

v5: Drop accidental omapdrm vblank counter change (Emil).

v6: Rebase on top of the sphinx conversion.

Cc: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Cc: Emil Velikov <emil.l.velikov@gmail.com>
Tested-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> (virt_gpu)
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2016-06-21 21:56:23 +02:00
Daniel Vetter aa0438ceaa drm/tilcdc: Use lockless gem BO free callback
No dev->struct_mutex anywhere to be seen.

Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1464630800-30786-14-git-send-email-daniel.vetter@ffwll.ch
2016-06-01 09:41:02 +02:00
Arnd Bergmann 287980e49f remove lots of IS_ERR_VALUE abuses
Most users of IS_ERR_VALUE() in the kernel are wrong, as they
pass an 'int' into a function that takes an 'unsigned long'
argument. This happens to work because the type is sign-extended
on 64-bit architectures before it gets converted into an
unsigned type.

However, anything that passes an 'unsigned short' or 'unsigned int'
argument into IS_ERR_VALUE() is guaranteed to be broken, as are
8-bit integers and types that are wider than 'unsigned long'.

Andrzej Hajda has already fixed a lot of the worst abusers that
were causing actual bugs, but it would be nice to prevent any
users that are not passing 'unsigned long' arguments.

This patch changes all users of IS_ERR_VALUE() that I could find
on 32-bit ARM randconfig builds and x86 allmodconfig. For the
moment, this doesn't change the definition of IS_ERR_VALUE()
because there are probably still architecture specific users
elsewhere.

Almost all the warnings I got are for files that are better off
using 'if (err)' or 'if (err < 0)'.
The only legitimate user I could find that we get a warning for
is the (32-bit only) freescale fman driver, so I did not remove
the IS_ERR_VALUE() there but changed the type to 'unsigned long'.
For 9pfs, I just worked around one user whose calling conventions
are so obscure that I did not dare change the behavior.

I was using this definition for testing:

 #define IS_ERR_VALUE(x) ((unsigned long*)NULL == (typeof (x)*)NULL && \
       unlikely((unsigned long long)(x) >= (unsigned long long)(typeof(x))-MAX_ERRNO))

which ends up making all 16-bit or wider types work correctly with
the most plausible interpretation of what IS_ERR_VALUE() was supposed
to return according to its users, but also causes a compile-time
warning for any users that do not pass an 'unsigned long' argument.

I suggested this approach earlier this year, but back then we ended
up deciding to just fix the users that are obviously broken. After
the initial warning that caused me to get involved in the discussion
(fs/gfs2/dir.c) showed up again in the mainline kernel, Linus
asked me to send the whole thing again.

[ Updated the 9p parts as per Al Viro  - Linus ]

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Andrzej Hajda <a.hajda@samsung.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Link: https://lkml.org/lkml/2016/1/7/363
Link: https://lkml.org/lkml/2016/5/27/486
Acked-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> # For nvmem part
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-05-27 15:26:11 -07:00
Linus Torvalds 1d6da87a32 Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux
Pull drm updates from Dave Airlie:
 "Here's the main drm pull request for 4.7, it's been a busy one, and
  I've been a bit more distracted in real life this merge window.  Lots
  more ARM drivers, not sure if it'll ever end.  I think I've at least
  one more coming the next merge window.

  But changes are all over the place, support for AMD Polaris GPUs is in
  here, some missing GM108 support for nouveau (found in some Lenovos),
  a bunch of MST and skylake fixes.

  I've also noticed a few fixes from Arnd in my inbox, that I'll try and
  get in asap, but I didn't think they should hold this up.

  New drivers:
   - Hisilicon kirin display driver
   - Mediatek MT8173 display driver
   - ARC PGU - bitstreamer on Synopsys ARC SDP boards
   - Allwinner A13 initial RGB output driver
   - Analogix driver for DisplayPort IP found in exynos and rockchip

  DRM Core:
   - UAPI headers fixes and C++ safety
   - DRM connector reference counting
   - DisplayID mode parsing for Dell 5K monitors
   - Removal of struct_mutex from drivers
   - Connector registration cleanups
   - MST robustness fixes
   - MAINTAINERS updates
   - Lockless GEM object freeing
   - Generic fbdev deferred IO support

  panel:
   - Support for a bunch of new panels

  i915:
   - VBT refactoring
   - PLL computation cleanups
   - DSI support for BXT
   - Color manager support
   - More atomic patches
   - GEM improvements
   - GuC fw loading fixes
   - DP detection fixes
   - SKL GPU hang fixes
   - Lots of BXT fixes

  radeon/amdgpu:
   - Initial Polaris support
   - GPUVM/Scheduler/Clock/Power improvements
   - ASYNC pageflip support
   - New mesa feature support

  nouveau:
   - GM108 support
   - Power sensor support improvements
   - GR init + ucode fixes.
   - Use GPU provided topology information

  vmwgfx:
   - Add host messaging support

  gma500:
   - Some cleanups and fixes

  atmel:
   - Bridge support
   - Async atomic commit support

  fsl-dcu:
   - Timing controller for LCD support
   - Pixel clock polarity support

  rcar-du:
   - Misc fixes

  exynos:
   - Pipeline clock support
   - Exynoss4533 SoC support
   - HW trigger mode support
   - export HDMI_PHY clock
   - DECON5433 fixes
   - Use generic prime functions
   - use DMA mapping APIs

  rockchip:
   - Lots of little fixes

  vc4:
   - Render node support
   - Gamma ramp support
   - DPI output support

  msm:
   - Mostly cleanups and fixes
   - Conversion to generic struct fence

  etnaviv:
   - Fix for prime buffer handling
   - Allow hangcheck to be coalesced with other wakeups

  tegra:
   - Gamme table size fix"

* 'drm-next' of git://people.freedesktop.org/~airlied/linux: (1050 commits)
  drm/edid: add displayid detailed 1 timings to the modelist. (v1.1)
  drm/edid: move displayid validation to it's own function.
  drm/displayid: Iterate over all DisplayID blocks
  drm/edid: move displayid tiled block parsing into separate function.
  drm: Nuke ->vblank_disable_allowed
  drm/vmwgfx: Report vmwgfx version to vmware.log
  drm/vmwgfx: Add VMWare host messaging capability
  drm/vmwgfx: Kill some lockdep warnings
  drm/nouveau/gr/gf100-: fix race condition in fecs/gpccs ucode
  drm/nouveau/core: recognise GM108 chipsets
  drm/nouveau/gr/gm107-: fix touching non-existent ppcs in attrib cb setup
  drm/nouveau/gr/gk104-: share implementation of ppc exception init
  drm/nouveau/gr/gk104-: move rop_active_fbps init to nonctx
  drm/nouveau/bios/pll: check BIT table version before trying to parse it
  drm/nouveau/bios/pll: prevent oops when limits table can't be parsed
  drm/nouveau/volt/gk104: round up in gk104_volt_set
  drm/nouveau/fb/gm200: setup mmu debug buffer registers at init()
  drm/nouveau/fb/gk20a,gm20b: setup mmu debug buffer registers at init()
  drm/nouveau/fb/gf100-: allocate mmu debug buffers
  drm/nouveau/fb: allow chipset-specific actions for oneinit()
  ...
2016-05-23 11:48:48 -07:00
Gavin Shan c4263233f3 drivers/of: Specify parent node in of_fdt_unflatten_tree()
This adds one more argument to of_fdt_unflatten_tree() to specify
the parent node of the FDT blob that is going to be unflattened.
In the result, the function can be used to unflatten FDT blob that
represents device sub-tree in PowerNV PCI hotplug driver.

Cc: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Acked-by: Rob Herring <robh@kernel.org>
Acked-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Rob Herring <robh@kernel.org>
2016-05-16 07:22:35 -05:00
Gustavo Padovan dfebc152b7 drm/tilcdc: 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: Jyri Sarha <jsarha@ti.com>
Tested-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1460656118-16766-11-git-send-email-gustavo@padovan.org
2016-05-02 17:04:59 +02:00
Jyri Sarha d0ec32caef drm/tilcdc: Use devm_kzalloc() and devm_kcalloc() for private data
Use devm_kzalloc() and devm_kcalloc() for private data allocation at
driver load time.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2016-02-25 16:39:47 +02:00
Jyri Sarha d66284fba1 drm/tilcdc: Initialize crtc->port
Initialize port device node pointer in the tilcdc crtc. Fixes "Falling
back to first CRTC" warning from tda998x driver.

The tda998x encoder driver calls drm_of_find_possible_crtcs() to
initialize possible_crtcs of struct drm_encoder. The crtc->port needs
to be initialized for drm_of_find_possible_crtcs() to work.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2016-02-25 16:39:46 +02:00
Jyri Sarha 5895d08f6f drm/tilcdc: Disable sync lost interrupt if it fires on every frame
Disable the sync lost interrupt if it fires on every frame for 50
consecutive frames in a row. This is relatively sure sign of the sync
lost interrupt being stuck and firing on every frame even if the
display otherwise appears to work OK.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2016-02-25 16:39:45 +02:00
Jyri Sarha c0c2baaab1 drm/tilcdc: Add prints on sync lost and FIFO underrun interrupts
Add ratelimited prints on sync lost and FIFO underrun interrupts.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2016-02-25 16:39:44 +02:00
Jyri Sarha f3a99946a9 drm/tilcdc: Remove the duplicate LCDC_INT_ENABLE_SET_REG in registers[]
Removes the duplicate LCDC_INT_ENABLE_SET_REG-entry in registers array.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2016-02-25 16:39:43 +02:00
Jyri Sarha 947df7e3f0 drm/tilcdc: Fix interrupt enable/disable code for version 2 tilcdc
Fix interrupt enable/disable code for version 2 tilcdc. In version 2
tilcdc there is a separate register for disabling interrupts. Writing
0 to enable registers bits does not have any effect. The interrupt
clear register works the same way, writing 1 to specific bit disables
the interrupt and writing 0 does not have any effect.

The "bug" that is fixed here does not really do any harm since the
interrupts are enabled only once in the power up and disabled before
power down.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2016-02-25 16:39:42 +02:00
Tomi Valkeinen 2b3a8cd71c drm/tilcdc: Do not update the next frame buffer close to vertical blank
Do not update the next frame buffer close to vertical blank. This is
to avoid situation when the frame changes between writing of
LCDC_DMA_FB_BASE_ADDR_0_REG and LCDC_DMA_FB_CEILING_ADDR_0_REG.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
[Added description to the patch]
Signed-off-by: Jyri Sarha <jsarha@ti.com>
2016-02-25 16:39:41 +02:00
Tomi Valkeinen 2b2080d7e9 drm/tilcdc: Get rid of complex ping-pong mechanism
Get rid of complex ping-pong mechanism and replace it with simpler
single buffer flipping code.

The LCDC HW appears to be designed mainly static framebuffers in
mind. There are two modes of operation, either static single buffer,
or ping pong double buffering with two static buffers switching back
and forth. Luckily the framebuffer start address is fetched only in
the beginning of the frame and changing the address after that only
takes effect after the next vertical blank. The page flipping code can
simply write the address of the new framebuffer and the page is
flipped automatically after the next vertical blank. Using the ping
pong double buffering makes the flipping code way more complex and it
does not provide any benefit, so it is better to switch to single
buffer operation.

There is still one problem in updating the framebuffer dma address on
the fly. There are two registers defining the framebuffer dma area and
things may break if the dma address is fetched in while the registers
are are being updated.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
[Added description to the patch]
Signed-off-by: Jyri Sarha <jsarha@ti.com>
2016-02-25 16:39:40 +02:00
Tomi Valkeinen 317aae738b drm/tilcdc: cleanup irq handling
Cleanup irq handling. Clear the irq status unconditionally and
restructure the status bit conditions.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
[Added description to the patch]
Signed-off-by: Jyri Sarha <jsarha@ti.com>
2016-02-25 16:39:40 +02:00
Tomi Valkeinen 31ec5a2c7e drm/tilcdc: remove broken error handling
Remove broken error handling. The condition for handling the
LCDC_SYNC_LOST and LCDC_FIFO_UNDERFLOW could never be satisfied as the
LCDC_SYNC_LOST interrupt is not enabled. Also the requirement to have
both LCDC_SYNC_LOST and LCDC_FIFO_UNDERFLOW fired at once before
handling the error looks weird.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
[Added description to the patch]
Signed-off-by: Jyri Sarha <jsarha@ti.com>
2016-02-25 16:39:39 +02:00
Tomi Valkeinen 2efec4f306 drm/tilcdc: split reset to a separate function
Split reset to a separate function and use usleep_range(250, 1000)
instead of msleep(1) to to keep the reset bit on long enough.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
[Added description to the patch, changed mdelay(500) to usleep_range(250, 1000)]
Signed-off-by: Jyri Sarha <jsarha@ti.com>
2016-02-25 16:39:38 +02:00
Tomi Valkeinen 1aea1e79db drm/tilcdc: disable crtc on unload
Disable crtc on unload. Call tilcdc_crtc_dpms() with DRM_MODE_DPMS_OFF
in the beginning of unload function.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
[Added description to the patch]
Signed-off-by: Jyri Sarha <jsarha@ti.com>
2016-02-25 16:39:37 +02:00
Tomi Valkeinen 65734a2623 drm/tilcdc: cleanup runtime PM handling
Cleanup runtime PM handling. Before the patch the usage of pm_runtime
calls was inconsistent and hard to follow. After the update the
pm_runtime calls are removed from set_scanout() and called around
major operations that access the HW. After the patch the DPMS code does
not have pm_runtime_forbid/allow calls any more and
pm_runtime_irq_safe() is not set anymore.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
[Added description to the patch]
Signed-off-by: Jyri Sarha <jsarha@ti.com>
2016-02-25 16:39:36 +02:00
Jyri Sarha 29ddd6e171 drm/tilcdc: Allocate register storage based on the actual number registers
Allocate suspend/resume register storage based on the actual number
registers the driver is aware of. The static allocation for register
storage had fallen behind badly.

Reported-by: Michael Bode <michael@bumbleB.de>
Signed-off-by: Jyri Sarha <jsarha@ti.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2016-02-25 16:39:35 +02:00