OMAP4: DPLL cascading: Removed race condition while entering in the DPLL cascading

Checking if omap is in DPLL cascading has to be under a lock. Without the lock it
can lead to a situation when one thread is waiting for omap_dvfs_lock thinking
that is not in DPLL cascading while another thread, that has locked dvfs
lock, put omap in dpll cascading. So when dvfs_lock will be unlocked the first
thread will run thinking that omap is not in DPLL cascading but it has
been put in DPLL cascading already.

Example:

Assume the device is not in dpll cascading state,
that is omap4_is_in_dpll_cascading = 0.

+--------------------------------+--------------------------------------------+
|           thread 1             |                thread 2                    |
+--------------------------------+--------------------------------------------+
|                                | ->omap4_dpll_cascading_blocker_release() { |
|                                | ...                                        |
|                                | mutex_lock(dvfs_lock)                      |
|                                | ... ->                                     |
| -> omap_device_scale() {       |                                            |
| ...                            |                                            |
| if (omap4_is_in_dpll_cascading |                                            |
|                       == 0)    |                                            |
| mutex_lock(dvfs_lock) ->       |                                            |
|                                | -> ...                                     |
|                                | omap4_is_in_dpll_cascading = 1             |
|                                | ... //enter in dpll cascading              |
|                                | mutex_unlock(dvfs_lock)                    |
|                                | ... ->                                     |
| -> mutex_lock(dvfs_lock)       |                                            |
| ... // do bad things           |                                            |
+--------------------------------+--------------------------------------------+

Change-Id: I2d7769a4b7347197c0c9c149873207a322fd4d5c
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
MMC: Make sure PBIAS config matches VMMC supply.

Depending on the system, VMMC may end up being 3 or 1.8v.  It is
important that the PBIAS cell be configured to match the supply.
Fortunately, the PBIAS cell contains a handy detector which can
determine what the supply is set to after PWRDNZ has been released.
Use this detector to make sure that the cell is properly configured
and does not damage itself.

Change-Id: Id59ab8e4042efe0778a80f1476bcf8aa746e6cd6
Signed-off-by: John Grossman <johngro@google.com>
Signed-off-by: Ruslan Bilovol <ruslan.bilovol@ti.com>
Blaze Defconfig: Enable CONFIG_MODVERSIONS

CONFIG_MODVERSIONS allows modules to be used
with a different kernel than what it was built
against. When CONFIG_MODVERSIONS is enabled,
the kernel will add a special piece of versioning
info to every exported symbol. This versioning info
is calculated by a CRC algorithm which recursively
looks at the symbols associated structs, unions,
enums, and typedefs. When an external module is built,
it will store the corresponding symbol and version info.
When the module is inserted a check is performed
to ensure that the version for each symbol matches.

This ensures that the interface between kernel
and modules is not broken, and allows more flexibility
than an explicit kernel version check.

Change-Id: Idd358dcaa86f1c77544944899d1c3d355d6c15e6
Signed-off-by: Tate Hornbeck <tate.hornbeck@ti.com>
Revert "configs: blaze/panda: zero out remoteproc dynamic carveout (dsp)"

This reverts commit 9e69eab645d01b7b6c8d6d9eda64eaa210236536.

DSP currently requires 4MB of memory to be set-aside to meet its
firmware requirements. This memory can either be dynamically
reserved or statically reserved during board initialization.
The above commit zeroed out the dynamic configuration sizes as
the static reservation was used previously. DSP does not have
a mandatory requirement to use static reservation, hence the
above commit is being reverted in preparation for switching to
a dynamic reservation.

Change-Id: I8bf374b7865025f2e6b3aff7c5e3308a136a87ea
Signed-off-by: Jesse Villarreal <jesse.villarreal@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
blaze_defconfig: Enable SCHED_TRACER

The Galaxy Nexus JB production devices support the systracer.py
script which can be used to enable tracepoints in Android. This
needs the SCHED_TRACER config flag to be enable.

(Cribbed from the tuna defconfig in public kernel)
b129322 omap4: tuna: enable SCHED_TRACER in defconfig

Change-Id: I1a20095f7fe2ad3c047ff7067cd021032381141e
Signed-off-by: Tony Lofthouse <a0741364@ti.com>
blaze_defconfig: enable USB networking

USB network adapters are widely used for many cases.
Enable USB networking so rebuild of kernel will not be
required for USB network adapters usage.

Change-Id: Ic45ff71922538be6b0404c3674ac9002a838ae3a
Signed-off-by: Ruslan Bilovol <ruslan.bilovol@ti.com>
blaze_defconfig: Enable LG LD089WU1 panel

Enable LG LD089WU1 panel with WUXGA resolution in kernel configuration file

Change-Id: I0a88e395d495d85997c1dc60153ab73eea7e17ed
Signed-off-by: Victor Kleinik <x0150886@ti.com>
blaze_defconfig: build Bluetooth as modules

Build the Bluetooth sub-system and the drivers as modules. This is to enable
building the Bluetooth sub-system and drivers via the compat-wireless approach
for enabling BlueTI.

Change-Id: I9465b5fc8ff651c167e48920726592a5080926e6
Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
blaze_defconfig: build gps driver as modules

TI's GPS solution for Android expects gps driver to be built as a module.

Change-Id: If7d989c74363ab719f08c308e7c746fd4cf8d324
Signed-off-by: Bindu <bkurian@ti.com>
blaze_defconfig: Add KPROBES and RELAY dynamic instrumentation

On top of SCHED_TRACER support these flags are required for
tooling purposes and should have no runtime impact until
enabled.

Change-Id: I64985cfc339c41d5bbb65f4773aea889ee49e4ee
Signed-off-by: Tony Lofthouse <a0741364@ti.com>
[Media:Radio] wl12xx: Fix for overflow while getting irq status

->dlen is 8 bit long and so while memcpy there is a chance
that fmdev->irq_info.flag will overflow.

So this patch removes memcpy and instead copies the 16bit flag
register value from skb->data to fmdev->irq_info.flag directly.

Change-Id: I37604b91b2777ed9e56a7e1c1ecefe32e9024170
Signed-off-by: Manjunatha Halli <x0130808@ti.com>
[Media:Radio] WiLink: Add support for Russian Band

This patch adds support for russian band (frequency range
65.8 MHz to 74 MHz).

This frequency range comes under OIRT FM broadcast band which is
currently used by Russia,Belarus,Moldova and Ukraine.

User app has to write "2" to "/sys/class/video4linux/radio0/fmrx_band"
to switch to Russian/OIRT band.

Change-Id: I26ea5b54afab10eb1769e0b07421d0b98ca24eee
Signed-off-by: Manjunatha Halli <x0130808@ti.com>
[Media:Radio] WiLink: Miscellaneous fixes for FM Receiver

This patch fixes below small issues with FM RX,
	1) Enables the support for FM Alternate Frequency
	2) Modifies Wrap_Seek such that seek will try for one time
	   and if it didn't get a good station within, then returns
	   the default frequency according to band.

Change-Id: Id9ca57451847617fade8959154f205cfff06faee
Signed-off-by: Manjunatha Halli <x0130808@ti.com>
[Media:Radio] WiLink: Add support for complete scan

This patch adds support for complete scan feature.

To start/stop/read complete scan user has to write to
'/sys/class/video4linux/radio0/fmrx_comp_scan'

After complete scan read on /dev/radio will give the
scanned results

Change-Id: Ic02408cfbfcea3c10623da8f377a0224ce7b4c31
Signed-off-by: Manjunatha Halli <x0130808@ti.com>
Revert "Revert "MFD: twl6040-codec: Add uEvent based event notification""

This reverts commit e620621db9df512101087a0db1e2ccf5a90b14eb.
Revert "Revert "MFD: twl6040-codec: Add register cache""

This reverts commit 378578e80deba05758df0253b7817859805bbdee.
Revert "Revert "MFD: twl6040-codec: Add register supply query APIs""

This reverts commit 0b9a0b75b649d74ad7ab60f014d7ddb1759fb9e0.
Revert "Revert "MFD: twl6040-codec: Add register context restore""

This reverts commit 496184b5ceb42ff6bcf7136cd9bab21ef35c97cd.
Revert "Revert "MFD: twl6040-codec: Handle thermal interrupt""

This reverts commit 4ec2cd121d16cb6900fa49e4f8288209d15ae901.
Revert "Revert "MFD: twl6040-codec: Refactor power-on verification""

This reverts commit a8a09682532b71dca4b3fbdd20b19b6ddc8689bd.