video: tegra: dsi: Implement dcs video + host

Send host commands to panel during vertical blanking
of a frame. Implementation is generic enough to
handle both long and short packets.

Bug 1009863

Change-Id: I9a80641df2d8b67eb3649d220c028543b246a5f3
Signed-off-by: Animesh Kishore <ankishore@nvidia.com>
Reviewed-on: http://git-master/r/114990
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>

Conflicts:
	drivers/video/tegra/dc/dsi.c
video: tegra: 2d: reset 2d clock to minimum

This was accidently reverted to be set to max with commit 9774bbe31a.
With 2d clock at max, there is a hit on video power numbers.

Change-Id: Iaf73c6f7800d56229d35fb6a2b00f61d460e986d
Reviewed-on: http://git-master/r/117589
Reviewed-by: Automatic_Commit_Validation_User
Tested-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: Donghan Ryu <dryu@nvidia.com>

Conflicts:
	drivers/video/tegra/host/t30/t30.c
video: tegra: host: fix memory leak in ctx save

- host1x_save_context() explicitly updated the ref count on context
- with the re-factoring of nvhost_job code, nvhost_job_alloc()
takes a ref count on context
- this caused the explicit ref count in host1x_save_context()
redundant and lead to memory leak. hence remove it

Bug 1015924

Change-Id: Id18c74412e8659b60288700972690d1b895de4c1
Signed-off-by: Mayuresh Kulkarni <mkulkarni@nvidia.com>
Reviewed-on: http://git-master/r/116409
(cherry picked from commit c98d0cfbbdacdda8e540b5d9e0d513e279b3b2f5)
Reviewed-on: http://git-master/r/117326
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
ramdisk: update Synapse

Signed-off-by: Willi Ye <williye97@gmail.com>
video: tegra: nvmap: Set PAGELIST_VMALLOC_MIN size correct

page list array size greater than PAGE_SIZE should use vmalloc.

Change-Id: Ic03668ba7ff716bfb3cc08aaef5f86214ee0a9df
Signed-off-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-on: http://git-master/r/116875
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Hiroshi Doyu <hdoyu@nvidia.com>
Tested-by: Hiroshi Doyu <hdoyu@nvidia.com>
Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>
(cherry picked from commit ddacaacd2a9fff10187e026eaa0d898694eeb95f)
Reviewed-on: http://git-master/r/118194
misc: tegra-throughput: adding throughput dev node

Creates a miscdev at /dev/tegra-throughput which gl will use to set a
target frame rate. In addition it receives notifications from dc on
flip events. On each notification the percentage ratio of the actual
frame time to the target frame time is calculated. In subsequent
changes this ratio will be reported to other modules as a throughput
hint.

Bug 991589

Change-Id: Ieaa2b2755b63d2d071de31e3ef819d4c3b51a956
Signed-off-by: Ilan Aelion <iaelion@nvidia.com>
Reviewed-on: http://git-master/r/116865
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>
Reviewed-by: Jon Mayo <jmayo@nvidia.com>

Conflicts:
	drivers/misc/Makefile

Conflicts:
	drivers/misc/Makefile
	drivers/video/tegra/dc/dc_priv.h
	drivers/video/tegra/dc/ext/dev.c
	drivers/video/tegra/dc/mode.c
use Linaro 4.9.1 toolchain by christopher83

Signed-off-by: Willi Ye <williye97@gmail.com>
video: tegra: dc: remove unused and add missing functions

Signed-off-by: Willi Ye <williye97@gmail.com>
video: tegra: host: adding throughput hint in 3dfs

adding support for using a throughput hint given by the tegra-gfx misc
device in the 3d scaling code. If throughput hint usage is enabled and
the latest throughput hint is recent enough (less than 1 second old),
the throughput hint is used to control 3d frequency scaling. Otherwise
the existing idle time percentage estimate is used.

Bug 991589

Change-Id: I68893e5ce7ef922b95ce5f5b3664eb8e1fdd4027
Signed-off-by: Ilan Aelion <iaelion@nvidia.com>
Reviewed-on: http://git-master/r/116866
Reviewed-by: Lokesh Pathak <lpathak@nvidia.com>
Tested-by: Lokesh Pathak <lpathak@nvidia.com>
video: tegra: host: use fps in 3dfs by default

enable using frame rate information in 3d frequency scaling by default

Bug 991589

Change-Id: I410c86e3a56ddf00610133333dd518b4f46aa9ec
Reviewed-on: http://git-master/r/116867
Reviewed-by: Lokesh Pathak <lpathak@nvidia.com>
Tested-by: Lokesh Pathak <lpathak@nvidia.com>
video: tegra: dsi: Fix host HS transmission

Fixing host transmission with HS enabled.

Bug 999141

Change-Id: I9dcc5282971830865dacf16dbbbebf4096aeb00e
Signed-off-by: Animesh Kishore <ankishore@nvidia.com>
Reviewed-on: http://git-master/r/118315
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>

Conflicts:
	drivers/video/tegra/dc/dsi.c
video: tegra: nvmap: Fix two integer overflows.

nvmap_ioctl_pinop kmalloc's a temporary buffer, whose length is directly
given by ioctl parameter from usermode. The total size of the buffer
is not checked for overflow, which will cause a kernel panic with some
inputs.

Also, a sizeof() is applied to wrong type when calculating the amount
of bytes to copy from userspace.

nvmap_map_into_caller_ptr attempts to validate that the memory range
to be mapped is correct, but integer overflow can cause the check to
fail. This will lead to mapping wrong pages from the allocated
handle later on, when the page fault handler gets called.

Bug 1025502

Change-Id: I71a09c40c209dba9c5b37c3912e92a81e6f87e80
Signed-off-by: Tuomas Tynkkynen <ttynkkynen@nvidia.com>
video: tegra: host: use strcmp in nvhost_bus_match

- replace the usage of strncmp with strcmp in
nvhost_bus_match()
- strncmp was needed when we had device name as
<name.ip-version>. but now the device name is <name>
which matches with the driver name.
- multiple devices get bind with the same driver using
id_table which uses .version field as an index in id_table

Change-Id: If0b6f0ee18626d5e7ff801b8515ef5168069c3f2
Signed-off-by: Mayuresh Kulkarni <mkulkarni@nvidia.com>
Reviewed-on: http://git-master/r/117953
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Ken Adams <kadams@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>

Conflicts:
	drivers/video/tegra/host/bus.c
video: tegra: hdmi: cleanup error handling in init

In case tegra_dc_init fails, this change will prevent unbalanced call
to dc->out_ops->disable().

Also mark tegra_dc_io_end in case tegra_dc_controller_enable
fails, this is required to not stop device from going into suspend mode.

Bug 1003874

Change-Id: I5af6b46fc50e1ae8e54f9f4eb8540d751364fed7
Signed-off-by: Gaurav Batra <gbatra@nvidia.com>
Reviewed-on: http://git-master/r/120108
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>
WAR: gr3d: limit 3d clock when camera is on

As WAR, limit 3d clock frequency and emc clock frequency
when camera is on and chip is AP37. 3d clock is set to
361MHz and 437MHz is requested for emc clock with this
change. This change allows 3d to request 1.1V in Core
instead of 1.3V in AP37.

Bug 1001262
Bug 1019309

Signed-off-by: Jihoon Bang <jbang@nvidia.com>
Change-Id: I1dbab3469a31ef603f7665fc5a6cb5c1999f89b6
Reviewed-on: http://git-master/r/120480
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>
video: tegra: host: invalidate FDC before context save

Invalidate the FDC before submitting the context save pushbuffer to
ensure cache coherency across both GPU cores.

Bug 1020291

Change-Id: I595d16f42b03edd6f0938741905f1f94211c3962
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/121945
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Daniel Parker <dparker@nvidia.com>
GVS: Gerrit_Virtual_Submit

Conflicts:
	drivers/video/tegra/host/gr3d/gr3d_t30.c
video: tegra: dc: disable dc controller the old way

Signed-off-by: Willi Ye <williye97@gmail.com>