usb: Prevent dead ports when xhci is not enabled

commit 58b2939b4d5a030eaec469d29812ab8477ee7e76 upstream.

When the xHCI driver is not available, actively switch the ports to EHCI
mode since some BIOSes leave them in xHCI mode where they would
otherwise appear dead.  This was discovered on a  Dell Optiplex 7010,
but it's possible other systems could be affected.

This should be backported to kernels as old as 3.0, that contain the
commit 69e848c2090aebba5698a1620604c7dccb448684 "Intel xhci: Support
EHCI/xHCI port switching."

Signed-off-by: David Moore <david.moore@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Linux 3.4.30
mfd: omap: control: Extend framework to use core pad part

The control module allows software control of various static modes
supported by the device. It is composed of two control submodules:
general control module and device (pad configuration) control module.

Currently to address "pad" part, drivers must make hacks like using
big shifts based on "general" part. It is brutal approach and it
leads to many errors.

So add functions to use missing pad part of module:

int omap_control_core_pad_readl(struct device *dev, u32 reg, u32 *val);
int omap_control_core_pad_writel(struct device *dev, u32 val, u32 reg);

Change-Id: Ie5ec9bb8e2ba4e115692c543a12cabede474852a
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
mfd: omap: usb-phy: Correct access to CONTROL_USB2PHYCORE register

Currently, to manipulate CONTROL_USB2PHYCORE we use omap_control_*
functions. The CONTROL_USB2PHYCORE is in core pad part of control
module, so we need to use omap_control_core_pad_* functions.
So rename function and correct CONTROL_USB2PHYCORE value.

Change-Id: I02954eca77bbf865b26d86c6dab25769a21ea0f2
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
mfd: omap: usb-phy: Correct a name of the driver

The USB-PHY device uses a name "omap4-usb-phy". This is incorrect.
The same is corrected to "omap-control-usb".

Change-Id: I3cbc0daf90ea3e2db280504b5067f357aadcf83c
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
mfd: omap: usb-phy: Add OMAP4 support in USB charger detection

OMAP4 and OMAP5 have different addresses of the
OMAP4_CONTROL_USB2PHYCORE register.
So we need to detect OMAP version and use the
appropriate address.

Change-Id: Icf534dc40928894918dbc8db56d6c740d4e0e642
Signed-off-by: Oleg_Kosheliev <oleg.kosheliev@ti.com>
Merge branch 'p-linux-omap-3.4' into p-android-omap-3.4

* p-linux-omap-3.4:
  mfd: omap: usb-phy: Add OMAP4 support in USB charger detection
  mfd: omap: usb-phy: Correct a name of the driver
  mfd: omap: usb-phy: Correct access to CONTROL_USB2PHYCORE register
  mfd: omap: control: Extend framework to use core pad part

Change-Id: Iabffca91cb5971abaae75ab4120f9be3f8917a30
Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
HACK: ASoC: increase OPP from 50 to 100 during audio record

We should increase OPP for ABE during audio record to avoid low volume
level of recorded sound. This change increases OPP from 50 to 100.
This change should be reverted after the root cause fix will be prepared.

Change-Id: Ib689eff20b0f7aeb7cccc3185e50adab24bfb3e1
Signed-off-by: Victor Kleinik <x0150886@ti.com>
OMAPDSS: DISPC: Pipe threshold sizes power optimization.

This patch changes the calculation of thresholds and sets low
threshold to half of buffer size for OMAP4. The memory will
able to sleep between transactions to dss because dss will
read by big chunks.

Change-Id: I3c9e03fa197cc0b6ece01fb1b9a26f607238f15a
Signed-off-by: Artem Rudenko <artemrudenko@ti.com>
OMAPDSS: HDCP: Add a check if hdcp_enable() function exists for OMAP4

Previously we tried to call hdcp_enable() function for OMAP4
without checking if that function exists. As result we observed
kernel panic during trying to handle kernel NULL pointer every
time when we tried to enable HDCP on OMAP4.

Change-Id: I78bc56068c11681393cb17f6588b399acf782975
Signed-off-by: Victor Kleinik <x0150886@ti.com>
OMAPDSS: DISPC: do not lose taps selection

Move taps selection logic before scaling check, so 3- of 5-tap always
get selected, no matter whether we do scaling or not.

Change-Id: I284b29933ca9fd69ae2088f279554dab9a66542c
Signed-off-by: Sergiy Kibrik <sergiy.kibrik@globallogic.com>
Signed-off-by: Varadarajan, Charulatha <charu@ti.com>
usb: musb: omap2430: don't loop indefinitely in interrupt.

When called during resume_irqs, omap2430_musb_set_vbus() is run with
interrupts disabled,  In that case 'jiffies' never changes so the loop
can loop forever.

So impose a maximum loop count and add an 'mdelay' to ensure we wait
a reasonable amount of time for bit to be cleared.

This fixes a hang on resume.

[Ruslan]: cherry-picked from upstream
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;
a=commit;h=12a19b5f836c1a1b838e668f9aa804d017d8c58b

Change-Id: I02aab4597014361a9528d3f90a8f3144057ef51a
Signed-of-by: NeilBrown <neilb@suse.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Ruslan Bilovol <ruslan.bilovol@ti.com>
ARM: OMAP4: board tablet/blaze: Add device oscillator startup/shutdown timings

Add the device oscillator startup and shutdown timing API call
to the board file to enumerate the values.

3.2 Start-up time
Max. 2.0ms (to 90% of final amplitude)
3.3 Stabilization time
Max. 2.0ms (Within +/-0.5ppm of steady state frequency)

Shutdown is not defined in the data sheet so we give it a 1us
shutdown time.

Change-Id: I4a3db5ba48a67a1db6ed5d410e0b7582d7601d21
Signed-off-by: Dan Murphy <dmurphy@ti.com>
[ivan.khoronzhuk@ti.com: ported from k3.0]
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
alarmtimer: Implement minimum alarm interval for allowing suspend

alarmtimer suspend return -EBUSY if the next alarm will fire in less
than 2 seconds.  This allows one RTC seconds tick to occur subsequent
to this check before the alarm wakeup time is set, ensuring the wakeup
time is still in the future (assuming the RTC does not tick one more
second prior to setting the alarm).

If suspend is rejected due to an imminent alarm, hold a wakeup source
for 2 seconds to process the alarm prior to reattempting suspend.

If setting the alarm incurs an -ETIME for an alarm set in the past,
or any other problem setting the alarm, abort suspend and hold a
wakelock for 1 second while the alarm is allowed to be serviced or
other hopefully transient conditions preventing the alarm clear up.

Change-Id: I1d0e8c2f57b118c4e1d356cddc5f8229ce505e44
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
[ivan.khoronzhuk@ti.com: back ported from k3.8. Use current wakelock
framework instead of wakeup framework]
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
ARM: OMAP4470: CLOCKDOMAIN: add 4470 version of l3_dss_clkdm

BB2D hangs when H/W auto idle mode is used for the l3_dss_clkdm,
this patch introduces a 4470 version of l3_dss_clkdm which supports
s/w wakeup and sleep only.

Change-Id: Id9c050894a656d8036ffe59d1cc1c29eaec65dfc
Signed-off-by: Tony Lofthouse <a0741364@ti.com>
[ivan.khoronzhuk@ti.com: ported from p-android-omap-3.0]
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
usb: otg: twl6030-usb: Add charger detector wake_lock

Added wake_lock to fix race in usb. The race is possible
if on resume from suspend musb_wake_lock is released
before otg_wake_lock is activated. If it occurs
device goes to suspend at the time of charger
detection sequence, and therefore detection fails.

Change-Id: I586bc7161f2498340b9846083b5430187f6ee811
Signed-off-by: Oleg_Kosheliev <oleg.kosheliev@ti.com>
OMAP4: 4430SDP: Change hardware name

Change hardware name to Android specific "OMAP4 Blaze board".
This name used by Android init process for find hardware-specific
init.rc file.

Based on k3.0 commit:
p-android-omap-3.0: 1904c0434c [Dan Murphy <dmurphy@ti.com>]

Change-Id: Id238cb884c50caa08cc20b729de996be37b03fc2
Signed-off-by: Alexander Savchenko <oleksandr.savchenko@ti.com>
Signed-off-by: Ruslan Bilovol <ruslan.bilovol@ti.com>
OMAPLFB: VRAM buffers for second FB.

For JB-MR1 HWCv1.1 we need a second FB device setup at init time.
A swapchain of VRAM buffers are setup at init time.

Change-Id: Ifd5d100a939dce285ac3c844edad525043f933e8
Signed-off-by: Gowtham Tammana <g-tammana@ti.com>
OMAPFB: VRAM size setting for FB1.

We are allocating VRAM memory to hold 1080p swap chain for FB1.

Change-Id: I15f6b074a63d5304f767a63e60884bdf55fa2035
Signed-off-by: Gowtham Tammana <g-tammana@ti.com>
usb: otg: twl6030-usb: Remove redundant variable comparator

The static variable comparator was used only once in
probe and it's possible to remove it, using directly
the data which was loaded to this var.

Change-Id: Iba46251d867f94e064555ec1f3668b4bde47d3ca
Signed-off-by: Oleg_Kosheliev <oleg.kosheliev@ti.com>