ARM: OMAP3+: dpll: Configure autoidle mode only if it's supported

The current DPLL code enables and disables autoidle features
without checking whether the autoidle register is available.
Fix this by putting a check for the existence of the autoidle
register in the DPLL data.

With such a check in place, for DPLLs which do not support this
feature, simply skipping the autoidle_reg entry in the DPLL data
is sufficient.

Signed-off-by: Vaibhav Bedia <vaibhav.bedia@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Watchdog: OMAP: Fix the runtime pm code to avoid module getting stuck intransition state.

OMAP watchdog driver is adapted to runtime PM like a general device
driver but it is not appropriate. It is causing couple of functional
issues.

1. On OMAP4 SYSCLK can't be gated, because of issue with WDTIMER2 module,
which constantly stays in "in transition" state. Value of register
CM_WKUP_WDTIMER2_CLKCTRL is always 0x00010000 in this case.
Issue occurs immediately after first idle, when hwmod framework tries
to disable WDTIMER2 functional clock - "wd_timer2_fck". After this
module falls to "in transition" state, and SYSCLK gating is blocked.

2. Due to runtime PM, watchdog timer may be completely disabled.
In current code base watchdog timer is not disabled only because of
issue 1. Otherwise state of WDTIMER2 module will be "Disabled", and there
will be no interrupts from omap_wdt. In other words watchdog will not
work at all.

Watchdong is a special IP and it should not be disabled otherwise
purpose of it itself is defeated. Watchdog functional clock should
never be disabled. This patch updates the runtime PM handling in
driver so that runtime PM is limited only during probe/shutdown
and suspend/resume.

The patch fixes issue 1 and 2

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
[steven@steven676.net: backport to p-android-omap3-3.0]
OMAP3630: Add margins to SR-calibrated voltages for VDD2 (CORE) as well
encore_defconfig: watchdog changes

* Disable CONFIG_WATCHDOG_NOWAYOUT to prevent watchdogd crashes from
  causing spurious reboots
* Use the TWL4030 watchdog, which seems to work better, instead of the
  OMAP watchdog
encore: explicitly enable TWL4030 MADC clock

From the BN 2.6.32 source, which says:

"This is needed if battery power is not managed by the PMIC, in which
case MADC clock must be managed by the MADC driver itself."
TWL4030: set STOPON_PWRON during a warm reset

From the BN 2.6.32 source.
encore: configure Vmmc2 as fixed voltage regulator instead of via PMIC

It appears that encore's PMIC doesn't have a Vmmc2 regulator, but we've
been attempting to set one up in the TWL anyway -- presumably for the
side effect of telling the MMC subsystem the input voltage it has
available.  The "correct" way of doing this is to set up a "fixed
regulator" which tells the kernel the voltage of the Vmmc2 supply.
ARM: OMAP3: TWL4030: ensure sys_nirq1 is mux'd and wakeup enabled

The SYS_NIRQ1 pin is the interupt line for the PMIC part of the TWL6030
and interrupts from the PMIC are needed as wakeup sources.

Ensure this pin is mux'd as input and has wakeup enabled so PMIC
interupts (e.g. RTC) can be used as wakeup sources.

Tested on 3430/n900, OMAP3530/Overo Fire, 3730/Overo FireSTORM,
3730/Beagle-xM.

Signed-off-by: Kevin Hilman <khilman@ti.com>
[steven@steven676.net: make apply to 3.0]
HID: add user-space I/O driver support for HID from android-3.0 tree

This driver (apparently upstreamed and then backported to the
android-3.0 branch) is needed for Bluetooth HID support with the new BT
userland stack introduced in Android 4.2.  (Thanks to XDA user Deegan87
for noticing that BT HID support broke.)

This patch combines the following commits from the android-3.0 branch:

4409981 HID: uhid: introduce user-space I/O driver support for HID
ef5006b HID: uhid: add internal message buffer
191b032 HID: uhid: allow poll()'ing on uhid devices
b8dd3d9 HID: uhid: implement read() on uhid devices
d3444a8 HID: uhid: implement write() on uhid devices
6b1a4c7 HID: uhid: add UHID_CREATE and UHID_DESTROY events
e0ad830 HID: uhid: allow feeding input data into uhid devices
6645460 HID: uhid: forward hid report-descriptor to hid core
245fd8c HID: uhid: add UHID_START and UHID_STOP events
e458139 HID: uhid: forward open/close events to user-space
bd46634 HID: uhid: forward output request to user-space
715ee7c HID: uhid: forward raw output reports to user-space
c12e46f HID: uhid: implement feature requests
bd76675 HID: uhid: add documentation
db58898 HID: uhid: silence gcc warning
d4bad8b HID: uhid: Fix sending events with invalid data
encore_cm10.1_defconfig: enable CONFIG_UHID

Required for Bluetooth HID profile support with Android 4.2/CM10.1.
Revert "MMC: increased write data timeout for SD cards to 500ms"

To be superseded by an upstream fix.

This reverts commit 6aabcb60199e3326cf48b2cb046e3d072d1b1f2b.
mmc: use really long write timeout to deal with crappy cards

Several people have noticed that crappy SD cards take much longer to
complete multiple block writes than the 300ms that Linux specifies.
Try to work around this by using a three second write timeout instead.

This is a generalized version of a patch from Chase Maupin
<Chase.Maupin@ti.com>, whose patch description said:

* With certain SD cards timeouts like the following have been seen
  due to an improper calculation of the dto value:
    mmcblk0: error -110 transferring data, sector 4126233, nr 8,
    card status 0xc00
* By removing the dto calculation and setting the timeout value
  to the maximum specified by the SD card specification part A2
  section 2.2.15 these timeouts can be avoided.
* This change has been used by beagleboard users as well as the
  Texas Instruments SDK without a negative impact.
* There are multiple discussion threads about this but the most
  relevant ones are:
    * http://talk.maemo.org/showthread.php?p=1000707#post1000707
    * http://www.mail-archive.com/linux-omap@vger.kernel.org/msg42213.html
* Original proposal for this fix was done by Sukumar Ghoral of
  Texas Instruments
* Tested using a Texas Instruments AM335x EVM

Signed-off-by: Paul Walmsley <paul@pwsan.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
Clean up Kconfig menu for encore overclock
encore: set REVERSE_Y_FLAG for ft5x06 touchscreen

The driver currently behaves as if this flag is set regardless of the
actual value of the flags (really, BN?).  Let's actually set this flag
so that the value of flags matches the behavior.
ft5x06: don't assume REVERSE_Y_FLAG is set

After all, what's the point of having such a flag if you ignore its
value?
cyttsp: add support for flipping and reversing coordinate axes

This is needed to support touchscreen installations which don't match
the "natural" orientation of the device.
encore: add support for changing default screen orientation

We need this if we don't want to use rotation in SurfaceFlinger (buggy
in CM10.1).
encore_cm10.1_defconfig: set CONFIG_ENCORE_ORIENTATION_LANDSCAPE

This allows us to avoid using the buggy ro.sf.hwrotation feature of
SurfaceFlinger.
encore_cm10.1_defconfig: don't use true color for Boxer panel

This hurts performance, and 16-bit color no longer looks terrible after
http://review.cyanogenmod.org/35240 was merged.
OMAP3: PVR: enable informing PM subsystem of our bus throughput requirements

Leads to better performance, particularly in CPU/DSP-light workloads
where cpufreq would otherwise dial down the L3 bus clock frequency.

Discovered in the LGE Sniper source by keyodi.

Discovered-by: keyodi <zeusomighty@hotmail.com>