GammaControl: Ditch color mods table

Derived from:
  https://github.com/DecimalMan/dkp/commit/dc5e59ed2bddfd2692b4c7d

But instead of 40 settings... why not 120?!!
Create default tints for red, green & blue, and allow them to be
modified by tuner using a curve; replacing the previous color mods
table used.

Note: trinity color profile can be achieved by:
  echo "0 0 10" > /sys/class/misc/gammacontrol/tuner
  echo "-18 -16 -10" > /sys/class/misc/gammacontrol/v1rgb

Change-Id: I08f13077e82afe454734f1a3e2453633cdaffeee
Signed-off-by: Luis Cruz <ljc2491@gmail.com>
GammaControl: Print when tuner is out of bounds

Allow the kernel to print err when the tuner is set out of bounds
and resets to 0.

Change-Id: I7561a93d95f5b673ba5c587e80a7540532591487
Signed-off-by: Luis Cruz <ljc2491@gmail.com>
Gamma Control: change range

The current userspace implementation really hates negative numbers on
the slider bars. Let's accept 0 to 120, with nominal values achieved as
echo "60 60 60" > /sys/class/misc/gammacontrol/tuner and trinity blue as
"60 60 80"

Change-Id: Ic6768baf53997a5984e9470e423d080e64b217b5
Revert "Revert "PM: A few power updates from aosp-common/android-3.4""

This reverts commit 100033fec2c50fc9bcbebe5514cd08835015f65e.
Revert "workqueue: fix find_worker_executing_work() brekage from hashtable conversion"

This reverts commit 4ab882e91f1adf2ca096cc3cb4596cdda9893a7f.
Revert "workqueue: use new hashtable implementation"

This reverts commit 199f51f46214570e6f0d19ab618094e227b375bf.
Revert "hashtable: introduce a small and naive hashtable"

This reverts commit a5ecf51b1bb573d044b035706137546c430661ec.
Revert "Power: Add guard condition for maximum wakeup reasons"

This reverts commit 0fbcfbf0e748903c26eb9881ff4978fcc83488c3.
Revert "POWER: fix compile warnings in log_wakeup_reason"

This reverts commit 41d69aec2655ed30035975499b9891db71e34830.
Revert "Power: add an API to log wakeup reasons"

This reverts commit 0ecc253c52d00de6a808bde3451b68b0abce68dc.
Revert "Tweak BFQ again"

This reverts commit f4f0a01565af65498d3f8baa1df29a99489b5af0.
Revert "More BFQ adjustments"

This reverts commit 110fa7ae845616922fb21bbfdbe55109d52eae31.
Revert "Tweak BFQ for Flash Media/Batlash Media, battery, and performance"

This reverts commit 12c0b85457ad1acb72cf631b6208645e7ea574ac.
Merge remote-tracking branch 'cm/cm-11.0' into cm-11.0
GammaControl: Only apply tuner params that are modified

Lighten up on the number of rgb shift calculations & only apply
modified tuner params.

Change-Id: Ie6e0d1957f64fc4fa69fbb7af2447c02e85dcbde
Signed-off-by: Luis Cruz <ljc2491@gmail.com>
GammaControl: Fix userspace/kernelspace default mismatch

Change-Id: I8ecd6a0cdab2c4dbb1dc90b632478fbbbf05e18c
Signed-off-by: Luis Cruz <ljc2491@gmail.com>
ibmvscsi: Abort init sequence during error recovery

commit 9ee755974bea2f9880e517ec985dc9dede1b3a36 upstream.

If a CRQ reset is triggered for some reason while in the middle
of performing VSCSI adapter initialization, we don't want to
call the done function for the initialization MAD commands as
this will only result in two threads attempting initialization
at the same time, resulting in failures.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Acked-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
xhci: correct burst count field for isoc transfers on 1.0 xhci hosts

commit 3213b151387df0b95f4eada104f68eb1c1409cb3 upstream.

The transfer burst count (TBC) field in xhci 1.0 hosts should be set
to the number of bursts needed to transfer all packets in a isoc TD.
Supported values are 0-2 (1 to 3 bursts per service interval).

Formula for TBC calculation is given in xhci spec section 4.11.2.3:
TBC = roundup( Transfer Descriptor Packet Count / Max Burst Size +1 ) - 1

This patch should be applied to stable kernels since 3.0 that contain
the commit 5cd43e33b9519143f06f507dd7cbee6b7a621885
"xhci 1.0: Set transfer burst count field."

Suggested-by: ShiChun Ma <masc2008@qq.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
xhci: Fix runtime suspended xhci from blocking system suspend.

commit d6236f6d1d885aa19d1cd7317346fe795227a3cc upstream.

The system suspend flow as following:
1, Freeze all user processes and kenrel threads.

2, Try to suspend all devices.

2.1, If pci device is in RPM suspended state, then pci driver will try
to resume it to RPM active state in the prepare stage.

2.2, xhci_resume function calls usb_hcd_resume_root_hub to queue two
workqueue items to resume usb2&usb3 roothub devices.

2.3, Call suspend callbacks of devices.

2.3.1, All suspend callbacks of all hcd's children, including
roothub devices are called.

2.3.2, Finally, hcd_pci_suspend callback is called.

Due to workqueue threads were already frozen in step 1, the workqueue
items can't be scheduled, and the roothub devices can't be resumed in
this flow. The HCD_FLAG_WAKEUP_PENDING flag which is set in
usb_hcd_resume_root_hub won't be cleared. Finally,
hcd_pci_suspend will return -EBUSY, and system suspend fails.

The reason why this issue doesn't show up very often is due to that
choose_wakeup will be called in step 2.3.1. In step 2.3.1, if
udev->do_remote_wakeup is not equal to device_may_wakeup(&udev->dev), then
udev will resume to RPM active for changing the wakeup settings. This
has been a lucky hit which hides this issue.

For some special xHCI controllers which have no USB2 port, then roothub
will not match hub driver due to probe failed. Then its
do_remote_wakeup will be set to zero, and we won't be as lucky.

xhci driver doesn't need to resume roothub devices everytime like in
the above case. It's only needed when there are pending event TRBs.

This patch should be back-ported to kernels as old as 3.2, that
contains the commit f69e3120df82391a0ee8118e0a156239a06b2afb
"USB: XHCI: resume root hubs when the controller resumes"

Signed-off-by: Wang, Yu <yu.y.wang@intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
[use readl() instead of removed xhci_readl(), reword commit message -Mathias]
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
USB: add USB_DEVICE_INTERFACE_CLASS macro

commit 17b72feb2be14e6d37023267dc0e199e8e0e3fdc upstream.

Matching on device and interface class with with unspecified
subclass and protocol is sometimes useful.  This is slightly
different from USB_DEVICE_AND_INTERFACE_INFO which requires
the full interface class/subclass/protocol triplet.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>