Commit graph

164 commits

Author SHA1 Message Date
Dave Airlie
fa1d0ee69c drm/tegra: Changes for v3.17-rc1
Mostly some cleanup all over the place. Pitch alignment limitations of
 the display controller are now honored and job submission is 64-bit
 safe.
 
 The SOR output (used for eDP) properly configures sync signal polarities
 according to the display mode rather than hard-coding them to some value
 and the number of bits per color is now taken from the panel rather than
 hard-coded to properly support 24-bit vs. 18-bit panels.
 
 The DSI controller now properly supports non-continuous clock mode.
 
 GEM objects can now have their flags and tiling mode modified via IOCTLs
 to allow buffers imported from Nouveau to be properly displayed. Newer
 generations of the Tegra display controller can also detile block linear
 buffers at scan-out time.
 
 Finally the driver now properly exports MODULE_DEVICE_TABLEs to allow it
 to be automatically loaded when built as a module.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABAgAGBQJT4kgqAAoJEN0jrNd/PrOhwSUP/ja3Szs8mdKzRtDcmUla7pIU
 g6dVTrXibruWQtB4Mf0Zv/7vVHDAuVW3q01lRHamud9g+Ci74YDsd99AJuguBQqy
 m0wNm2GFye64pcc/QdpmpH6zUEtt/eULxKYWco3jxGaMtH+v051qIyXE7JhS2KNo
 vE0XUV6bQPQWfhBr94IqJL79lO/DaNOKYuGATh3g6o/D/R+EFjNod7vZ7wGjpzoG
 LFqCsTfMA80sv/S19GLCwX/m/DbVVjPHPl1AxRNz5KhWXguo+teQ+0hKJ3t635IE
 xkW9GJ5Ghuq524sLNY+kEwAiuGVOotFIFqy9lPFNQllp7tyyK0uaWaQHbINYPso9
 3QW4qdGfoioYzg6OzpLMQLwiHwl37z9oaDRodb+tZr9DGfrZ2GihTJwZIqLezBhD
 KGwDUb6/mexuotn6bg3QavFGgGKxrzb/rmiC/o4wJie6gSw3fJLzhOs1fgcus5p8
 NcSRWkl90wbuoVE2h9I3mdHi4A+dAkAR9K6e8UxQCGfJwfisSeYABqh/UvRxNs3u
 mp8fIBbEmUKr6Kznaehw6VBy4xd6yp6hpjMJjPClNS4oErXuzhvZdoKjma7Jg6wj
 7KFNSs1R1euNRjRX2J7ITPz7sIkjac5Ms2ejeniG5+RpqWp4c54G2MxuhvbFlVEA
 GOZYuKjSn6IEOkR5cx/X
 =qYgE
 -----END PGP SIGNATURE-----

Merge tag 'drm/tegra/for-3.17-rc1' of git://anongit.freedesktop.org/tegra/linux into drm-next

drm/tegra: Changes for v3.17-rc1

Mostly some cleanup all over the place. Pitch alignment limitations of
the display controller are now honored and job submission is 64-bit
safe.

The SOR output (used for eDP) properly configures sync signal polarities
according to the display mode rather than hard-coding them to some value
and the number of bits per color is now taken from the panel rather than
hard-coded to properly support 24-bit vs. 18-bit panels.

The DSI controller now properly supports non-continuous clock mode.

GEM objects can now have their flags and tiling mode modified via IOCTLs
to allow buffers imported from Nouveau to be properly displayed. Newer
generations of the Tegra display controller can also detile block linear
buffers at scan-out time.

Finally the driver now properly exports MODULE_DEVICE_TABLEs to allow it
to be automatically loaded when built as a module.

* tag 'drm/tegra/for-3.17-rc1' of git://anongit.freedesktop.org/tegra/linux:
  drm/tegra: add MODULE_DEVICE_TABLEs
  drm/tegra: dc - Reset controller on driver remove
  drm/tegra: Properly align stride for framebuffers
  drm/tegra: sor - Configure proper sync polarities
  drm/tegra: sor - Use bits-per-color from panel
  drm/tegra: Make job submission 64-bit safe
  drm/tegra: Allow non-authenticated processes to create buffer objects
  drm/tegra: Add SET/GET_FLAGS IOCTLs
  drm/tegra: Add SET/GET_TILING IOCTLs
  drm/tegra: Implement more tiling modes
  drm/tegra: dsi - Handle non-continuous clock flag
  drm/tegra: sor - missing unlock on error
2014-08-07 19:53:22 +10:00
Dave Airlie
0c6287ec12 drm/panel: Changes for v3.17-rc1
Panels can now be more finely controlled via .prepare() and .unprepare()
 callbacks in addition to .enable() and .disable(). New kerneldoc details
 what they are supposed to do and when they should be called.
 
 The simple panel driver gained support for a couple of new panels and it
 is now possible to specify additional delays during power up and power
 down sequences if panels require it.
 
 DSI devices can now advertise that they support non-continuous clock
 mode which will allow DSI host controllers to disable the high speed
 clock after transmissions to save power.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABAgAGBQJT4yx+AAoJEN0jrNd/PrOh1DwQAIjgJ0a7cgc50cTLnIr48Nt0
 vjDL73y7Dkfz6ouo6iIgUR3YzR4MggkJfb12ACXKgOGqwwqfTkdAxZ6jY9NCwBd/
 Lja92XRVQ/THyZg5lsAWFt0ms9x1JYx8dpySyBShLygvaRMlDmoCJFpTZ8iuOquq
 vD5cfirKslt7ldjVKeUw8WDapbXeGNOVn0sYF+LiYr9HuP2Nj4T3ZnZQRAZIQPQz
 gCZi8X4lHsJFupWvhA7Pf7BaSNrJA8QwDtH4VxDpirJBcCBS8AXu9Qmbk2ib+egO
 It9wClhtQGzEeWgnRoux5usqF+XswRKSVK85dmgYLnjuOkLFFE4TXbV4+GQedlev
 ojFuHv8POK0cgxkpxf6Yir1ALWTv0AuLXdwXUpuARuixn44W7sez/PUZFa04apAD
 lblXXBXc3pXGxdHjz4CQ8qYG/2gYqoxTEUQoatRZZaNsLlKrdy1Rixcpcn/Aod2Y
 a5buMwTce7a4n+rOkV+w9c5vf+nLeGTzyBPJO17rpTYxlthLAwTNc+xs2xWe61hU
 m72XhIQJgotjAmKok7Dxo+r8dnuE4/sOgmIlVyYNjMux/d/gXewnFdYbnGt0+lpl
 OprjNqv28Khyp4Rs5qGzASDks9duTKycUPEeEN7IpTJWrDqm0N6eZg9cVSgetRJl
 xatc7FN732nKMtDJZ+Vo
 =vf7m
 -----END PGP SIGNATURE-----

Merge tag 'drm/panel/for-3.17-rc1' of git://anongit.freedesktop.org/tegra/linux into drm-next

drm/panel: Changes for v3.17-rc1

Panels can now be more finely controlled via .prepare() and .unprepare()
callbacks in addition to .enable() and .disable(). New kerneldoc details
what they are supposed to do and when they should be called.

The simple panel driver gained support for a couple of new panels and it
is now possible to specify additional delays during power up and power
down sequences if panels require it.

DSI devices can now advertise that they support non-continuous clock
mode which will allow DSI host controllers to disable the high speed
clock after transmissions to save power.

* tag 'drm/panel/for-3.17-rc1' of git://anongit.freedesktop.org/tegra/linux: (30 commits)
  drm/panel: simple: Use devm_gpiod_get_optional()
  drm/dsi: Replace upcasting macro by function
  drm/panel: ld9040: Replace upcasting macro by function
  drm/exynos: dp: Modify driver to support drm_panel
  drm/exynos: Move DP setup into commit()
  drm/panel: simple: Add AUO B133HTN01 panel support
  drm/panel: simple: Support delays in panel functions
  drm/panel: simple: Add proper definition for prepare and unprepare
  drm/panel: s6e8aa0: Add proper definition for prepare and unprepare
  drm/panel: ld9040: Add proper definition for prepare and unprepare
  drm/tegra: Add support for panel prepare and unprepare routines
  drm/exynos: dsi: Add support for panel prepare and unprepare routines
  drm/exynos: dpi: Add support for panel prepare and unprepare routines
  drm/panel: simple: Add dummy prepare and unprepare routines
  drm/panel: s6e8aa0: Add dummy prepare and unprepare routines
  drm/panel: ld9040: Add dummy prepare and unprepare routines
  drm/panel: Provide convenience wrapper for .get_modes()
  drm/panel: add .prepare() and .unprepare() functions
  drm/panel: simple: Remove simple-panel compatible
  drm/panel: simple: Add Innolux N116BGE panel support
  ...
2014-08-07 19:51:52 +10:00
Ajay Kumar
0407ed8afe drm/tegra: Add support for panel prepare and unprepare routines
Modify tegra output driver to support the new panel calls:
prepare and unprepare.

Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-08-06 16:44:12 +02:00
Stephen Warren
ef70728c7a drm/tegra: add MODULE_DEVICE_TABLEs
When tegra-drm.ko is built as a module, these MODULE_DEVICE_TABLEs allow
the module to be auto-loaded since the module will match the devices
instantiated from device tree.

(Notes for stable: in 3.14+, just git rm any conflicting file, since they
are added in later kernels. For 3.13 and below, manual merging will be
needed)

Cc: <stable@vger.kernel.org>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-08-04 10:07:39 +02:00
Thierry Reding
5482d75a65 drm/tegra: dc - Reset controller on driver remove
Since the device will no longer be used, may as well keep it in reset to
potentially save some power and make sure it is in a clean state the
next time it's probed.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-08-04 10:07:38 +02:00
Thierry Reding
d1f3e1e0b3 drm/tegra: Properly align stride for framebuffers
Tegra20 and Tegra30 both required the buffer line stride to be aligned
on 8 byte boundaries. Tegra114 and Tegra124 increased the alignment to
64 bytes. Introduce a parameter to specify the alignment requirements
for each display controller and round up the pitch of newly allocated
framebuffers appropriately.

Originally-by: Stéphane Marchesin <marcheu@chromium.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-08-04 10:07:38 +02:00
Thierry Reding
3f4f3b5fed drm/tegra: sor - Configure proper sync polarities
Program the sync signal polarities according to the display mode.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-08-04 10:07:37 +02:00
Stéphane Marchesin
054b1bd161 drm/tegra: sor - Use bits-per-color from panel
This change uses the value of bits-per-color from panel to remove one
more hardcoded value.

Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-08-04 10:07:37 +02:00
Thierry Reding
961e3beae3 drm/tegra: Make job submission 64-bit safe
Job submission currently relies on the fact that struct drm_tegra_reloc
and struct host1x_reloc are the same size and uses a simple call to the
copy_from_user() function to copy them to kernel space. This causes the
handle to be stored in the buffer object field, which then needs a cast
to a 32 bit integer to resolve it to a proper buffer object pointer and
store it back in the buffer object field.

On 64-bit architectures that will no longer work, since pointers are 64
bits wide whereas handles will remain 32 bits. This causes the sizes of
both structures to because different and copying will no longer work.

Fix this by adding a new function, host1x_reloc_get_user(), that copies
the structures field by field.

While at it, use substructures for the command and target buffers in
struct host1x_reloc for better readability. Also use unsized types to
make it more obvious that this isn't part of userspace ABI.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-08-04 10:07:36 +02:00
Thierry Reding
bd4f236024 drm/tegra: Allow non-authenticated processes to create buffer objects
This matches what other drivers do for equivalent IOCTLs.

Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-08-04 10:07:36 +02:00
Thierry Reding
7b12908787 drm/tegra: Add SET/GET_FLAGS IOCTLs
The DRM_TEGRA_GEM_SET_FLAGS IOCTL can be used to set the flags of a
buffer object after it has been allocated or imported. Flags associated
with a buffer object can be queried using the DRM_TEGRA_GEM_GET_FLAGS
IOCTL.

Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-08-04 10:07:35 +02:00
Thierry Reding
7678d71fb4 drm/tegra: Add SET/GET_TILING IOCTLs
Currently the tiling parameters of buffer objects can only be set at
allocation time, and only a single tiled mode is supported. This new
DRM_TEGRA_GEM_SET_TILING IOCTL allows more modes to be set and also
allows the tiling mode to be changed after the allocation. This will
enable the Tegra DRM driver to import buffers from a GPU and directly
scan them out by configuring the display controller appropriately.

To complement this, the DRM_TEGRA_GEM_GET_TILING IOCTL can query the
current tiling mode of a buffer object. This is necessary when importing
buffers via handle (as is done in Mesa for example) so that userspace
can determine the proper parameters for the 2D or 3D engines.

Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-08-04 10:07:34 +02:00
Thierry Reding
c134f019ab drm/tegra: Implement more tiling modes
Tegra124 supports a block-linear mode in addition to the regular pitch
linear and tiled modes. Add support for these by moving the internal
representation into a structure rather than a simple flag.

Tested-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-08-04 10:07:34 +02:00
Alexandre Courbot
0c6b1e4ba7 drm/tegra: dsi - Handle non-continuous clock flag
Handle the MIPI_DSI_CLOCK_NONCONTINUOUS flag and only set TX-only
clock behavior when this flag is present to allow panels requiring
continuous clock mode to operate with this driver.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-08-04 10:07:33 +02:00
Dan Carpenter
2263c460be drm/tegra: sor - missing unlock on error
We should unlock before returning the error code.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-08-04 10:07:33 +02:00
Thierry Reding
e2215321ff drm/tegra: Implement race-free hotplug detection
A race condition currently exists on Tegra, where it can happen that a
monitor attached via HDMI isn't detected during the initial FB helper
setup, but the hotplug event happens too early to be processed by the
poll helpers because they haven't been initialized yet. This happens
because on some boards the HDMI driver can control the regulator that
supplies the +5V pin on the HDMI connector. Therefore depending on the
timing between the initialization of the HDMI driver and the rest of
DRM, it's possible that the monitor returns the hotplug signal right
within the window where we would miss it.

Unfortunately, drm_kms_helper_poll_init() will wreak havoc when called
before at least some parts of the FB helpers have been set up.

This commit fixes this by splitting out the minimum of initialization
required to make drm_kms_helper_poll_init() work into a separate
function that can be called early. It is then safe to move all of the
poll helper initialization to an earlier point in time (before the
HDMI output driver has a chance to enable the +5V supply). That way if
the hotplug signal is returned before the initial FB helper setup, the
monitor will be forcefully detected at that point, and if the hotplug
signal is returned after that it will be properly handled by the poll
helpers.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-07-08 11:31:36 +10:00
Thierry Reding
10a2310265 drm: Introduce drm_fb_helper_prepare()
To implement hotplug detection in a race-free manner, drivers must call
drm_kms_helper_poll_init() before hotplug events can be triggered. Such
events can be triggered right after any of the encoders or connectors
are initialized. At the same time, if the drm_fb_helper_hotplug_event()
helper is used by a driver, then the poll helper requires some parts of
the FB helper to be initialized to prevent a crash.

At the same time, drm_fb_helper_init() requires information that is not
necessarily available at such an early stage (number of CRTCs and
connectors), so it cannot be used yet.

Add a new helper, drm_fb_helper_prepare(), that initializes the bare
minimum needed to allow drm_kms_helper_poll_init() to execute and any
subsequent hotplug events to be processed properly.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-07-08 11:31:28 +10:00
Thierry Reding
3a4938799d drm: Constify struct drm_fb_helper_funcs
There's no need for this to be modifiable. Make it const so that it can
be put into the .rodata section.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-07-08 11:31:15 +10:00
Thomas Wood
34ea3d3863 drm: add register and unregister functions for connectors
Introduce generic functions to register and unregister connectors. This
provides a common place to add and remove associated user space
interfaces.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-06-19 08:55:28 +02:00
Thierry Reding
1f64ae7c5a drm/tegra: sor - Remove obsolete comment
According to the DP specification the disparity of the first symbol
should always be negative. It is therefore safe to assume that panels
will conform to that and therefore parameterizing this field should
never be necessary.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-06-09 12:02:51 +02:00
Thierry Reding
0c90a18466 drm/tegra: sor - Enable only the necessary number of lanes
Instead of always enabling all four lanes, enable only the number probed
from the link.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-06-09 12:02:50 +02:00
Thierry Reding
899451b787 drm/tegra: sor - Power on only the necessary lanes
Power on only those lanes required for the specified link.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-06-09 12:02:50 +02:00
Thierry Reding
d6922295e2 drm/tegra: sor - Do not program interlaced mode registers
Interlaced mode is currently not supported on the SOR, so don't program
any associated registers.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-06-09 12:02:49 +02:00
Thierry Reding
a4263fed28 drm/tegra: sor - Do not hardcode link speed
Use the speed probed from the link at runtime rather than relying on a
hardcoded default.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-06-09 12:02:48 +02:00
Thierry Reding
7890b576ed drm/tegra: sor - Do not hardcode number of blank symbols
The number of HBLANK and VBLANK symbols can be computed at runtime so
that they can be set appropriately depending on the video mode and DP
link.

These values are used by the packet generation logic to determine how
many audio samples can be transferred during the blanking intervals.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-06-09 12:02:48 +02:00
Thierry Reding
34fa183bac drm/tegra: sor - Don't hardcode link parameters
The currently hardcoded link parameters don't work on all eDP panels, so
compute the parameters at runtime depending on the mode and panel type
to allow the driver to cope with a wider variety of panels.

Note that the number of bits per pixel of the panel is still hardcoded,
but this can be addressed in a separate patch.

This is largely based on a patch by Stéphane Marchesin but the algorithm
was largely rewritten to be more readable and concise.

Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-06-09 12:02:47 +02:00
Stéphane Marchesin
ca185c68ed drm/tegra: sor - Change power down ordering
Lanes are powered up in decreasing order. Power them down in increasing
order for consistency.

Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-06-09 12:02:47 +02:00
Stéphane Marchesin
143b1df23e drm/tegra: sor - Fix copy/paste error
The comment above mentions link A/B but this isn't what the code does,
so let's fix that.

Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-06-09 12:02:41 +02:00
Stéphane Marchesin
ccb8b12c4b drm/tegra: sor - Remove pixel clock rounding
The code currently rounds up the clock to the next MHZ, which is
rounding up a 69.5MHz clock to 70MHz on my machine. This in turn
prevents the display from syncing. Removing this rounding fixes eDP
for me.

Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-06-09 12:02:31 +02:00
Thierry Reding
1b0c7b4840 drm/tegra: sor - Make debugfs setup consistent
Other output drivers set up debugfs slightly differently. Bring the SOR
driver in line with those for consistency.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-06-06 08:38:31 +02:00
Thierry Reding
9578184efa drm/tegra: sor - Recursively remove debugfs tree
Removing only the root directory will fail when there are still files in
it. Instead of manually removing all files, remove the whole directory
recursively.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-06-06 08:38:30 +02:00
Thierry Reding
7c4633861f drm/tegra: dp - Mark the connector as hotplug capable
Doing so allows the hotplug events generated by the connector to be
properly handled by the DRM poll helpers.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-06-05 23:14:48 +02:00
Thierry Reding
2fff79d38b drm/tegra: dp - Implement hotplug detection in work queue
Calling the drm_helper_hpd_irq_event() helper can sleep, so instead of
invoking it directly from the interrupt handler, schedule a work queue
and run it from there.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-06-05 23:14:48 +02:00
Thierry Reding
e687651bc1 drm/tegra: Add hardware cursor support
Enable hardware cursor support on Tegra124. Earlier generations support
the hardware cursor to some degree as well, but not in a way that can be
generically exposed.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-06-05 23:14:47 +02:00
Thierry Reding
9910f5c455 drm/tegra: Remove host1x drm_bus implementation
The DRM core can now cope with drivers that don't have an associated
struct drm_bus, so the host1x implementation is no longer useful.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-06-05 23:14:46 +02:00
Thierry Reding
540457cc1f drm/tegra: gem - Make tegra_bo_import() static
The function is never used outside of the source file and therefore can
be locally scoped.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-06-05 23:09:36 +02:00
Thierry Reding
fb7be70e73 drm/tegra: hdmi - Add Tegra124 support
Tegra124 is mostly backwards-compatible with Tegra114. However, Tegra124
supports a few more features (e.g. interlacing, ...). Introduce a new
compatible string and TMDS tables to cope with these differences.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-06-05 23:09:35 +02:00
Thierry Reding
86f5c52dc9 drm/tegra: sor - Protect CRC debugfs against enable state
Accessing the CRC debugfs file will hang the system if the SOR is not
enabled, so make sure that it is stays enabled until the CRC has been
read.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-06-05 23:09:35 +02:00
Thierry Reding
76245adbc1 drm/tegra: dsi - Do not needlessly recompute pclk
In some cases the pixel clock used to not be correct, which is why it
had to be recomputed. It turns out that the reason why it wasn't correct
is that it was used wrongly. If used correctly there's not need for the
recomputation.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-06-05 23:09:34 +02:00
Thierry Reding
91eded9b48 drm/tegra: dc - Compute shift clock divider in output drivers
The shift clock divider is highly dependent on the type of output, so
push computation of it down into the output drivers. The old code used
to work merely by accident.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-06-05 23:09:33 +02:00
Thierry Reding
dbb3f2f751 drm/tegra: dc - Move around shift clock programming
Program the shift clock divider in tegra_crtc_setup_clk() since that's
where the divider is computed, so passing it around can be avoided.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-06-05 23:09:32 +02:00
Thierry Reding
cb825d89f5 drm/tegra: dsi - Reset controller on driver unload
Assert the DSI controller's reset when the driver is unloaded to reduce
power consumption and to put the controller into a known state for
subsequent driver reloads.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-06-05 23:09:31 +02:00
Thierry Reding
79eb7e5dab drm/tegra: dsi - Fix typo when disabling controller
When disabling the DSI controller, the code wasn't really doing what it
was supposed to.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-06-05 23:09:31 +02:00
Thierry Reding
334ae6b527 drm/tegra: dsi - Add enable guard
To prevent the enable or disable operations to potentially be run
multiple times, add guards to return early when the output is already
in the targetted state.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-06-05 23:09:30 +02:00
Thierry Reding
17297a2813 drm/tegra: dsi - Initialize proper packet sequences
The packet sequencer needs to be programmed depending on the video mode
of the attached peripheral. Add support for non-burst video modes with
sync events (as opposed to sync pulses) and select either sequence
depending on the video mode.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-06-05 23:09:29 +02:00
Thierry Reding
3b077afb3a drm/tegra: dsi - Implement VDD supply support
The DSI controllers are powered by a (typically 1.2V) regulator. Usually
this is always on, so there was no need to support enabling or disabling
it thus far. But in order not to consume any power when DSI is inactive,
give the driver a chance to enable or disable the supply as needed.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-06-05 23:09:28 +02:00
Thierry Reding
bcfc7acbca drm/tegra: dsi - Remove unneeded code
A bunch of registers are initialized to 0 upon during driver probe. It
turns out that none of these are actually needed, so they can simply be
dropped.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-06-05 23:09:27 +02:00
Thierry Reding
f7d6889b79 drm/tegra: dsi - Use internal pixel format
The pixel format enumeration values used by the Tegra DSI controller
don't match those defined by the DSI framework. Make sure to convert
them to the internal format before writing it to the register.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-06-05 23:09:26 +02:00
Thierry Reding
7e2464304b drm/tegra: hdmi - Fix disable sequence
For some reason when the PW*_ENABLE and PM*_ENABLE fields are cleared
during disable, the HDMI output stops working properly. Resetting and
initializing doesn't help.

Comment out those accesses for now until it has been determined what to
do about them.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-06-05 23:09:26 +02:00
Thierry Reding
9cbfc73e11 drm/tegra: hdmi - Disable LVDS mode
Disable LVDS mode according to register documentation. It seems like
this has no effect on the operation of HDMI, but it's probably a good
idea to do this anyway.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-06-05 23:09:25 +02:00