[nvavp] Driver should return EINVAL instead of EFAULT if the error is
different from copy_to_user or copy_from_user failed

Change-Id: If5d44d692fda8f1c7d3af24f693d98c294d65afc
video: tegra: host: Restrict register access

Register access (read/write) to modules MPE, ISP and VI lack sanity
check for the register number. Add checks to ensure only aperture is
accessed.

Bug 992938

Change-Id: I35f30cbd1dda31956286e48c5995b24fd262d1ae
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/105587
video: tegra: host: Restrict register access

Register access (read/write) to modules MPE, ISP and VI lack sanity
check for the register number. Add checks to ensure only aperture is
accessed. Also make sure that the check accounts for wrapping of
values of offset and count.

Also fixes the register offset for reads which are done in multiple
blocks.

Bug 992938

Change-Id: I35f30cbd1dda31956286e48c5995b24fd262d1ae
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/105585
(cherry picked from commit fdf40891983fc3fe1942877dcb07a4eab25f1796)

Conflicts:

	drivers/video/tegra/host/bus_client.c

Change-Id: I90f15217f3b0e3cc32e9132ddd2e006a602f443a
Reviewed-on: http://git-master/r/106123
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: Prajakta Gudadhe <pgudadhe@nvidia.com>
Tested-by: Prajakta Gudadhe <pgudadhe@nvidia.com>
GVS: Gerrit_Virtual_Submit
video: tegra: host: Remove error case panics

Remove BUG_ON()s in error cases:
* If IOCTL size is too large, return error instead
* If sync point id is out of range, return error. Prevents panics in
  sanity checks nvhost_cdma.

Bug 993642

Change-Id: I3cfa7a23dc557c811e20b726885f82666437de7f
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/106232
Reviewed-by: Prajakta Gudadhe <pgudadhe@nvidia.com>
Tested-by: Prajakta Gudadhe <pgudadhe@nvidia.com>
video: tegra: dc: recover underflow error

1. set UF_LINE_FLUSH to 0 by default.
2. if it gets 4 consecutive frames with underflows, enable UF_LINE_FLUSH to
get rid of underflow condition.

Change-Id: I8f6eb3b5e1cc8fae4f53f115431e7732288bf4c2
Signed-off-by: Jay Cheng <jacheng@nvidia.com>
drivers/video/tegra/dc/dsi.c: fix uninitialized variables

Signed-off-by: Iliyan Malchev <malchev@google.com>
drivers/video/tegra/dc/ext/dev.c: fix uninitialized variables

Signed-off-by: Iliyan Malchev <malchev@google.com>
video: tegra: dc: Do not handle dc irq during windows update

DC interrupts can happen during windows update.
This can lead out-of-order execution of dc function calls.
For example, ahead of windows update completion,
if frame end interrupt happens, trigger windows can happen.
To make these in sequence, disable DC interupts
in early part of windows update, and
clean and enable them after windows activation.
This makes dc windows sync stable in following bugs.

Bug 946021
Bug 953225
Bug 953271

Change-Id: I0cba433742d581b6b289eaa1a813678af50a583c
Signed-off-by: Min-wuk Lee <mlee@nvidia.com>
Reviewed-on: http://git-master/r/91889
patch: fixup kernel for gcc4.6
patch: add support for compiling with -Ofast
Makefile: add a few compiler flags
patch: disable GENTLTE_FAIR_SLEEPERS
htc_headset_gpio: increase irq_delay to fix audio during screen off (credits: adwinp@xda)
cable_detect: cleanup driver
usb: gadget: android: Reset next_string_id before enable

Reset next_string_id to 0 before enabling the gadget driver. Otherwise,
after a large number of enable/disable cycles, bind will fail
because we cannot allocate new string ids. String ids cannot be larger
than 254 per USB spec.

Change-Id: I44f5fece45008b7a0a18c025d4eb5ce842585c28
Signed-off-by: Benoit Goby <benoit@android.com>
usb: gadget: android: Cancel pending ctrlrequest before disabling

Make sure there is no pending ctrlrequest before removing the config.
Otherwise the ctrlrequest complete callback could access structures
after they have been freed. Unbind cancels pending transfers but not
ep0 requests.

Bug: 5513065 5440193

Change-Id: I063c22bf5d104a3d2df71cf622409459fac5f27a
Signed-off-by: Benoit Goby <benoit@android.com>
usb: gadget: Fix usb string id allocation

Don't reset next_string_id every time the gadget is enabled, this makes
the next strings allocated overwrite strings allocated at probe time.
Instead, fix rndis not to allocate new string ids on every config bind.

Change-Id: Ied28ee416bb6f00c434c34176fe5b7f0dcb2b2d4
Signed-off-by: Benoit Goby <benoit@android.com>
usb: gadget: zero: fix bug in loopback autoresume handling

commit 683da59d7b8ae04891636d4b59893cd4e9b0b7e5 upstream.

ab943a2e125b (USB: gadget: gadget zero uses new suspend/resume hooks)
introduced a copy-paste error where f_loopback.c writes to a variable
declared in f_sourcesink.c. This prevents one from creating gadgets
that only have a loopback function.

Signed-off-by: Timo Juhani Lindfors <timo.lindfors@iki.fi>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
USB: gadget: Make g_hid device class conform to spec.

commit 33d2832ab0149a26418d360af3c444969a63fb28 upstream.

HID devices should specify this in their interface descriptors, not in the
device descriptor. This fixes a "missing hardware id" bug under Windows 7 with
a VIA VL800 (3.0) controller.

Signed-off-by: Orjan Friberg <of@flatfrog.com>
Cc: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm/mach-tegra/usb_phy.c: add missing function return type