ASoC: tegra: increase period count/size limits

Bug: 6643209
Signed-off-by: Glenn Kasten <gkasten@google.com>
Change-Id: I1bcc1631c08e6b76460805ff91a7710219b8e045
[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
timer: optimize apply_slack()

__fls(mask) is equivalent to find_last_bit(&mask, BITS_PER_LONG), but cheaper.
find_last_bit was showing up high on the list when I was profiling for stalls
on icache misses on a system with very small cache size (MIPS).

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
sched/fair: Improve the ->group_imb logic

Group imbalance is meant to deal with situations where affinity masks
and sched domains don't align well, such as 3 cpus from one group and
6 from another. In this case the domain based balancer will want to
put an equal amount of tasks on each side even though they don't have
equal cpus.

Currently group_imb is set whenever two cpus of a group have a weight
difference of at least one avg task and the heaviest cpu has at least
two tasks. A group with imbalance set will always be picked as busiest
and a balance pass will be forced.
The problem is that even if there are no affinity masks this stuff can
trigger and cause weird balancing decisions, eg. the observed
behaviour was that of 6 cpus, 5 had 2 and 1 had 3 tasks, due to the
difference of 1 avg load (they all had the same weight) and nr_running
being >1 the group_imbalance logic triggered and did the weird thing
of pulling more load instead of trying to move the 1 excess task to
the other domain of 6 cpus that had 5 cpu with 2 tasks and 1 cpu with
1 task.
Curb the group_imbalance stuff by making the nr_running condition
weaker by also tracking the min_nr_running and using the difference in
nr_running over the set instead of the absolute max nr_running.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/n/tip-9s7dedozxo8kjsb9kqlrukkf@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
modified for Linux 3.0 from Linux 3.4+ by faux123
ARM: fix rcu stalls on SMP platforms

We can stall RCU processing on SMP platforms if a CPU sits in its idle
loop for a long time.  This happens because we don't call irq_enter()
and irq_exit() around generic_smp_call_function_interrupt() and
friends.  Add the necessary calls, and remove the one from within
ipi_timer(), so that they're all in a common place.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Change-Id: I3383645deba180958b548fbae5aca795ac4094f6
Reviewed-on: http://git-master/r/90691
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>
Reviewed-by: Scott Williams <scwilliams@nvidia.com>
Reviewed-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>
Tested-by: Juha Tukkinen <jtukkinen@nvidia.com>

Conflicts:

	arch/arm/kernel/smp.c
sched: clock wrap bug in 2.6.35-stable kills scheduling

On Mon, 2012-06-25 at 11:45 +0200, Peter Zijlstra wrote:
> On Sun, 2012-06-24 at 19:32 +0200, Thomas Lange wrote:
> > Bug was introduced in 2.6.35.12 and is still present in linux-2.6.35.y HEAD.
>
> Ok, so nobody cares about that.. what does something recent like 3.5-rc4
> do?
>
> If that's fixed, find the patch that fixes it. If not, we'll have a
> look.

If anything, I think something like the below ought to cure things.
mm: increase VM_MAX_READAHEAD just a little bit
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